Boost logo

Boost :

Subject: Re: [boost] [iterator] counting_iterator::reference shouldbevalue_type?
From: David Abrahams (dave_at_[hidden])
Date: 2009-01-06 12:31:00


on Tue Jan 06 2009, Arno Schödl <aschoedl-AT-think-cell.com> 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.

That's a separate issue. It doesn't.

> Then the current counting_iterator is wrong.

Oh, then you mean that the standard should specify *that* iterator::reference
must outlive the iterator. Then you should know that the standard did
anticipate a similar issue:
http://www.boost.org/doc/libs/1_37_0/libs/iterator/doc/facade-and-adaptor.html#operator
so it's probably intentional.

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

Go for it; write a paper!

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