$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] Member function varible callable...
From: Igor R (boost.lists_at_[hidden])
Date: 2010-05-11 11:08:25
> 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();