Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.MultiArray + Boost.Lambda woes
From: anony (janezz55_at_[hidden])
Date: 2010-07-02 02:52:07


On 07/01/10 06:13, Steven Watanabe wrote:
> anony wrote:
>> 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);

Yes, I didn't lie, the construct, even though wrong, compiles ok. The
snippet below gives the correct result, though

float max_height(*std::max_element(hfa.data(), hfa.data() +
  hfa.num_elements(), bll::bind(
  static_cast<wave_float(*)(float)>(&std::abs), bll::_1) <
  bll::bind(
  static_cast<wave_float(*)(float)>(&std::abs), bll::_2)));

What I don't like about it is the use of pointers, Does there exist no
prettier approach using iterators?


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