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