Modify

Opened 3 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:

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);
}

Attachments (0)

Change History (2)

comment:1 Changed 3 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

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

This should be resolved in 1.59.0.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Jan Gaspar.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.