Opened 14 years ago

Last modified 8 years ago

#2640 new Bugs

counting_iterator::reference lifetime tied to iterator — at Initial Version

Reported by: schoedl Owned by: Dave Abrahams
Milestone: Boost 1.38.0 Component: iterator
Version: Boost 1.37.0 Severity: Problem
Keywords: counting_iterator reverse_iterator Cc: flast@…

Description

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()); }

The problem is that iterator::reference is expected to stay valid even if the iterator it was obtained from is dead.

Change History (1)

by schoedl, 13 years ago

Attachment: counting_iterator.hpp.patch added

patch

Note: See TracTickets for help on using tickets.