5 template <
class Signature>
35 template <
class Ret,
class... Args>
40 template <
class FunctionObject,
41 typename std::enable_if<
42 !std::is_same<typename std::decay<FunctionObject>::type,
cFunctionRef>::value,
48 m_CallableData = &a_FunctionObject;
51 m_CallFunction = &ObjectFunctionCaller<FunctionObject>;
55 Ret operator () (Args... a_Args)
57 return m_CallFunction(m_CallableData, std::forward<Args>(a_Args)...);
63 template <
class ObjectType>
67 using ObjectPtr =
typename std::add_pointer<ObjectType>::type;
68 auto & Object = *
static_cast<ObjectPtr
>(a_Callable);
71 return Object(std::forward<Args>(a_Args)...);
Ret(*)(void *, Args...) cCallFunction
cFunctionRef(FunctionObject &&a_FunctionObject)
Construct from a function object.
static Ret ObjectFunctionCaller(void *a_Callable, Args... a_Args)
Function that performs the call.
cCallFunction m_CallFunction
Function that knows how to call the type erased reference.
void * m_CallableData
Type erased reference to a callable.