$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r84360 - in branches/release: boost/container libs/container/doc libs/container/test
From: igaztanaga_at_[hidden]
Date: 2013-05-18 17:06:19
Author: igaztanaga
Date: 2013-05-18 17:06:19 EDT (Sat, 18 May 2013)
New Revision: 84360
URL: http://svn.boost.org/trac/boost/changeset/84360
Log:
Fix for #8553
Text files modified: 
   branches/release/boost/container/scoped_allocator.hpp                  |    29 +++++++++++++++++++++                   
   branches/release/boost/container/static_vector.hpp                     |    53 ++++++++++++++++++--------------------- 
   branches/release/libs/container/doc/container.qbk                      |     4 ++                                      
   branches/release/libs/container/test/scoped_allocator_adaptor_test.cpp |    14 ++++++++++                              
   4 files changed, 71 insertions(+), 29 deletions(-)
Modified: branches/release/boost/container/scoped_allocator.hpp
==============================================================================
--- branches/release/boost/container/scoped_allocator.hpp	(original)
+++ branches/release/boost/container/scoped_allocator.hpp	2013-05-18 17:06:19 EDT (Sat, 18 May 2013)
@@ -664,6 +664,12 @@
       return *this;
    }
 
+   void swap(scoped_allocator_adaptor_base &r)
+   {
+      boost::container::swap_dispatch(this->outer_allocator(), r.outer_allocator());
+      boost::container::swap_dispatch(this->m_inner, r.inner_allocator());
+   }
+
    inner_allocator_type&       inner_allocator()
       { return m_inner; }
 
@@ -812,6 +818,12 @@
       return *this;                                                                             \
    }                                                                                            \
                                                                                                 \
+   void swap(scoped_allocator_adaptor_base &r)                                                  \
+   {                                                                                            \
+      boost::container::swap_dispatch(this->outer_allocator(), r.outer_allocator());            \
+      boost::container::swap_dispatch(this->m_inner, r.inner_allocator());                      \
+   }                                                                                            \
+                                                                                                \
    inner_allocator_type&       inner_allocator()                                                \
       { return m_inner; }                                                                       \
                                                                                                 \
@@ -931,6 +943,11 @@
       return *this;
    }
 
+   void swap(scoped_allocator_adaptor_base &r)
+   {
+      boost::container::swap_dispatch(this->outer_allocator(), r.outer_allocator());
+   }
+
    inner_allocator_type&       inner_allocator()
       { return static_cast<inner_allocator_type&>(*this); }
 
@@ -1158,6 +1175,18 @@
       return *this;
    }
 
+   //! <b>Effects</b>: swaps *this with r.
+   //!
+   void swap(scoped_allocator_adaptor &r)
+   {
+      base_type::swap(r);
+   }
+
+   //! <b>Effects</b>: swaps *this with r.
+   //!
+   friend void swap(scoped_allocator_adaptor &l, scoped_allocator_adaptor &r)
+   {  l.swap(r);  }
+
    //! <b>Returns</b>:
    //!   `static_cast<OuterAlloc&>(*this)`.
    outer_allocator_type      & outer_allocator()
Modified: branches/release/boost/container/static_vector.hpp
==============================================================================
--- branches/release/boost/container/static_vector.hpp	(original)
+++ branches/release/boost/container/static_vector.hpp	2013-05-18 17:06:19 EDT (Sat, 18 May 2013)
@@ -21,34 +21,6 @@
 
 namespace boost { namespace container {
 
-/**
- * @defgroup static_vector_non_member static_vector non-member functions
- */
-
-/**
- * @brief A variable-size array container with fixed capacity.
- *
- * static_vector is a sequence container like boost::container::vector with contiguous storage that can
- * change in size, along with the static allocation, low overhead, and fixed capacity of boost::array.
- *
- * A static_vector is a sequence that supports random access to elements, constant time insertion and
- * removal of elements at the end, and linear time insertion and removal of elements at the beginning or 
- * in the middle. The number of elements in a static_vector may vary dynamically up to a fixed capacity
- * because elements are stored within the object itself similarly to an array. However, objects are 
- * initialized as they are inserted into static_vector unlike C arrays or std::array which must construct
- * all elements on instantiation. The behavior of static_vector enables the use of statically allocated
- * elements in cases with complex object lifetime requirements that would otherwise not be trivially 
- * possible.
- *
- * @par Error Handling
- *  Insertion beyond the capacity and out of bounds errors results in calling throw_bad_alloc().
- *  The reason for this is because unlike vectors, static_vector does not perform allocation.
- *
- * @tparam Value    The type of element that will be stored.
- * @tparam Capacity The maximum number of elements static_vector can store, fixed at compile time.
- */
-
-
 namespace container_detail {
 
 template<class T, std::size_t N>
@@ -89,7 +61,32 @@
 
 }  //namespace container_detail {
 
+/**
+ * @defgroup static_vector_non_member static_vector non-member functions
+ */
 
+/**
+ * @brief A variable-size array container with fixed capacity.
+ *
+ * static_vector is a sequence container like boost::container::vector with contiguous storage that can
+ * change in size, along with the static allocation, low overhead, and fixed capacity of boost::array.
+ *
+ * A static_vector is a sequence that supports random access to elements, constant time insertion and
+ * removal of elements at the end, and linear time insertion and removal of elements at the beginning or 
+ * in the middle. The number of elements in a static_vector may vary dynamically up to a fixed capacity
+ * because elements are stored within the object itself similarly to an array. However, objects are 
+ * initialized as they are inserted into static_vector unlike C arrays or std::array which must construct
+ * all elements on instantiation. The behavior of static_vector enables the use of statically allocated
+ * elements in cases with complex object lifetime requirements that would otherwise not be trivially 
+ * possible.
+ *
+ * @par Error Handling
+ *  Insertion beyond the capacity and out of bounds errors results in calling throw_bad_alloc().
+ *  The reason for this is because unlike vectors, static_vector does not perform allocation.
+ *
+ * @tparam Value    The type of element that will be stored.
+ * @tparam Capacity The maximum number of elements static_vector can store, fixed at compile time.
+ */
 template <typename Value, std::size_t Capacity>
 class static_vector
     : public vector<Value, container_detail::static_storage_allocator<Value, Capacity> >
Modified: branches/release/libs/container/doc/container.qbk
==============================================================================
--- branches/release/libs/container/doc/container.qbk	(original)
+++ branches/release/libs/container/doc/container.qbk	2013-05-18 17:06:19 EDT (Sat, 18 May 2013)
@@ -666,7 +666,9 @@
 *  Fixed bugs [@https://svn.boost.org/trac/boost/ticket/7921 #7921],
               [@https://svn.boost.org/trac/boost/ticket/7969 #7969],
               [@https://svn.boost.org/trac/boost/ticket/8118 #8118],
-              [@https://svn.boost.org/trac/boost/ticket/8294 #8294].
+              [@https://svn.boost.org/trac/boost/ticket/8294 #8294],
+              [@https://svn.boost.org/trac/boost/ticket/8553 #8553].
+*  Added experimental `static_vector` class.
 
 [endsect]
 
Modified: branches/release/libs/container/test/scoped_allocator_adaptor_test.cpp
==============================================================================
--- branches/release/libs/container/test/scoped_allocator_adaptor_test.cpp	(original)
+++ branches/release/libs/container/test/scoped_allocator_adaptor_test.cpp	2013-05-18 17:06:19 EDT (Sat, 18 May 2013)
@@ -9,6 +9,7 @@
 //////////////////////////////////////////////////////////////////////////////
 #include <boost/container/detail/config_begin.hpp>
 #include <boost/container/scoped_allocator_fwd.hpp>
+#include <boost/container/detail/utilities.hpp>
 #include <cstddef>
 #include <boost/container/detail/mpl.hpp>
 #include <boost/move/utility.hpp>
@@ -465,6 +466,19 @@
    {
       Scoped0Inner s0i;
       Scoped1Inner s1i;
+      //Swap
+      {
+         Scoped0Inner s0i2;
+         Scoped1Inner s1i2;
+         boost::container::swap_dispatch(s0i, s0i2);
+         boost::container::swap_dispatch(s1i, s1i2);
+      }
+   }
+
+   //Default constructor
+   {
+      Scoped0Inner s0i;
+      Scoped1Inner s1i;
    }
 
    //inner_allocator()