Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2006-10-05 10:43:28


Thorsten Ottosen <thorsten.ottosen_at_[hidden]> writes:

> David Abrahams wrote:
>> Thorsten Ottosen <thorsten.ottosen_at_[hidden]> writes:
>>>
>>>I think counting_iterator is not a valid random access iterator because
>>>operator[]() does not yield a reference.
>>
>>
>> That is not a requirement of random access iterator.
>
> Reading the working draft from n2009, table 93 states that
>
> a[n] should be convertible to const T&.

Yes. That does not require it to yield a reference.

>>>Counting iterator should define its reference-type to be the type it
>>>returns from operator[]() (even though it is not a reference). Then I
>>>think it would work.
>>>
>>>Do the authors of the iterator lib agree?
>>
>> No. There are good reasons that it works the way it does.
>
> So there is no way to infer the the type of oprerator[]()
> until we get decltype?

Or concept support; either would do.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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