Example code:

Indeed, your code is buggy:

 void TimerCallback() {

The (documented) correct prototype is:

 void TimerCallback(ev::timer &w, int revents) {

After fixing your code, it compiles fine on my system, and will do so on
freebsd as well.


Because you call method_thunk, but i use method_noargs_thunk.  Look:
It's your call:
  template<class K, void (K::*method)(watcher &w, int)>
    void set (K *object) throw ()
    {
      set_ (object, method_thunk<K, method>);
    }

It's my call:
    template<class K, void (K::*method)()>
    void set (K *object) throw ()
    {
      set_ (object, method_noargs_thunk<K, method>);
    }

And:
   template<class K, void (K::*method)(watcher &w, int)>
    static void method_thunk (EV_P_ ev_watcher *w, int revents)
    {
(static_cast<K *>(w->data)->*method) // GOOD: there are parentheses!
        (*static_cast<watcher *>(w), revents);
    }

    template<class K, void (K::*method)()>
    static void method_noargs_thunk (EV_P_ ev_watcher *w, int revents)
    {
static_cast<K *>(w->data)->*method // ERROR: there aren't parentheses!
        ();
    }


_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to