[Boost-bugs] [Boost C++ Libraries] #2649: iterator_range's assignment fires an assert when rhs is singular

Subject: [Boost-bugs] [Boost C++ Libraries] #2649: iterator_range's assignment fires an assert when rhs is singular
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-01-11 21:41:52


#2649: iterator_range's assignment fires an assert when rhs is singular
--------------------------------------+-------------------------------------
 Reporter: eyal.farago_at_[hidden] | Owner: doug_gregor
     Type: Bugs | Status: new
Milestone: Boost 1.38.0 | Component: range
  Version: Boost 1.36.0 | Severity: Regression
 Keywords: iterator_range |
--------------------------------------+-------------------------------------
 the following code will raise an assertion in debug builds:


 {{{
 typedef boost::iterator_range<std::string> str_range_t;

 std::string eyal("eyal");
 str_range_t eyal_range( eyal ), empty_range;

 //here it is...
 eyal_range = empty_range;
 }}}


 the reason for the assert is an assert in iterator_range's begin/end
 methods, the assignment operator is doing something like
 {{{
 this->m_begin = rhs.begin()
 }}}
 which fails for debug builds when rhs is singular.

 a lot has been said about the decision to remove the singular
 member/concept from the library code, but I believe that assigning a
 singular range '''should not''' raise an assert.

 ps. I stumbled upon this bug after upgrading from 1.34 to 1.36, "I think
 this is a really nasty one because: [[BR]]
 1. it denies me from using a very standard use case.[[BR]]
 2. it simply crashes in release builds.[[BR]]
 3. a massive behavior change for singular ranges which used to behave like
 empty ranges. while I agree that using iterators of a singular range is a
 bad idea, querying for its length is not.[[BR]]

 eyal.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2649>
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:49:59 UTC