35struct transient_function;
47template <
typename RetT,
typename... Args>
55 template <
typename Up>
58 return (*
static_cast<Up*
>(target))(std::forward<Args>(args)...);
77 sizeof(
void*) ==
sizeof(target),
78 "It will not be possible to pass functions by reference on this platform. "
79 "Please use explicit function pointers i.e. foo(target) -> foo(&target)");
80 m_target =
static_cast<void*
>(target);
90 sizeof(
void*) ==
sizeof(target),
91 "It will not be possible to pass functions by reference on this platform. "
92 "Please use explicit function pointers i.e. foo(target) -> foo(&target)");
93 m_dispatch = dispatcher<target_function_reference>;
94 m_target =
static_cast<void*
>(target);
100 return m_dispatch(m_target, std::forward<Args>(args)...);
105 dispatch_type m_dispatch =
nullptr;
106 void* m_target =
nullptr;
122 template <
typename FuncT>
124 : m_functor(
std::forward<FuncT>(_func))
A light-weight alternative to std::function. Pass any callback - including capturing lambdas - cheapl...
typename std::decay< T >::type decay_t
Alias template for decay.
transient_destructor & operator=(const transient_destructor &)=delete
transient_destructor & operator=(transient_destructor &&rhs) noexcept=default
transient_destructor(transient_destructor &&rhs) noexcept=default
transient_destructor(FuncT &&_func)
transient_destructor(const transient_destructor &)=delete
RetT operator()(Args &&... args) const
RetT(Args...) target_function_reference
static RetT dispatcher(void *target, Args &&... args)
transient_function(transient_function &&) noexcept=default
transient_function(target_function_reference target)
~transient_function()=default
transient_function()=default
RetT(*)(void *, Args...) dispatch_type
transient_function & operator=(target_function_reference target)
typename typename typename