Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::bind and Motif
From: Igor R (boost.lists_at_[hidden])
Date: 2012-05-02 12:04:11


>> Bind creates a function object, while XtAppAddTimeOut expects a
>> function pointer, as you mentioned.
>> You can define a static member function that matches
>> XtTimerCallbackProc signature, and pass it without bind.
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
> Thanks, that was the way i did it before.
> But from a static member function i have no access to the object attributes,
> so i had to make it a singleton class
> that was what i wanted to prevent by using bind.

No, you don't have to make a signleton. The function XtAppAddTimeOut
accepts "XtPointer client_data" argument, where you can pass "this".
Then you get it back in the callback function, and type-cast it to its
original type.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net