
I have this compile error:
I did this:
std::for_each(map.begin(), map.end(),
bind( &BlockList::sortY, this,
*bind(&MyMap::value_type::second,
_1)));
../BlockList.cpp:769: error: no matching function for
call to âbind(<unknown type>, const BlockList*
const, const
boost::lambda::lambda_functor
, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > , boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > >)â make: *** [BlockList.o] Error 1
--- 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