Boost logo

Boost :

Subject: Re: [boost] [iterator] counting_iterator::referenceshouldbevalue_type?
From: David Abrahams (dave_at_[hidden])
Date: 2009-01-06 19:46:10


on Tue Jan 06 2009, Arno Schödl <aschoedl-AT-think-cell.com> wrote:

>>> It seems to me that the standard should specify whether iterator::reference must
>>> outlive its iterator.
>> That's a separate issue. It doesn't.
>
> I am confused. As far as I understand, Bo Persson just posted that
> this has been clarified:
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2807.html#198

I see, yes, for the next standard.

> So reference/pointer do not outlive their iterator, and in our case,
> boost::counting_iterator is correct and boost::reverse_iterator is wrong.

With respect to C++0x, that's correct.

I wonder if this means we really are missing an important concept. It
seems to me that the requirement to store a temporary iterator is a
potentially high cost that can be avoided for most iterators, which have
persistent referents.

-- 
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