43 #include <type_traits>
73 template<
typename Ret,
typename... Params>
class function_view<Ret(Params...)> {
74 Ret (*callback)(intptr_t callable, Params...
params) =
nullptr;
77 template<
typename Callable>
78 static Ret callback_fn(intptr_t callable, Params...
params)
80 return (*reinterpret_cast<Callable*>(callable))(
params...);
87 template<
typename Callable>
90 typename std::enable_if<
93 : callback(callback_fn<typename std::remove_reference<Callable>::
type>)
94 , callable(reinterpret_cast<intptr_t>(&callable))
100 return callback(callable,
params...);
103 operator bool()
const {
return callback; }
GLsizei const GLfloat * value
function_view(Callable &&callable, typename std::enable_if< !std::is_same< typename std::remove_reference< Callable >::type, function_view >::value >::type *=nullptr)
GLenum const GLfloat * params
GLint GLint GLsizei GLint GLenum GLenum type
function_view(std::nullptr_t)
#define OIIO_NAMESPACE_END
#define OIIO_NAMESPACE_BEGIN
Ret operator()(Params...params) const