|
Boost Users : |
From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2002-04-26 14:19:04
Toon Knapen wrote:
> > Hope it's not too complicated :). LL might allow to do
> > better on this one.
>
> Thanks, I'll try it out. Coudl you enlighten me on how to
> solve it with the lambda library. I don't see how to iterate over
> the different indexes in combination with LL ?
Oh, sorry, my last sentence was probably misleading. What I meant is that LL
can do a better job on construction of the function object that is passed to
tuple's 'accumulate':
struct get_value
{
template< typename T >
int operator()(T const& x) const
{
return x.value();
}
};
int sum = accumulate(tuple, 0, _1 + ll::bind(get_value(),_2));
I was also hoping that it could help us to get rid of the ad hoc 'get_value'
class, but, thinking about it more, I don't see how :(.
HTH,
Aleksey
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