Ticket #8553: scoped_allocator.patch

File scoped_allocator.patch, 3.4 KB (added by Markus Mathes <Markus.Mathes@…>, 9 years ago)

Patch to add swap support to scoped_allocator.hpp

  • scoped_allocator.hpp.

    old new  
    648648
    649649   public:
    650650
     651   void  swap(scoped_allocator_adaptor_base& other)
     652   {
     653      container_detail::do_swap(outer_allocator(),other.outer_allocator());
     654      m_inner.swap(other.inner_allocator());
     655   }
     656
    651657   scoped_allocator_adaptor_base &operator=
    652658      (BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other)
    653659   {
     
    795801   {}                                                                                           \
    796802                                                                                                \
    797803   public:                                                                                      \
     804   void  swap(scoped_allocator_adaptor_base& other)                                             \
     805   {                                                                                            \
     806      container_detail::do_swap(outer_allocator(),other.outer_allocator());                     \
     807      m_inner.swap(other.inner_allocator());                                                    \
     808   }                                                                                            \
     809                                                                                                \
    798810   scoped_allocator_adaptor_base &operator=                                                     \
    799811      (BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other)                              \
    800812   {                                                                                            \
     
    916928      {}
    917929 
    918930   public:
     931   void  swap(scoped_allocator_adaptor_base& other)
     932   {
     933      container_detail::do_swap(outer_allocator(),other.outer_allocator());
     934   }
     935
    919936   scoped_allocator_adaptor_base &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other)
    920937   {
    921938      outer_allocator_type::operator=(other.outer_allocator());
     
    11421159      : base_type(::boost::move(other.base()))
    11431160      {}
    11441161
     1162   void  swap(scoped_allocator_adaptor& other)
     1163   {
     1164      base_type::swap(static_cast<base_type &>(other));
     1165   }
     1166
    11451167   scoped_allocator_adaptor &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor) other)
    11461168   {
    11471169      base_type::operator=(static_cast<const base_type &>(other));
     
    14631485    return ! (a == b);
    14641486}
    14651487
     1488template <typename OuterA1
     1489   #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
     1490   , typename... InnerAllocs
     1491   #else
     1492   BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q)
     1493   #endif
     1494   >
     1495inline void swap(
     1496   scoped_allocator_adaptor<OuterA1
     1497      #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
     1498      ,InnerAllocs...
     1499      #else
     1500      BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
     1501      #endif
     1502      >& a,
     1503   scoped_allocator_adaptor<OuterA1
     1504      #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
     1505      ,InnerAllocs...
     1506      #else
     1507      BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
     1508      #endif
     1509   >& b)
     1510{
     1511    a.swap(b);
     1512}
     1513
    14661514}} // namespace boost { namespace container {
    14671515
    14681516#include <boost/container/detail/config_end.hpp>