[Boost-bugs] [Boost C++ Libraries] #11208: Swapping allocators does not use ADL

Subject: [Boost-bugs] [Boost C++ Libraries] #11208: Swapping allocators does not use ADL
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-04-20 15:04:04


#11208: Swapping allocators does not use ADL
--------------------------------------------+-----------------------------
 Reporter: Alex Merry <alexander.merry@…> | Owner: jano_gaspar
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: circular_buffer
  Version: Boost 1.58.0 | Severity: Problem
 Keywords: |
--------------------------------------------+-----------------------------
 boost::circular buffer has issues when using it with Boost.Interprocess,
 due to attempting to use std::swap on the allocators. Specifically:

 {{{#!cpp
 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

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

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