Opened 8 years ago
Last modified 7 years ago
#10543 new Bugs
circular_buffer::rotate() incorrectly assumes that circular_buffer::pointer is a simple pointer type
Reported by: | Owned by: | Jan Gaspar | |
---|---|---|---|
Milestone: | To Be Determined | Component: | circular_buffer |
Version: | Boost 1.56.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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.
Attachments (1)
Change History (3)
by , 8 years ago
Attachment: | 002-circular-buffer-const_cast-generalization.patch added |
---|
Use boost::intrusive::pointer_traits to specialize the const_cast on the pointer type.