On Tue, Mar 23, 2010 at 6:02 PM, Ovanes Markarian <om_boost@keywallet.com> wrote:
Hi!

This one works...

#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#include <boost/lambda/construct.hpp>
#include <algorithm>
#include <vector>

struct A
{
      A(int)   {}
      void f()const {}
};        

int main( )
{
      using namespace boost::lambda;

      std::vector< int > v;
      std::for_each( v.begin( ), v.end(), bind(&A::f, bind<A>(constructor<A>(), _1)));
}



It does indeed, making method f() const fixes it, but I still can't quite see why. Without the
constness of f() the guts of the error says this,

/usr/include/boost/lambda/detail/actions.hpp:87: error: no matching function for call to ‘boost::lambda::function_adaptor<void (A::*)()>::apply(void (A::* const&)(), const A&)’

from which it seems that the constructed required signature includes a const A&. Why is this?

- Rob.