Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.MultiArray + Boost.Lambda woes
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-07-01 00:13:45


anony wrote:
> I have the following code:
>
> typedef boost::multi_array<float, 3> multi_array_typea;
>
> multi_array_typea hfa;
>
> multi_array_typea::extent_gen extentsa;
> hfa.resize(extentsa[a][b][c]);
>
> multi_array_typea::const_iterator p(std::max_element(hfa.begin(),
> hfa.end(), bll::bind(static_cast<float(*)(float)>(&std::abs), bll::_1)));
>
> Which fails to compile, interestingly:
>
> multi_array_typea::const_iterator p(std::max_element(hfa.begin(),
> hfa.end()));
>
> compiles ok. Can someone please come up with appropriate BLL magic to
> resolve this situation? It seems to me, I'd somehow have to dereference
> bll:_1.
>

No. The signature that std::max_element expects is
bool f(float, float);
What you're passing is
float f(float);

In Christ,
Steven Watanabe


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