Boost logo

Boost Users :

Subject: Re: [Boost-users] Member function varible callable...
From: Etienne Philip Pretorius (icewolfhunter_at_[hidden])
Date: 2010-05-11 11:19:04


On 11/05/2010 17:08, Igor R wrote:
>> I have 2 functions like:
>>
>> struct obj {
>>
>> void foo() {
>> };
>>
>> void bar() {
>> };
>>
>> }
>>
>> How would I store this in a variable ... so that I can call the function via
>> the variable later...
>>
> using boost::function;
> using boost::bind;
> obj o;
> // NOTE that "o" will be copied
> function<void()> callFoo = bind(&obj::foo, o), callBar = bind(&obj::bar, o);
> callFoo();
> callBar();
>
Thank you, Igor.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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