Re: [Boost-bugs] [Boost C++ Libraries] #11609: circular_buffer erroneously invalidates reverse_iterator at pop_back in debug mode

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11609: circular_buffer erroneously invalidates reverse_iterator at pop_back in debug mode
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-09-01 15:55:58


#11609: circular_buffer erroneously invalidates reverse_iterator at pop_back in
debug mode
-----------------------------------+---------------------
  Reporter: christian.stimming@… | Owner:
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: None
   Version: Boost 1.57.0 | Severity: Problem
Resolution: | Keywords:
-----------------------------------+---------------------

Comment (by christian.stimming@…):

 Sorry, here the code again in readable form:

 {{{
 #define BOOST_CB_ENABLE_DEBUG
 #include <boost/circular_buffer.hpp>
 #include <iostream>
 using namespace std;
 int main(int /*argc*/, char /*argv*/) {
   typedef boost::circular_buffer<int> CircBuffer;
   CircBuffer buffer(2);
   buffer.push_back(4);
   buffer.push_back(8);

   CircBuffer::const_reverse_iterator iter = buffer.rbegin();
   cout << "elem=" << *iter << endl; // prints "=8" correctly
   ++iter;
   cout << "elem=" << *iter << endl; // prints "=4" correctly
   buffer.pop_back(); // ERROR: invalidates the iterator
   cout << "elem=" << *iter << endl; // ERROR: Causes "Assertion
 `is_valid(m_buff)' failed." instead of printing "=4"
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11609#comment:1>
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:18 UTC