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-22 21:42:49


Considering also that neither

        typedef boost::array<double, 2> array_t;
        boost::function<double (const array_t&)> f = _1[0];

nor

        typedef boost::array<double, 2> array_t;
        boost::function<double (array_t)> f = _1[0];

works,

I think there seems to be a patch for lambda to make it more boost::array
friendly and more const-aware. Is it theoriotically possible?

Thanks for attention.

B/Rgds
Max

>
> I don't know why this version works
>
> std::vector<Real> vec(2);
> vec[0] = 1; vec[1] = 2;
> boost::function<Real (std::vector<Real>)> vec_f = _1[0]; //Returns
the
> 0'th element.
> boost::function<Real (std::vector<Real>)> vec_f1 = _1[0] * _1[1];
>
> but this one doesn't.
>
> std::vector<Real> vec(2);
> vec[0] = 1; vec[1] = 2;
> boost::function<Real (const std::vector<Real>&)> vec_f = _1[0];
//Returns
> the 0'th element.
> boost::function<Real (const std::vector<Real>&)> vec_f1 = _1[0] *
_1[1];
>
> B/Rgds
> Max


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