Boost logo

Boost :

Subject: Re: [boost] Boost.Algorithm design question
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-10-06 14:49:35


on Thu Oct 06 2011, Eric Niebler <eric-AT-boostpro.com> wrote:

> On 10/6/2011 8:51 AM, Marshall Clow wrote:
>> On Oct 6, 2011, at 8:30 AM, Dave Abrahams wrote:
>
>>> on Thu Oct 06 2011, lcaminiti <lorcaminiti-AT-gmail.com> wrote:
>>>> I think what I am trying to ask is: Does anyone know why std::find does not
>>>> use use iterator_traits::value?
>>>
>>> IIUC it was an oversight, and IIRC Stepanov's later work (EOP) does
>>> restrict the type of "value".
>>
>> I could be misremembering, but didn't iterator_traits come after the
>> first release of the STL?
>
> Marshall, I don't see how it could. Without iterator_traits, raw
> pointers couldn't be valid iterators, and that was an important part of
> Stepanov's vision.

Early implementations used an internal __iterator_category() function
that returned a tag. It was implemented like this:

  template <class T>
  random_access_iterator_tag __iterator_category(T*);

  template <class T>
  T::iterator_category __iterator_category(T const&);

I think the concept was probably weakly defined as something like: "your
type either has to be a pointer, or it has to have a nested
iterator_category typedef."

But I could be wrong of course.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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