libcaf  0.15.5
Public Member Functions | Related Functions | List of all members
caf::callback< Ts > Class Template Referenceabstract

Describes a simple callback, usually implemented via lambda expression. More...

#include <callback.hpp>

Public Member Functions

virtual error operator() (Ts...)=0
 

Related Functions

(Note that these are not member functions.)

template<class F >
select_callback< F >::type make_callback (F fun)
 Creates a callback from a lambda expression.
 

Detailed Description

template<class... Ts>
class caf::callback< Ts >

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 requires a heap allocation. With the callback implementation of CAF, the object remains on the stack and does not cause more overhead than necessary.


The documentation for this class was generated from the following file: