eventxx  1.0.1
eventxx::mem_cb< O, M > Struct Template Reference

Helper functor to use an arbitrary member function as an event handler. More...

Public Member Functions

 mem_cb (O &object, M method) throw ()
 Member function callback constructor. More...
 

Detailed Description

template<typename O, typename M>
struct eventxx::mem_cb< O, M >

Helper functor to use an arbitrary member function as an event handler.

With this wrapper, you can use any object method, which accepts the right parameters (int, short) and returns void, as an event handler. This way you don't have to overload the operator() which can be confusing depending on the context.

You can see an usage example in the Examples Section.

Examples
wrapped-functor-way.cpp.

Constructor & Destructor Documentation

◆ mem_cb()

template<typename O , typename M >
eventxx::mem_cb< O, M >::mem_cb ( O &  object,
method 
)
throw (
)
inline

Member function callback constructor.

It expects to receive a class as the first parameter (O), and a member function (of that class O) as the second parameter.

When this instance is called with fd and ev as function arguments, object.method(fd, ev) will be called.

Parameters
objectObject to be used.
methodMethod to be called.

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