17 Jul
2008
17 Jul
'08
2:34 p.m.
Eric MALENFANT escribió:
Igor R [boost.lists@gmail.com], le 17 juillet 2008 10:09:
typedef boost::function
functor; std::vector<functor> functors; ... using namespace boost::lambda; std::for_each( functors.begin(), functors.end(), bind(&functor::operator(),_1)); Oh, I see... So the explicit bind is unavoidable :(.
As shown here: http://www.boost.org/doc/libs/1_35_0/doc/html/lambda/le_in_details.html#lamb..., the bind() is unavoidable, but it does not have to be that explicit. This should work:
std::for_each(functors.begin(), functors.end(), bind(_1));
Cute! Hadn't realized the first argument of bind can also be filled by a placeholder. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo