$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Levent Yilmaz (sly5+gmane_at_[hidden])
Date: 2006-10-15 18:06:37
Hi,
I have this construct:
class foo {};
void fbar(foo*) {}
int main()
{
using namespace boost::lambda;
std::vector<foo> foos(3);
std::for_each( foos.begin(), foos.end(), bind<void>(&fbar, &_1) );
}
OK, this works. But I want to store the lambda expression, and wasn't
able to to it. The following obvious try doesn't work:
boost::function<void(foo*)> func = bind<void>(&fbar, &_1);
std::for_each( foos.begin(), foos.end(), func );
How should I do this?
thx,
- Levent