Boost logo

Boost :

Subject: Re: [boost] [iterator] counting_iterator::referenceshouldbevalue_type?
From: Bo Persson (bop_at_[hidden])
Date: 2009-01-06 11:41:26


Arno Schödl wrote:
>> It's not "so bad," it's just an unnecessary limitation. If you
>> really need a random access counting iterator, you'd be out of
>> luck.
>
> It seems to me that the standard should specify whether
> iterator::reference must outlive its iterator. Then the current
> counting_iterator is wrong. Or iterator::reference may die with its
> iterator, then reverse_iterator is wrong. If the C++ standard is
> quiet on this issue, maybe it should be clarified.

It has been clarified for std::reverse_iterator, which should keep a
valid iterator for the returned reference.

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2807.html#198

Bo Persson


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