|
C++ Actor Framework 0.19
|
Describes a simple callback, usually implemented via lambda expression. More...
Inherited by caf::callback_impl< F, Result(Ts...)>.
Related Symbols | |
(Note that these are not member symbols.) | |
| using | shared_action_ptr = shared_callback_ptr< void()> |
| Convenience type alias for an action with shared ownership. | |
| template<class F > | |
| auto | make_callback (F fun) |
Wraps fun into a callback function object. | |
| template<class F > | |
| auto | make_type_erased_callback (F fun) |
Creates a heap-allocated, type-erased callback from the function object fun. | |
| template<class F > | |
| auto | make_shared_type_erased_callback (F fun) |
Creates a heap-allocated, type-erased callback from the function object fun with shared ownership. | |
Describes a simple callback, usually implemented via lambda expression.
Callbacks are used as "type-safe function objects" wherever an interface requires dynamic dispatching. The alternative would be to store the lambda in a std::function, which adds another layer of indirection and always requires a heap allocation. With the callback implementation of CAF, the object may remains on the stack and do not cause more overhead than necessary.