Opened 8 years ago

Last modified 7 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:

Description

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 by Jan Gaspar, 8 years ago

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

comment:2 by Alex Merry <alexander.merry@…>, 7 years ago

Milestone: To Be DeterminedBoost 1.59.0

See https://github.com/boostorg/circular_buffer/pull/7

This should be resolved in 1.59.0.

Note: See TracTickets for help on using tickets.