[Boost-bugs] [Boost C++ Libraries] #10543: circular_buffer::rotate() incorrectly assumes that circular_buffer::pointer is a simple pointer type

Subject: [Boost-bugs] [Boost C++ Libraries] #10543: circular_buffer::rotate() incorrectly assumes that circular_buffer::pointer is a simple pointer type
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-09-26 11:36:48


#10543: circular_buffer::rotate() incorrectly assumes that circular_buffer::pointer
is a simple pointer type
-------------------------------------------------+-------------------------
 Reporter: Matteo Settenvini | Owner: jano_gaspar
  <matteo.settenvini@…> | Status: new
     Type: Bugs | Component:
Milestone: To Be Determined | circular_buffer
  Version: Boost 1.56.0 | Severity: Problem
 Keywords: |
-------------------------------------------------+-------------------------
 Dear maintainer,

 I am trying to use a boost::circular_buffer inside a shared memory
 segment, along with Boost.Interprocess. This implies that the type of the
 stored pointer is an offset_ptr<T>, and not just a T *.

 In circular_buffer/base.hpp, the rotate method uses a const_cast from the
 member of a const iterator, assuming that "pointer" is indeed a simple
 pointer type. This however fails when it is instead a structure, such as
 boost::interprocess::offset_ptr<T>.

 The patch I am attaching below solves the issue for me, by allowing the
 right template specialization to kick in. I did not test it with different
 pointer types as I am a bit short on time, but by reading the code alone,
 it should work also with plain pointers.

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