|
Boost Users : |
Subject: [Boost-users] [Lambda] Lost in lambda land!
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2010-03-23 13:41:41
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 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