Boost logo

Boost :

Subject: Re: [boost] [iterator] iterator-category logic
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2012-04-19 08:09:28


On 18.04.2012 10:20, Jeffrey Lee Hellrung, Jr. wrote:
> For better or for worse, the present logic in iterator_facade is strictly
> (more or less) correct given the C++03 iterator requirements, but I just
> looked up the N3290 draft of C++11 and it appears that any requirements
> that *i return a real reference have been dropped, thus allowing for proxy
> references in all iterator categories.
> (a) Am I interpreting the C++11 iterator requirements correctly?
>
I'm afraid not. I can only quote N3376 (the first draft of C++1y) right
now, but it says in the requirements for forward iterators (24.2.5p1):
"if X is a mutable iterator, /reference/ is a reference to T; if X is a
const iterator, /reference/ is a reference
to const T,"
where /reference/ refers to iterator_traits<X>::reference.
And of course the primary Iterator requirements specify that *r returns
iterator_traits<X>::reference.

The change in iterator requirements was supposed to piggy-back on
concepts; when they were removed, so were the iterator changes. They
basically haven't changed since C++03.

Sebastian


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