|
Boost : |
Subject: [boost] [iterator] reverse_iterator<counting_iterator<T>>
From: Arno Schödl (aschoedl_at_[hidden])
Date: 2010-04-13 04:26:10
Hello,
boost::reverse_iterator::dereference() is
typename super_t::reference dereference() const { return *boost::prior(this->base()); }
boost::constant_iterator<T>::reference_type is T const&.
So reverse_iterator< constant_iterator<T> >::dereference returns a reference to a temporary variable. Not good.
I suggest removing the reference from boost::constant_iterator::reference_type, making it T. The rule would be that reference_type must only be a reference if the reference is pointing to some underlying container, not to the iterator itself.
Arno
-- Dr. Arno Schoedl · aschoedl_at_[hidden] Technical Director think-cell Software GmbH · Chausseestr. 8/E · 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 Berlin-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