jeudi 22 novembre 2018

Can I use C++11 lambda with libevent?

There is a callback function type in libevent used by event_new().

typedef void (*event_callback_fn)(evutil_socket_t, short, void *);

I want use lambda with event_callback_fn.

If I use

[](evutil_socket_t fd, short flags, void * _param){}

everything is OK.
But if I use the lambda capture list

[&](evutil_socket_t fd, short flags, void * _param){} 

event_new() will not be compiled.

Aucun commentaire:

Enregistrer un commentaire