
AMDG Robert Dailey wrote:
Hi,
In the Boost.Lambda documentation, it has a section for operators that cannot be overloaded, but I'm not really sure if this means you cannot use these operators with lambda expressions.
I have the following map:
class SomeClass { public: void Foo() {} };
std::map
mymap; I want to be able to do std::for_each() on this map and use lambdas to call the Foo() member on each element in the map. For example:
std::for_each( mymap.begin(), mymap.end(), _1.second.Foo() );
Obviously the above does not compile. Is there a way to make this work without doing some crazy template specialization? Thanks.
It's pretty ugly:
#include <map>
#include <algorithm>
#include