Re: [Boost-bugs] [Boost C++ Libraries] #2640: Legal forward iterators cannot store their referents (was: counting_iterator::reference lifetime tied to iterator) (was: counting_iterator::reference lifetime tied to iterator)

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #2640: Legal forward iterators cannot store their referents (was: counting_iterator::reference lifetime tied to iterator) (was: counting_iterator::reference lifetime tied to iterator)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-01-14 16:55:02


#2640: Legal forward iterators cannot store their referents (was:
counting_iterator::reference lifetime tied to iterator)
---------------------------+------------------------------------------------
  Reporter: schoedl | Owner: dave
      Type: Bugs | Status: new
 Milestone: Boost 1.38.0 | Component: iterator
   Version: Boost 1.37.0 | Severity: Problem
Resolution: | Keywords: counting_iterator reverse_iterator
---------------------------+------------------------------------------------
Description changed by dave:

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

New description:

 The iterators library needs a redesign based on the facts noted in
 [[#comment:2|this comment]]

 The original report is below.

 ----



 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.

--
-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2640#comment:3>
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:05 UTC