Boost logo

Boost :

Subject: Re: [boost] [accumulators] why not operator+=?
From: Alan Patterson (alan.patterson_at_[hidden])
Date: 2009-02-02 13:05:23


Steven Watanabe wrote:
> AMDG
>
> Alan Patterson wrote:
>> Doesn't a += interface make an accumulate interface like:
>>
>> std::accumulate(data.begin(), data.end(), acc);
>>
>> more appealing than :
>>
>> std::for_each(data.begin(), data.end(), acc);
>
> std::accumulate uses
> result = result + *iter;
> not
> result += *iter;
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
Yes. But I guess the original question was that why not a += (or +)
operator implemented in accumulator_set to add samples instead of
operator().

Using std::accumulate to accumulate samples (in an accumulation
library) seems more natural to me than the functional implementation.
And, using accumulate implies addition operators.

Alan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk