Boost logo

Boost :

Subject: Re: [boost] [iterator] counting_iterator::reference should bevalue_type?
From: Arno Schödl (aschoedl_at_[hidden])
Date: 2009-01-05 15:59:31


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

The same is true for a random_access_traversal transform_iterator with a functor returning by value. Why is this so bad?

>Could you please open a Trac ticket for this one?

Done.

Arno

--
Dr. Arno Schoedl · aschoedl_at_[hidden] 
Technical Director 
 
think-cell Software GmbH · Invalidenstr. 34 · 10115 Berlin, Germany 
http://www.think-cell.com · phone +49-30-666473-10 · toll-free (US) +1-800-891-8091
Directors: Dr. Markus Hannebauer, Dr. Arno Schoedl · Amtsgericht Charlottenburg, HRB 85229

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