Callback class based on template specialization. More...
#include <Callback.h>
Public Member Functions | |
Callback () noexcept | |
Create an empty Callback. More... | |
Callback (std::nullptr_t) noexcept | |
Create an empty Callback. More... | |
template<typename Obj , typename Method , typename std::enable_if_t< mstd::is_invocable_r< R, Method, Obj, ArgTs... >::value, int > = 0> | |
Callback (Obj obj, Method method) | |
Create a Callback with a member function. More... | |
template<typename Fn , typename BoundArg , typename std::enable_if_t< mstd::is_invocable_r< R, Fn, BoundArg, ArgTs... >::value, int > = 0> | |
Callback (Fn func, BoundArg arg) | |
Create a Callback with a static function and bound pointer. More... | |
template<typename F , typename std::enable_if_t< !detail::can_null_check< F >::value && mstd::is_invocable_r< R, F, ArgTs... >::value, int > = 0> | |
Callback (F f) | |
Create a Callback with a function object. More... | |
template<typename F , typename std::enable_if_t< detail::can_null_check< F >::value && mstd::is_invocable_r< R, F, ArgTs... >::value, int > = 0> | |
Callback (F f) | |
Create a Callback with a function pointer. More... | |
~Callback ()=default | |
Destroy a callback. More... | |
void | swap (Callback &that) noexcept |
Swap a callback. More... | |
template<typename F , typename = std::enable_if_t< mstd::is_invocable_r<R, F, ArgTs...>::value && !mstd::is_same<mstd::remove_cvref_t<F>, Callback>::value>> | |
Callback & | operator= (F &&f) |
Assign a callback. More... | |
Callback & | operator= (std::nullptr_t) noexcept |
Empty a callback. More... | |
R | call (ArgTs...args) const |
Call the attached function. More... | |
R | operator() (ArgTs...args) const |
Call the attached function. More... | |
operator bool () const noexcept | |
Test if function has been assigned. More... | |
Static Public Member Functions | |
static R | thunk (void *func, ArgTs...args) |
Static thunk for passing as C-style function. More... | |
Friends | |
bool | operator== (const Callback &f, std::nullptr_t) noexcept |
Test for emptiness. More... | |
bool | operator== (std::nullptr_t, const Callback &f) noexcept |
Test for emptiness. More... | |
bool | operator!= (const Callback &f, std::nullptr_t) noexcept |
Test for non-emptiness. More... | |
bool | operator!= (std::nullptr_t, const Callback &f) noexcept |
Test for non-emptiness. More... | |
Callback class based on template specialization.
Definition at line 311 of file Callback.h.
|
noexcept |
Create an empty Callback.
Definition at line 317 of file Callback.h.
|
noexcept |
Create an empty Callback.
Definition at line 321 of file Callback.h.
Callback | ( | Obj | obj, |
Method | method | ||
) |
Create a Callback with a member function.
obj | Pointer to object to invoke member function on |
method | Member function to attach |
Definition at line 351 of file Callback.h.
Callback | ( | Fn | func, |
BoundArg | arg | ||
) |
Create a Callback with a static function and bound pointer.
func | Static function to attach |
arg | Pointer argument to function |
Definition at line 363 of file Callback.h.
Callback | ( | F | f | ) |
Create a Callback with a function object.
f | Function object to attach |
Definition at line 379 of file Callback.h.
Callback | ( | F | f | ) |
Create a Callback with a function pointer.
f | Function pointer to attach |
Definition at line 392 of file Callback.h.
|
default |
Destroy a callback.
R call | ( | ArgTs... | args | ) | const |
Call the attached function.
Definition at line 504 of file Callback.h.
|
explicitnoexcept |
Test if function has been assigned.
Definition at line 520 of file Callback.h.
R operator() | ( | ArgTs... | args | ) | const |
Call the attached function.
Definition at line 513 of file Callback.h.
Callback& operator= | ( | F && | f | ) |
Assign a callback.
Definition at line 472 of file Callback.h.
|
noexcept |
Empty a callback.
Definition at line 494 of file Callback.h.
|
noexcept |
Swap a callback.
Definition at line 416 of file Callback.h.
|
static |
Static thunk for passing as C-style function.
func | Callback to call passed as void pointer |
args | Arguments to be called with function func |
Definition at line 599 of file Callback.h.
|
friend |
Test for non-emptiness.
Definition at line 581 of file Callback.h.
|
friend |
Test for non-emptiness.
Definition at line 588 of file Callback.h.
|
friend |
Test for emptiness.
Definition at line 556 of file Callback.h.
|
friend |
Test for emptiness.
Definition at line 563 of file Callback.h.