Boost logo

Boost Users :

From: Vytautas Leonavicius (vyts_at_[hidden])
Date: 2004-07-30 11:04:16


I am often facing the same thing again and again. Say I have a map:
map< int, Foo* > m;

and I would like to invoke method of Foo on all instances

std::for_each(m.begin(), m.end(), boost::bind(&Foo::method, _1 );

The problem is that map contains pair of key and value, not Foo*. Usually I
create some function taking pair and invoking method needed on .second. But
maybe there is another way to do that?

Thanks!

Vytautas



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