Subject: Re: [boost] [iterator] counting_iterator::referenceshouldbevalue_type?
From: Neil Groves (neil_at_[hidden])
Date: 2009-01-07 04:24:41
On Wed, Jan 7, 2009 at 12:46 AM, David Abrahams <dave_at_[hidden]> wrote:
> 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.
I also wondered about this. Since this is often a problem when composing
iterators, perhaps for the iterators we have control of we could have the
reference type as a template parameter. This would be much like the iterator
adaptor and facade code. Then perhaps it's possible to use a type generator
to generate the appropriate result type based on the combination of
I really haven't thought this through so I'm ready for the flaws and obvious
errors to be pointed out!
I hope this helps, but apologise if it ends up being just spam.
> Dave Abrahams
> BoostPro Computing
> Unsubscribe & other changes:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk