Boost logo

Boost :

Subject: Re: [boost] [iterator] counting_iterator::reference should be value_type?
From: David Abrahams (dave_at_[hidden])
Date: 2009-01-05 13:16:57


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

> Hello,
>
> currently, counting_iterator<T>::reference is Incrementable const&. This makes
> reverse_iterator< counting_iterator<T> >::dereference return a reference to a
> temporary variable:
>
> typename super_t::reference dereference() const { return *boost::prior(this->base());
> }
>
> IMO, the solution is to make counting_iterator return by value.

But then it is no longer a C++03 random access iterator. Probably we
need to make the reference type a parameter to counting_iterator.
Could you please open a Trac ticket for this one?

Thanks,

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