--- libev/ev++.h 2007/12/11 03:18:33 1.18 +++ libev/ev++.h 2007/12/14 17:47:52 1.19 @@ -28,6 +28,7 @@ ev_set_cb (static_cast(this), cb); } + // method callback template void set (K *object) { @@ -41,6 +42,7 @@ (obj->*method) (*static_cast(w), revents); } + // const method callback template void set (const K *object) { @@ -54,6 +56,7 @@ (static_cast(w->data)->*method) (*static_cast(w), revents); } + // function callback template void set (void *data = 0) { @@ -66,6 +69,20 @@ function (*static_cast(w), revents); } + // simple callback + template + void set (K *object) + { + set_ (object, method_noargs_thunk); + } + + template + static void method_noargs_thunk (EV_P_ ev_watcher *w, int revents) + { + K *obj = static_cast(w->data); + (obj->*method) (); + } + void operator ()(int events = EV_UNDEF) { return ev_cb (static_cast(this))