Boost logo

Boost Users :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-04-17 18:24:26


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<int, SomeClass> 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.



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