Subject: [Boost-bugs] [Boost C++ Libraries] #10422: Counting Iterator return-type causes lifetime issues
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-08-29 17:18:40
#10422: Counting Iterator return-type causes lifetime issues
------------------------------+------------------------------
Reporter: neilgroves | Owner: jeffrey.hellrung
Type: Bugs | Status: new
Milestone: To Be Determined | Component: iterator
Version: Boost 1.56.0 | Severity: Problem
Keywords: |
------------------------------+------------------------------
The counting_iterator upon integers has a dereference member function
which is a reference to an integral value held in the iterator. Since an
iterator may be destroyed, the reference can be invalid.
An example where this occurs was provided by a user of Boost.Range. The
application used counting_range with reversed and transformed adaptors.
The result was garbage since the reversed dereference member function does
*boost::prior(this->base()); Hence it returns a reference to a temporary
iterator that results from the "prior" function.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10422> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC