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))(
81 std::forward<Params>(
params)...);
88 template<
typename Callable>
91 typename std::enable_if<
94 : callback(callback_fn<typename std::remove_reference<Callable>::
type>)
95 , callable(reinterpret_cast<intptr_t>(&callable))
101 return callback(callable, std::forward<Params>(
params)...);
104 operator bool()
const {
return callback; }
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
function_view(std::nullptr_t)
#define OIIO_NAMESPACE_END
#define OIIO_NAMESPACE_BEGIN
Ret operator()(Params...params) const