
Sorry. That works. I made a mistake myself.
--- Kevin Heifner
yinglcs2@yahoo.com wrote:
I have a for loop which pass the map.second to a function, like this: class A; typedef map
MyMap; sortY(A& a);
for (MyMap::iterator iter = map.begin(); iter != map.end(); ++iter) { A *a = (*iter).second;
sortY(*a); }
how can I translate the above for() loop into for_each and use boost lambda?
I didn't test the following, but it should work :)
#include
#include using boost::lambda::_1; using boost::lambda::bind;
std::for_each(map.begin(), map.end(), bind(&sortY, *bind(&MyMap::value_type::second, _1)));
KevinH -- Kevin Heifner heifner @ ociweb.com http://heifner.blogspot.com Object Computing, Inc. (OCI) www.ociweb.com _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com