From: David Abrahams (dave_at_[hidden])
Date: 2007-08-01 23:21:56
on Wed Aug 01 2007, Lewis Hyatt <lhyatt-AT-princeton.edu> wrote:
>> On a slightly off-topic but perhaps more interesting note, what's the
>> rationale for having a separate template parameter for the type of the
>> initializing element? If it used the iterator's value_type (or a
>> reference thereto) then this thread wouldn't be happening.
Good point. I guess the current way allows more mischief, which might
be intentional. For example, you could pass an object that, every
time it is converted to int, produces a new random value.
> I think it's because std::iterator_traits didn't exist when the STL
> was first designed. It's similar with accumulate(), you have to pass
> in the starting value so it can grab the type.
You pass the starting value to accumulate so it can grab the value,
not the type.
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com The Astoria Seminar ==> http://www.astoriaseminar.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk