|
Boost Users : |
Subject: [Boost-users] [lambda] Using a reference in an expression
From: Bill Buklis (boostusr_at_[hidden])
Date: 2012-09-12 15:14:06
How does one use a reference in a lambda expression? The documentation
says that "var" does, but it clearly doesn't.
For example this fails to compile because it can't access the copy
constructor:
#include <boost/lambda.hpp>
namespace bll = boost::lambda;
class sample
{
public:
sample()
{
}
sample& operator<<( int )
{
return(*this);
}
private:
sample( const sample& );
};
void test()
{
typedef std::vector<int> V;
V v;
sample s;
std::for_each(v.begin(), v.end(), bll::var(s) << bll::_1);
};
-- Bill
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