Opened 4 years ago

Last modified 3 years ago

#11208 new Bugs

Swapping allocators does not use ADL

Reported by: Alex Merry <alexander.merry@…> Owned by: Jan Gaspar
Milestone: Boost 1.59.0 Component: circular_buffer
Version: Boost 1.58.0 Severity: Problem
Keywords: Cc:


boost::circular buffer has issues when using it with Boost.Interprocess, due to attempting to use std::swap on the allocators. Specifically:

void swap_allocator(circular_buffer<T, Alloc>& cb, const false_type&) {
    std::swap(m_alloc, cb.m_alloc);

does not allow ADL to find the correct swap implementation. This can be worked around by specializing std::swap, but this is not ideal, and leads to some compile issues on OSX with Clang.

The correct implementation would look like

void swap_allocator(circular_buffer<T, Alloc>& cb, const false_type&) {
    using std::swap;
    swap(m_alloc, cb.m_alloc);

Change History (2)

comment:1 Changed 4 years ago by Jan Gaspar

Please apply the patch. The library is not maintained be me any more.

comment:2 Changed 3 years ago by Alex Merry <alexander.merry@…>

Milestone: To Be DeterminedBoost 1.59.0


This should be resolved in 1.59.0.

Note: See TracTickets for help on using tickets.