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)));
}


Regards,
Ovanes

On Tue, Mar 23, 2010 at 6:41 PM, Robert Jones <robertgbjones@gmail.com> wrote:
Hi Folks,

Can anyone tell me why this is wrong? My intention is to call A::f() for each A constructed
on-the-fly from the elements of v.

Thanks, Rob.

#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( );
};

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

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


_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users