Boost logo

Boost Users :

Subject: Re: [Boost-users] Help with a boost::lambda problem and boost::array?
From: Max (loadcom_at_[hidden])
Date: 2009-01-21 21:53:45


Hello jesse

I've tested with this, but didn't work, neither.

typedef boost::array<double, 2> array_t;
boost::function<double (const array_t&)> f
        = lambda::bind(std::multiplies<double>(),
                lambda::bind(&array_t::operator[] const, lambda::_1, 0),
                lambda::bind(&array_t::operator[] const, lambda::_1, 1));

why?

B/Rgds
Max

From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of
jesseperla_at_[hidden]
Sent: Thursday, January 22, 2009 5:35 AM
To: Boost Users Mailing List
Subject: [Boost-users] Help with a boost::lambda problem and boost::array?

Does anyone have an idea why the following doesn't compile:
using lambda::_1;
using lambda::_2;
boost::function<double (const boost::array<double, 2>&)> f =
lambda::ret<double>(_1[0] * _1[1]);

But the following does as a double-check:
using lambda::_1;
using lambda::_2;
boost::function<double (const double&, const double&)> f2 =
lambda::ret<double>(_1 * _2);

Thanks,
Jesse


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