storing some particular lambda expression with boost::function

15 Oct
2006
15 Oct
'06
10:06 p.m.
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
6797
Age (days ago)
6797
Last active (days ago)
0 comments
1 participants
participants (1)
-
Levent Yilmaz