Boost logo

Boost Users :

From: Johan Nilsson (johan.nilsson_at_[hidden])
Date: 2005-03-03 03:18:15


Hi,

would it be possible to implement something the following lines using
lambda, without having all values referring to the same shared object:

...
#include <boost/shared_ptr.hpp>
#include <boost/lambda/lambda.hpp>
#include <algorithm>
#include "Foo.h"

...

using namespace boost;
using namespace boost::lambda;

std::vector<shared_ptr<Foo> > foos(10);
std::for_each(foos.begin(), foos.end(),
              _1 = shared_ptr<Foo>(new Foo));

Thanks // Johan


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