diff --git a/include/boost/container/allocator/allocator_traits.hpp b/include/boost/container/allocator/allocator_traits.hpp new file mode 100644 index 0000000..34f526e --- /dev/null +++ b/include/boost/container/allocator/allocator_traits.hpp @@ -0,0 +1,381 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Pablo Halpern 2009. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP +#define BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include //numeric_limits<>::max() +#include //placement new +#include //std::allocator +#include + +///@cond + +namespace boost { +namespace container { +namespace container_detail { + +//workaround needed for C++03 compilers with no construct() +//supporting rvalue references +template +struct is_std_allocator +{ static const bool value = false; }; + +template +struct is_std_allocator< std::allocator > +{ static const bool value = true; }; + +} //namespace container_detail { + +///@endcond + +template +struct allocator_traits +{ + //allocator_type + typedef Alloc allocator_type; + //value_type + typedef typename Alloc::value_type value_type; + + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + //!Alloc::pointer if such a type exists; otherwise, value_type* + //! + typedef unspecified pointer; + //!Alloc::const_pointer if such a type exists ; otherwise, pointer_traits::rebind::rebind. + //! + typedef unspecified void_pointer; + //!Alloc::const_void_pointer if such a type exists ; otherwis e, pointer_traits::rebind::difference_type. + //! + typedef unspecified difference_type; + //!Alloc::size_type if such a type exists ; otherwise, make_unsigned::type + //! + typedef unspecified size_type; + //!Alloc::propagate_on_container_copy_assignment if such a type exists, otherwise an integral_constant + //!type with internal constant static member
value
== false. + typedef unspecified propagate_on_container_copy_assignment; + //!Alloc::propagate_on_container_move_assignment if such a type exists, otherwise an integral_constant + //!type with internal constant static member
value
== false. + typedef unspecified propagate_on_container_move_assignment; + //!Alloc::propagate_on_container_swap if such a type exists, otherwise an integral_constant + //!type with internal constant static member
value
== false. + typedef unspecified propagate_on_container_swap; + //!Defines an allocator: Alloc::rebind::other if such a type exists; otherwise, Alloc + //!if Alloc is a class template instantiation of the form Alloc, where Args is zero or + //!more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed. + //! + //!In C++03 compilers
rebind_alloc
is a struct derived from an allocator + //!deduced by previously detailed rules. + template using rebind_alloc = unspecified; + + //!In C++03 compilers
rebind_traits
is a struct derived from + //!
allocator_traits
, where `OtherAlloc` is
+      //!the allocator deduced by rules explained in `rebind_alloc`.
+      template  using rebind_traits = allocator_traits >;
+
+      //!Non-standard extension: Portable allocator rebind for C++03 and C++11 compilers.
+      //!`type` is an allocator related to Alloc deduced deduced by rules explained in `rebind_alloc`.
+      template 
+      struct portable_rebind_alloc
+      {  typedef unspecified_type type;  };
+   #else
+      //pointer
+      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+         pointer, value_type*)
+            pointer;
+      //const_pointer
+      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, 
+         const_pointer, typename boost::intrusive::pointer_traits::template
+            rebind_pointer::type)
+               const_pointer;
+      //reference
+      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+         reference, value_type&)
+            reference;
+      //const_reference
+      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, 
+         const_reference, const value_type&)
+               const_reference;
+      //void_pointer
+      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, 
+         void_pointer, typename boost::intrusive::pointer_traits::template
+            rebind_pointer::type)
+               void_pointer;
+      //const_void_pointer
+      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+         const_void_pointer, typename boost::intrusive::pointer_traits::template
+            rebind_pointer::type)
+               const_void_pointer;
+      //difference_type
+      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+         difference_type, std::ptrdiff_t)
+            difference_type;
+      //size_type
+      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+         size_type, std::size_t)
+            size_type;
+      //propagate_on_container_copy_assignment
+      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+         propagate_on_container_copy_assignment, boost::false_type)
+            propagate_on_container_copy_assignment;
+      //propagate_on_container_move_assignment
+      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+         propagate_on_container_move_assignment, boost::false_type)
+            propagate_on_container_move_assignment;
+      //propagate_on_container_swap
+      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+         propagate_on_container_swap, boost::false_type)
+            propagate_on_container_swap;
+
+      #if !defined(BOOST_NO_TEMPLATE_ALIASES)
+         //C++11
+         template  using rebind_alloc  = boost::intrusive::detail::type_rebinder::type;
+         template  using rebind_traits = allocator_traits< rebind_alloc >;
+      #else    //!defined(BOOST_NO_TEMPLATE_ALIASES)
+         //Some workaround for C++03 or C++11 compilers with no template aliases
+         template 
+         struct rebind_alloc : boost::intrusive::detail::type_rebinder::type
+         {
+            typedef typename boost::intrusive::detail::type_rebinder::type Base;
+            #if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+            template 
+            rebind_alloc(Args&&... args)
+               : Base(boost::forward(args)...)
+            {}
+            #else    //!defined(BOOST_NO_VARIADIC_TEMPLATES)
+            #define BOOST_PP_LOCAL_MACRO(n)                                                        \
+            BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+            rebind_alloc(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                       \
+               : Base(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))                       \
+            {}                                                                                     \
+            //
+            #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+            #include BOOST_PP_LOCAL_ITERATE()
+            #endif   //!defined(BOOST_NO_VARIADIC_TEMPLATES)
+         };
+
+         template 
+         struct rebind_traits
+            : allocator_traits::type>
+         {};
+      #endif   //!defined(BOOST_NO_TEMPLATE_ALIASES)
+      template 
+      struct portable_rebind_alloc
+      {  typedef typename boost::intrusive::detail::type_rebinder::type type;  };
+   #endif   //BOOST_CONTAINER_DOXYGEN_INVOKED
+
+   //!Returns: a.allocate(n)
+   //!
+   static pointer allocate(Alloc &a, size_type n)
+   {  return a.allocate(n);  }
+
+   //!Returns: a.deallocate(p, n)
+   //!
+   //!Throws: Nothing
+   static void deallocate(Alloc &a, pointer p, size_type n)
+   {  return a.deallocate(p, n);  }
+
+   //!Effects: calls `a.construct(p, std::forward(args)...)` if that call is well-formed;
+   //!otherwise, invokes `::new (static_cast(p)) T(std::forward(args)...)`
+   static pointer allocate(Alloc &a, size_type n, const_void_pointer p)
+   {
+      const bool value = boost::container::container_detail::
+         has_member_function_callable_with_allocate
+            ::value;
+      ::boost::integral_constant flag;
+      return allocator_traits::priv_allocate(flag, a, n, p);
+   }
+
+   //!Effects: calls a.destroy(p) if that call is well-formed;
+   //!otherwise, invokes `p->~T()`.
+   template
+   static void destroy(Alloc &a, T*p)
+   {
+      typedef T* destroy_pointer;
+      const bool value = boost::container::container_detail::
+         has_member_function_callable_with_destroy
+            ::value;
+      ::boost::integral_constant flag;
+      allocator_traits::priv_destroy(flag, a, p);
+   }
+
+   //!Returns: a.max_size() if that expression is well-formed; otherwise,
+   //!`numeric_limits::max()`.
+   static size_type max_size(const Alloc &a)
+   {
+      const bool value = boost::container::container_detail::
+         has_member_function_callable_with_max_size
+            ::value;
+      ::boost::integral_constant flag;
+      return allocator_traits::priv_max_size(flag, a);
+   }
+
+   //!Returns: a.select_on_container_copy_construction() if that expres sion is well- formed;
+   //!otherwise, a.
+   static Alloc select_on_container_copy_construction(const Alloc &a)
+   {
+      const bool value = boost::container::container_detail::
+         has_member_function_callable_with_select_on_container_copy_construction
+            ::value;
+      ::boost::integral_constant flag;
+      return allocator_traits::priv_select_on_container_copy_construction(flag, a);
+   }
+
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      //!Effects: calls a.construct(p, std::forward(args)...) if that call is well-formed; 
+      //!otherwise, invokes `::new (static_cast(p)) T(std::forward(args)...)`
+      template 
+      static void construct(Alloc & a, T* p, Args&&... args)
+      {
+         ::boost::integral_constant::value> flag;
+         allocator_traits::priv_construct(flag, a, p, ::boost::forward(args)...);
+      }
+   #endif
+
+   #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      private:
+      static pointer priv_allocate(boost::true_type, Alloc &a, size_type n, const_void_pointer p)
+      {  return a.allocate(n, p);  }
+
+      static pointer priv_allocate(boost::false_type, Alloc &a, size_type n, const_void_pointer)
+      {  return allocator_traits::allocate(a, n);  }
+
+      template
+      static void priv_destroy(boost::true_type, Alloc &a, T* p)
+      {  a.destroy(p);  }
+
+      template
+      static void priv_destroy(boost::false_type, Alloc &, T* p)
+      {  p->~T(); (void)p;  }
+
+      static size_type priv_max_size(boost::true_type, const Alloc &a)
+      {  return a.max_size();  }
+
+      static size_type priv_max_size(boost::false_type, const Alloc &)
+      {  return (std::numeric_limits::max)();  }
+
+      static Alloc priv_select_on_container_copy_construction(boost::true_type, const Alloc &a)
+      {  return a.select_on_container_copy_construction();  }
+
+      static Alloc priv_select_on_container_copy_construction(boost::false_type, const Alloc &a)
+      {  return a;  }
+
+      #if defined(BOOST_CONTAINER_PERFECT_FORWARDING)
+         template
+         static void priv_construct(boost::false_type, Alloc &a, T *p, Args && ...args)                    
+         {                                                                                                  
+            const bool value = boost::container::container_detail::
+                  has_member_function_callable_with_construct
+                     < Alloc, T*, Args... >::value;
+            ::boost::integral_constant flag;
+            priv_construct_dispatch2(flag, a, p, ::boost::forward(args)...);
+         }
+
+         template
+         static void priv_construct(boost::true_type, Alloc &a, T *p, Args && ...args)
+         {
+            priv_construct_dispatch2(boost::false_type(), a, p, ::boost::forward(args)...);
+         }
+
+         template
+         static void priv_construct_dispatch2(boost::true_type, Alloc &a, T *p, Args && ...args)
+         {  a.construct( p, ::boost::forward(args)...);  }
+
+         template
+         static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p, Args && ...args)
+         {  ::new((void*)p) T(::boost::forward(args)...); }
+      #else
+         public:
+         #define BOOST_PP_LOCAL_MACRO(n)                                                              \
+         template                                 \
+         static void construct(Alloc &a, T *p                                                         \
+                              BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))            \
+         {                                                                                            \
+            ::boost::integral_constant::value> flag;  \
+            allocator_traits::priv_construct(flag, a, p                                               \
+               BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));                       \
+         }                                                                                            \
+         //
+         #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+         #include BOOST_PP_LOCAL_ITERATE()
+      
+         private:
+         #define BOOST_PP_LOCAL_MACRO(n)                                                                    \
+         template                                      \
+         static void priv_construct(boost::false_type, Alloc &a, T *p                                       \
+                        BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST,_))                         \
+         {                                                                                                  \
+            const bool value =                                                                              \
+               boost::container::container_detail::has_member_function_callable_with_construct              \
+                     < Alloc, T* BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_FWD_TYPE, _) >::value;        \
+            ::boost::integral_constant flag;                                                   \
+            priv_construct_dispatch2(flag, a, p                                                             \
+               BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );                            \
+         }                                                                                                  \
+                                                                                                            \
+         template                                      \
+         static void priv_construct(boost::true_type, Alloc &a, T *p                                        \
+                        BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST,_))                         \
+         {                                                                                                  \
+            priv_construct_dispatch2(boost::false_type(), a, p                                              \
+               BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );                            \
+         }                                                                                                  \
+                                                                                                            \
+         template                                      \
+         static void priv_construct_dispatch2(boost::true_type, Alloc &a, T *p                              \
+                        BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST,_))                         \
+         {  a.construct( p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );  }             \
+                                                                                                            \
+         template                                      \
+         static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p                              \
+                        BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _) )                       \
+         {  ::new((void*)p) T(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); }                     \
+         //
+         #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+         #include BOOST_PP_LOCAL_ITERATE()
+      #endif   //BOOST_CONTAINER_PERFECT_FORWARDING
+   #endif   //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+   ///@endcond
+};
+
+}  //namespace container {
+}  //namespace boost {
+
+#include 
+
+#endif // ! defined(BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP)
diff --git a/include/boost/container/allocator/memory_util.hpp b/include/boost/container/allocator/memory_util.hpp
new file mode 100644
index 0000000..f9cc70a
--- /dev/null
+++ b/include/boost/container/allocator/memory_util.hpp
@@ -0,0 +1,77 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/container for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP
+#define BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+#  pragma once
+#endif
+
+#include 
+#include 
+#include 
+#include 
+
+
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME allocate
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail {
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END   }}}
+#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 2, ))
+#include BOOST_PP_ITERATE()
+
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME destroy
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail {
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END   }}}
+#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 3, ))
+#include BOOST_PP_ITERATE()
+
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME max_size
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail {
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END   }}}
+#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 0, ))
+#include BOOST_PP_ITERATE()
+
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME select_on_container_copy_construction
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail {
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END   }}}
+#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 0, ))
+#include BOOST_PP_ITERATE()
+
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME construct
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail {
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END   }}}
+#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS+1, ))
+#include BOOST_PP_ITERATE()
+
+namespace boost {
+namespace container {
+namespace container_detail {
+
+
+BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(pointer);
+BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_pointer);
+BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(reference);
+BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_reference);
+BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(void_pointer);
+BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_void_pointer);
+BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(size_type);
+BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_copy_assignment);
+BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_move_assignment);
+BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_swap);
+BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type);
+
+}  //namespace container_detail {
+}  //namespace container {
+}  //namespace boost {
+
+#include 
+
+#endif // ! defined(BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP)
diff --git a/include/boost/container/allocator/scoped_allocator.hpp b/include/boost/container/allocator/scoped_allocator.hpp
new file mode 100644
index 0000000..03e12d1
--- /dev/null
+++ b/include/boost/container/allocator/scoped_allocator.hpp
@@ -0,0 +1,651 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Pablo Halpern 2009. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/container for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP
+#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+#  pragma once
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace boost { namespace container {
+
+template 
+class scoped_allocator_adaptor;
+
+template 
+scoped_allocator_adaptor make_scoped();
+
+template 
+class scoped_allocator_adaptor_base : public OuterAlloc
+{
+    typedef allocator_traits OuterTraits;
+
+public:
+    // Workaround for inability of gcc-4.4.1 to expand InnerAllocs...
+//    typedef scoped_allocator_adaptor inner_allocator_type;
+    typedef decltype(make_scoped()) inner_allocator_type;
+
+    scoped_allocator_adaptor_base();
+
+    template 
+      scoped_allocator_adaptor_base(OuterA2&& outerAlloc, const InnerAllocs&... innerAllocs);
+
+    template 
+      scoped_allocator_adaptor_base(const scoped_allocator_adaptor& other);
+    template 
+      scoped_allocator_adaptor_base(scoped_allocator_adaptor&& other);
+    
+    inner_allocator_type&       inner_allocator()
+        { return _M_inner_allocs; }
+    inner_allocator_type const& inner_allocator() const
+        { return _M_inner_allocs; }
+
+    // Allocator propagation functions.
+    scoped_allocator_adaptor
+    select_on_container_copy_construction() const;
+
+    typedef std::integral_constant<
+        bool,
+        OuterTraits::propagate_on_container_copy_assignment::value ||
+        inner_allocator_type::propagate_on_container_copy_assignment::value
+        > propagate_on_container_copy_assignment;
+    typedef std::integral_constant<
+        bool,
+        OuterTraits::propagate_on_container_move_assignment::value ||
+        inner_allocator_type::propagate_on_container_move_assignment::value
+        > propagate_on_container_move_assignment;
+    typedef std::integral_constant<
+        bool,
+        OuterTraits::propagate_on_container_swap::value ||
+        inner_allocator_type::propagate_on_container_swap::value
+        > propagate_on_container_swap;
+
+private:
+    inner_allocator_type _M_inner_allocs;
+};
+
+// Specialization with only one parameter.
+template 
+class scoped_allocator_adaptor_base : public OuterAlloc
+{
+    typedef allocator_traits OuterTraits;
+public:
+    typedef scoped_allocator_adaptor inner_allocator_type;
+
+    scoped_allocator_adaptor_base();
+
+    template 
+      scoped_allocator_adaptor_base(OuterA2&& outerAlloc);
+
+    template 
+      scoped_allocator_adaptor_base(const scoped_allocator_adaptor& other);
+    template 
+      scoped_allocator_adaptor_base(scoped_allocator_adaptor&& other);
+    
+    inner_allocator_type&       inner_allocator()
+        { return static_cast(*this); }
+
+    inner_allocator_type const& inner_allocator() const
+        { return static_cast(*this); }
+
+    // Allocator propagation functions.
+    scoped_allocator_adaptor
+      select_on_container_copy_construction() const;
+
+    typedef typename OuterTraits::propagate_on_container_copy_assignment propagate_on_container_copy_assignment;
+    typedef typename OuterTraits::propagate_on_container_move_assignment propagate_on_container_move_assignment;
+    typedef typename OuterTraits::propagate_on_container_swap propagate_on_container_swap;
+};
+
+template 
+class scoped_allocator_adaptor
+    : public scoped_allocator_adaptor_base
+{
+    typedef scoped_allocator_adaptor_base _Base;
+    typedef allocator_traits                              _Traits;
+
+public:
+    typedef OuterAlloc                           outer_allocator_type;
+    typedef typename _Base::inner_allocator_type inner_allocator_type;
+    
+    typedef typename allocator_traits::size_type          size_type;
+    typedef typename allocator_traits::difference_type    difference_type;
+    typedef typename allocator_traits::pointer            pointer;
+    typedef typename allocator_traits::const_pointer      const_pointer;
+    typedef typename allocator_traits::void_pointer       void_pointer;
+    typedef typename allocator_traits::const_void_pointer const_void_pointer;
+    typedef typename allocator_traits::value_type          value_type;
+
+    template 
+    struct rebind {
+        typedef typename allocator_traits::template rebind_traits rebound_traits;
+        typedef typename rebound_traits::allocator_type rebound_outer; // exposition only
+        typedef scoped_allocator_adaptor other;
+    };
+
+    scoped_allocator_adaptor();
+    scoped_allocator_adaptor(const scoped_allocator_adaptor& other);
+
+    template 
+      scoped_allocator_adaptor(const scoped_allocator_adaptor& other);
+    template 
+      scoped_allocator_adaptor(scoped_allocator_adaptor&& other);
+    
+    template 
+      scoped_allocator_adaptor(OuterA2&& outerAlloc, const InnerAllocs&... innerAllocs);
+
+    ~scoped_allocator_adaptor();
+
+    inner_allocator_type      & inner_allocator()
+        { return _Base::inner_allocator(); }
+    inner_allocator_type const& inner_allocator() const
+        { return _Base::inner_allocator(); }
+    outer_allocator_type      & outer_allocator()
+        { return *this; }
+    outer_allocator_type const& outer_allocator() const
+        { return *this; }
+
+    pointer allocate(size_type n);
+    pointer allocate(size_type n, const_void_pointer hint);
+    void deallocate(pointer p, size_type n);
+    size_type max_size() const;
+
+    template 
+      void construct(T* p, Args&&... args);
+
+    // Specializations to pass inner_allocator to pair::first and pair::second
+    template 
+      void construct(std::pair* p);
+    template 
+      void construct(std::pair* p, U&& x, V&& y);
+    template 
+      void construct(std::pair* p, const std::pair& pr);
+    template 
+      void construct(std::pair* p, std::pair&& pr);
+
+    template 
+      void destroy(T* p);
+};
+
+template 
+inline
+bool operator==(const scoped_allocator_adaptor& a,
+                const scoped_allocator_adaptor& b);
+
+template 
+inline
+bool operator!=(const scoped_allocator_adaptor& a,
+                const scoped_allocator_adaptor& b);
+
+///////////////////////////////////////////////////////////////////////////////
+// Implementation of scoped_allocator_adaptor_base
+///////////////////////////////////////////////////////////////////////////////
+
+template 
+inline
+scoped_allocator_adaptor_base::
+    scoped_allocator_adaptor_base()
+{
+}
+
+template 
+  template 
+    scoped_allocator_adaptor_base::
+      scoped_allocator_adaptor_base(OuterA2&&        outerAlloc,
+                                    const InnerAllocs&... innerAllocs)
+          : OuterAlloc(std::forward(outerAlloc))
+          , _M_inner_allocs(innerAllocs...)
+{
+}
+
+template 
+  template 
+    scoped_allocator_adaptor_base::
+      scoped_allocator_adaptor_base(
+          const scoped_allocator_adaptor& other)
+          : OuterAlloc(other.outer_allocator())
+          , _M_inner_allocs(other.inner_allocator())
+{
+}
+
+template 
+  template 
+    scoped_allocator_adaptor_base::
+      scoped_allocator_adaptor_base(
+          scoped_allocator_adaptor&& other)
+          : OuterAlloc(std::move(other.outer_allocator()))
+          , _M_inner_allocs(std::move(other.inner_allocator()))
+{
+}
+
+template 
+inline
+scoped_allocator_adaptor
+scoped_allocator_adaptor_base::
+  select_on_container_copy_construction() const
+{
+    return scoped_allocator_adaptor(
+        allocator_traits::select_on_container_copy_construction(
+            this->outer_allocator()),
+        allocator_traits::select_on_container_copy_construction(
+            this->inner_allocator()));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Implementation of scoped_allocator_adaptor_base specialization
+///////////////////////////////////////////////////////////////////////////////
+
+template 
+inline
+scoped_allocator_adaptor_base::
+    scoped_allocator_adaptor_base()
+{
+}
+
+template 
+  template 
+    scoped_allocator_adaptor_base::
+     scoped_allocator_adaptor_base(OuterA2&& outerAlloc)
+         : OuterAlloc(std::forward(outerAlloc))
+{
+}
+
+template 
+  template 
+    scoped_allocator_adaptor_base::
+      scoped_allocator_adaptor_base(
+          const scoped_allocator_adaptor& other)
+          : OuterAlloc(other.outer_allocator())
+{
+}
+
+template 
+  template 
+    scoped_allocator_adaptor_base::
+      scoped_allocator_adaptor_base(
+          scoped_allocator_adaptor&& other)
+          : OuterAlloc(std::move(other.outer_allocator()))
+{
+}
+
+// template 
+// inline
+// scoped_allocator_adaptor& 
+// scoped_allocator_adaptor_base::inner_allocator()
+// {
+//     return *this;
+// }
+
+// template 
+// inline
+// scoped_allocator_adaptor const& 
+// scoped_allocator_adaptor_base::inner_allocator() cosnt
+// {
+//     return *this;
+// }
+
+template 
+inline
+scoped_allocator_adaptor
+scoped_allocator_adaptor_base::
+select_on_container_copy_construction() const
+{
+    return
+        allocator_traits::select_on_container_copy_construction(
+            this->outer_allocator());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Implementation of scoped_allocator_adaptor details
+///////////////////////////////////////////////////////////////////////////////
+
+namespace __details {
+
+    // Overload resolution for __has_ctor resolves to this function
+    // when _Tp is constructible with _Args.  Returns true_type().
+    
+    static void* __void_p; // Declared but not defined
+
+    template 
+    inline
+    auto __has_ctor(int, _Args&&... __args) ->
+        decltype((new (__void_p) _Tp(__args...), std::true_type()))
+        { return std::true_type(); }
+
+    // Overload resolution for __has_ctor resolves to this function
+    // when _Tp is not constructible with _Args. Returns false_type().
+    template 
+    auto __has_ctor(_LowPriorityConversion, _Args&&...) ->
+        std::false_type
+        { return std::false_type(); }
+
+    template 
+    struct __is_scoped_allocator_imp {
+        template 
+        static char test(int, typename T::outer_allocator_type*);
+        template 
+        static int test(_LowPriorityConversion, void*);
+        static const bool value = (1 == sizeof(test<_Alloc>(0, 0)));
+    };
+
+    template 
+    struct __is_scoped_allocator
+        : std::integral_constant::value>
+    {
+    };
+
+#if 0
+    // Called when outer_allocator_type is not a scoped allocator
+    // (recursion stop).
+    template 
+    inline
+    auto __outermost_alloc(_LowPriorityConversion, _Alloc& __a) ->
+        _Alloc&
+    {
+        return __a;
+    }
+
+    // Called when outer_allocator_type is a scoped allocator to
+    // return the outermost allocator type.
+    template 
+    inline auto __outermost_alloc(int, _Alloc& __a) ->
+        decltype(__outermost_alloc(0,__a.outer_allocator())) 
+    {
+        return __a.outer_allocator();
+    }
+#endif
+
+    template 
+    inline void __dispatch_scoped_construct(std::false_type __uses_alloc,
+                                            _Ignore         __use_alloc_prefix,
+                                            _OuterAlloc&    __outer_alloc,
+                                            _InnerAlloc&    __inner_alloc,
+                                            _Tp* __p, _Args&&... __args)
+    {
+        // _Tp doesn't use allocators.  Construct without an
+        // allocator argument.
+        allocator_traits<_OuterAlloc>::construct(__outer_alloc, __p,
+                                               std::forward<_Args>(__args)...);
+    }
+
+    template 
+    inline void __dispatch_scoped_construct(std::true_type  __uses_alloc,
+                                            std::true_type  __use_alloc_prefix,
+                                            _OuterAlloc&    __outer_alloc,
+                                            _InnerAlloc&    __inner_alloc,
+                                            _Tp* __p, _Args&&... __args)
+    {
+        // _Tp doesn't use allocators.  Construct without an
+        // allocator argument.
+        allocator_traits<_OuterAlloc>::construct(__outer_alloc, __p,
+                                                 allocator_arg, __inner_alloc,
+                                               std::forward<_Args>(__args)...);
+    }
+
+    template 
+    inline void __dispatch_scoped_construct(std::true_type  __uses_alloc,
+                                            std::false_type __use_alloc_prefix,
+                                            _OuterAlloc&    __outer_alloc,
+                                            _InnerAlloc&    __inner_alloc,
+                                            _Tp* __p, _Args&&... __args)
+    {
+        // If _Tp uses an allocator compatible with _InnerAlloc,
+        // but the specific constructor does not have a variant that
+        // takes an allocator argument, then program is malformed.
+//         static_assert(has_constructor<_Tp, _Args...>::value,
+//                       "Cannot pass inner allocator to this constructor");
+
+        allocator_traits<_OuterAlloc>::construct(
+            __outer_alloc, __p, std::forward<_Args>(__args)...,
+            __inner_alloc);
+    }
+
+    template 
+    inline void __do_scoped_construct(std::false_type __scoped_outer,
+                                      _OuterAlloc&    __outer_alloc,
+                                      _InnerAlloc&    __inner_alloc,
+                                      _Tp* __p, _Args&&... __args)
+    {
+        // Dispatch construction to the correct __dispatch_scoped_construct()
+        // function based on whether _Tp uses an allocator of type
+        // _InnerAlloc and, if so, whether there exists the following
+        // constructor:
+        //   _Tp(allocator_arg_t, _InnerAlloc, Args...).
+        auto __uses_alloc = uses_allocator<_Tp, _InnerAlloc>();
+        auto __use_alloc_prefix = __has_ctor<_Tp>(0, allocator_arg,
+                                               __inner_alloc,
+                                               std::forward<_Args>(__args)...);
+        __dispatch_scoped_construct(__uses_alloc, __use_alloc_prefix,
+                                    __outer_alloc,
+                                    __inner_alloc,
+                                    __p, std::forward<_Args>(__args)...);
+    }
+
+    template 
+    void __do_scoped_construct(std::true_type  __scoped_outer,
+                               _OuterAlloc&    __outer_alloc,
+                               _InnerAlloc&    __inner_alloc,
+                               _Tp* __p, _Args&&... __args)
+    {
+        // Use outermost allocator if __outer_alloc is scoped
+        typedef typename _OuterAlloc::outer_allocator_type outerouter;
+        __do_scoped_construct(__is_scoped_allocator(),
+                              __outer_alloc.outer_allocator(),
+                              __inner_alloc,
+                              __p, std::forward<_Args>(__args)...);
+    }
+
+} // end namespace __details
+
+///////////////////////////////////////////////////////////////////////////////
+// Implementation of scoped_allocator_adaptor
+///////////////////////////////////////////////////////////////////////////////
+
+template 
+scoped_allocator_adaptor::
+    scoped_allocator_adaptor()
+{
+}
+
+template 
+scoped_allocator_adaptor::
+    scoped_allocator_adaptor(const scoped_allocator_adaptor& other)
+        : _Base(other)
+{
+}
+
+template 
+  template 
+    scoped_allocator_adaptor::
+      scoped_allocator_adaptor(const scoped_allocator_adaptor& other)
+        : _Base(other)
+{
+}
+
+template 
+  template 
+    scoped_allocator_adaptor::
+      scoped_allocator_adaptor(scoped_allocator_adaptor&& other)
+          : _Base(std::move(other))
+{
+}
+    
+template 
+  template 
+    scoped_allocator_adaptor::
+      scoped_allocator_adaptor(OuterA2&& outerAlloc, const InnerAllocs&... innerAllocs)
+          : _Base(std::forward(outerAlloc), innerAllocs...)
+{
+}
+
+template 
+scoped_allocator_adaptor::
+    ~scoped_allocator_adaptor()
+{
+}
+
+template 
+inline typename allocator_traits::pointer
+scoped_allocator_adaptor::
+    allocate(size_type n)
+{
+    return allocator_traits::allocate(outer_allocator(), n);
+}
+
+template 
+inline typename allocator_traits::pointer
+scoped_allocator_adaptor::
+    allocate(size_type n, const_void_pointer hint)
+{
+    return allocator_traits::allocate(outer_allocator(), n, hint);
+}
+
+template 
+inline void scoped_allocator_adaptor::
+    deallocate(pointer p, size_type n)
+{
+    allocator_traits::deallocate(outer_allocator(), p, n);
+}
+
+template 
+inline typename allocator_traits::size_type
+scoped_allocator_adaptor::max_size() const
+{
+    return allocator_traits::max_size(outer_allocator());
+}
+
+template 
+  template 
+    inline void scoped_allocator_adaptor::
+    destroy(T* p)
+{
+    allocator_traits::destroy(outer_allocator(), p);
+}
+
+template 
+  template 
+    inline
+    void scoped_allocator_adaptor::construct(T* p,
+                                                             Args&&... args)
+{
+    __do_scoped_construct(__details::__is_scoped_allocator(),
+                          this->outer_allocator(), this->inner_allocator(),
+                          p, std::forward(args)...);
+}
+
+template 
+  template 
+  void scoped_allocator_adaptor::construct(
+      std::pair* p)
+{
+    construct(addressof(p->first));
+    try {
+        construct(addressof(p->second));
+    }
+    catch (...) {
+        destroy(addressof(p->first));
+        throw;
+    }
+}
+
+template 
+  template 
+  void scoped_allocator_adaptor::construct(
+      std::pair* p, U&& x, V&& y)
+{
+    construct(addressof(p->first), std::forward(x));
+    try {
+        construct(addressof(p->second), std::forward(y));
+    }
+    catch (...) {
+        destroy(addressof(p->first));
+        throw;
+    }
+}
+
+template 
+  template 
+  void scoped_allocator_adaptor::construct(
+      std::pair* p, const std::pair& pr)
+{
+    construct(addressof(p->first), pr.first);
+    try {
+        construct(addressof(p->second), pr.second);
+    }
+    catch (...) {
+        destroy(addressof(p->first));
+        throw;
+    }
+}
+
+template 
+  template 
+  void scoped_allocator_adaptor::construct(
+      std::pair* p, std::pair&& pr)
+{
+    construct(addressof(p->first), std::move(pr.first));
+    try {
+        construct(addressof(p->second), std::move(pr.second));
+    }
+    catch (...) {
+        destroy(addressof(p->first));
+        throw;
+    }
+}
+
+template 
+inline
+bool operator==(const scoped_allocator_adaptor& a,
+                const scoped_allocator_adaptor& b)
+{
+    return a.outer_allocator() == b.outer_allocator()
+        && a.inner_allocator() == b.inner_allocator();
+}
+
+template 
+inline
+bool operator==(const scoped_allocator_adaptor& a,
+                const scoped_allocator_adaptor& b)
+{
+    return a.outer_allocator() == b.outer_allocator();
+}
+
+template 
+inline
+bool operator!=(const scoped_allocator_adaptor& a,
+                const scoped_allocator_adaptor& b)
+{
+    return ! (a == b);
+}
+
+}} // namespace boost { namespace container {
+
+#include 
+
+#endif //  BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP
diff --git a/include/boost/container/container_fwd.hpp b/include/boost/container/container_fwd.hpp
index f304382..b58ca8e 100644
--- a/include/boost/container/container_fwd.hpp
+++ b/include/boost/container/container_fwd.hpp
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_CONTAINERS_FWD_HPP
-#define BOOST_CONTAINERS_CONTAINERS_FWD_HPP
+#ifndef BOOST_CONTAINER_CONTAINER_FWD_HPP
+#define BOOST_CONTAINER_CONTAINER_FWD_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -26,7 +26,7 @@ namespace intrusive{
    //Create namespace to avoid compilation errors
 }}
 
-namespace boost{ namespace container{ namespace containers_detail{
+namespace boost{ namespace container{ namespace container_detail{
 
 namespace bi = boost::intrusive;
 
@@ -195,4 +195,4 @@ struct dummy
 
 }}  //namespace boost { namespace container {
 
-#endif //#ifndef BOOST_CONTAINERS_CONTAINERS_FWD_HPP
+#endif //#ifndef BOOST_CONTAINER_CONTAINER_FWD_HPP
diff --git a/include/boost/container/deque.hpp b/include/boost/container/deque.hpp
index b890057..d77398b 100644
--- a/include/boost/container/deque.hpp
+++ b/include/boost/container/deque.hpp
@@ -30,8 +30,8 @@
 // representations about the suitability of this software for any
 // purpose.  It is provided "as is" without express or implied warranty.
 
-#ifndef BOOST_CONTAINERS_DEQUE_HPP
-#define BOOST_CONTAINERS_DEQUE_HPP
+#ifndef BOOST_CONTAINER_DEQUE_HPP
+#define BOOST_CONTAINER_DEQUE_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -44,6 +44,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -83,8 +84,8 @@ struct deque_value_traits
    static const bool trivial_copy = has_trivial_copy::value;
    static const bool nothrow_copy = has_nothrow_copy::value;
    static const bool trivial_assign = has_trivial_assign::value;
-   static const bool nothrow_assign = has_nothrow_assign::value;
-
+   //static const bool nothrow_assign = has_nothrow_assign::value;
+   static const bool nothrow_assign = false;
 };
 
 // Note: this function is simply a kludge to work around several compilers'
@@ -98,31 +99,32 @@ inline std::size_t deque_buf_size(std::size_t size)
 template 
 class deque_base
 {
+   BOOST_COPYABLE_AND_MOVABLE(deque_base)
    public:
-   typedef typename     A::value_type              val_alloc_val;
-   typedef typename     A::pointer                 val_alloc_ptr;
-   typedef typename     A::const_pointer           val_alloc_cptr;
-   typedef typename     A::reference               val_alloc_ref;
-   typedef typename     A::const_reference         val_alloc_cref;
-   typedef typename     A::difference_type         val_alloc_diff;
-   typedef typename     A::size_type               val_alloc_size;
-   typedef typename     A::template rebind
-      ::other             ptr_alloc_t;
-   typedef typename ptr_alloc_t::value_type        ptr_alloc_val;
-   typedef typename ptr_alloc_t::pointer           ptr_alloc_ptr;
-   typedef typename ptr_alloc_t::const_pointer     ptr_alloc_cptr;
-   typedef typename ptr_alloc_t::reference         ptr_alloc_ref;
-   typedef typename ptr_alloc_t::const_reference   ptr_alloc_cref;
-   typedef typename     A::template
-      rebind::other                             allocator_type;
-   typedef allocator_type                          stored_allocator_type;
-   typedef val_alloc_size                          size_type;
+   typedef allocator_traits                                     val_alloc_traits_type;
+   typedef typename val_alloc_traits_type::value_type              val_alloc_val;
+   typedef typename val_alloc_traits_type::pointer                 val_alloc_ptr;
+   typedef typename val_alloc_traits_type::const_pointer           val_alloc_cptr;
+   typedef typename val_alloc_traits_type::reference               val_alloc_ref;
+   typedef typename val_alloc_traits_type::const_reference         val_alloc_cref;
+   typedef typename val_alloc_traits_type::difference_type         val_alloc_diff;
+   typedef typename val_alloc_traits_type::size_type               val_alloc_size;
+   typedef typename val_alloc_traits_type::template
+      portable_rebind_alloc::type                   ptr_alloc_t;
+   typedef allocator_traits                           ptr_alloc_traits_type;
+   typedef typename ptr_alloc_traits_type::value_type             ptr_alloc_val;
+   typedef typename ptr_alloc_traits_type::pointer                ptr_alloc_ptr;
+   typedef typename ptr_alloc_traits_type::const_pointer          ptr_alloc_cptr;
+   typedef typename ptr_alloc_traits_type::reference              ptr_alloc_ref;
+   typedef typename ptr_alloc_traits_type::const_reference        ptr_alloc_cref;
+   typedef A                                                      allocator_type;
+   typedef allocator_type                                         stored_allocator_type;
+   typedef val_alloc_size                                         size_type;
 
    protected:
 
-   typedef deque_value_traits            traits_t;
-   typedef typename     A::template
-      rebind::other map_allocator_type;
+   typedef deque_value_traits             traits_t;
+   typedef ptr_alloc_t                          map_allocator_type;
 
    static size_type s_buffer_size() { return deque_buf_size(sizeof(T)); }
 
@@ -373,7 +375,7 @@ class deque_base
          {  return static_cast(*this) - right;   }
    };
 
-   deque_base(const allocator_type& a, size_type num_elements)
+   deque_base(size_type num_elements, const allocator_type& a)
       :  members_(a)
    { this->priv_initialize_map(num_elements); }
 
@@ -381,6 +383,15 @@ class deque_base
       :  members_(a)
    {}
 
+   deque_base()
+      :  members_()
+   {}
+
+   explicit deque_base(BOOST_RV_REF(deque_base) x)
+      :  members_( boost::move(x.ptr_alloc())
+                 , boost::move(x.alloc()) )
+   {}
+
    ~deque_base()
    {
       if (this->members_.m_map) {
@@ -394,12 +405,20 @@ class deque_base
   
    protected:
 
+   void swap_members(deque_base &x)
+   {
+      std::swap(this->members_.m_start, x.members_.m_start);
+      std::swap(this->members_.m_finish, x.members_.m_finish);
+      std::swap(this->members_.m_map, x.members_.m_map);
+      std::swap(this->members_.m_map_size, x.members_.m_map_size);
+   }
+
    void priv_initialize_map(size_type num_elements)
    {
 //      if(num_elements){
          size_type num_nodes = num_elements / s_buffer_size() + 1;
 
-         this->members_.m_map_size = containers_detail::max_value((size_type) InitialMapSize, num_nodes + 2);
+         this->members_.m_map_size = container_detail::max_value((size_type) InitialMapSize, num_nodes + 2);
          this->members_.m_map = this->priv_allocate_map(this->members_.m_map_size);
 
          ptr_alloc_ptr nstart = this->members_.m_map + (this->members_.m_map_size - num_nodes) / 2;
@@ -463,14 +482,28 @@ class deque_base
       :  public ptr_alloc_t
       ,  public allocator_type
    {
-      members_holder(const allocator_type &a)
+      members_holder()
+         :  map_allocator_type(), allocator_type()
+         ,  m_map(0), m_map_size(0)
+         ,  m_start(), m_finish(m_start)
+      {}
+
+      explicit members_holder(const allocator_type &a)
          :  map_allocator_type(a), allocator_type(a)
          ,  m_map(0), m_map_size(0)
          ,  m_start(), m_finish(m_start)
       {}
 
+      template
+      members_holder(BOOST_FWD_REF(PtrAllocConvertible) pa, BOOST_FWD_REF(ValAllocConvertible) va)
+         : map_allocator_type(boost::forward(pa))
+         , allocator_type    (boost::forward(va))
+         , m_map(0), m_map_size(0)
+         , m_start(), m_finish(m_start)
+      {}
+
       ptr_alloc_ptr   m_map;
-     typename allocator_type::size_type  m_map_size;
+      val_alloc_size  m_map_size;
       iterator        m_start;
       iterator        m_finish;
    } members_;
@@ -499,26 +532,25 @@ template 
 class deque : protected deque_base
 {
    /// @cond
-  typedef deque_base Base;
+   private:
+   typedef deque_base Base;
+   typedef typename Base::val_alloc_val            val_alloc_val;
+   typedef typename Base::val_alloc_ptr            val_alloc_ptr;
+   typedef typename Base::val_alloc_cptr           val_alloc_cptr;
+   typedef typename Base::val_alloc_ref            val_alloc_ref;
+   typedef typename Base::val_alloc_cref           val_alloc_cref;
+   typedef typename Base::val_alloc_size           val_alloc_size;
+   typedef typename Base::val_alloc_diff           val_alloc_diff;
 
-   public:                         // Basic types
-   typedef typename     A::value_type           val_alloc_val;
-   typedef typename     A::pointer              val_alloc_ptr;
-   typedef typename     A::const_pointer        val_alloc_cptr;
-   typedef typename     A::reference            val_alloc_ref;
-   typedef typename     A::const_reference      val_alloc_cref;
-   typedef typename     A::size_type            val_alloc_size;
-   typedef typename     A::difference_type      val_alloc_diff;
-
-   typedef typename     A::template
-      rebind::other                ptr_alloc_t;
-   typedef typename ptr_alloc_t::value_type       ptr_alloc_val;
-   typedef typename ptr_alloc_t::pointer          ptr_alloc_ptr;
-   typedef typename ptr_alloc_t::const_pointer    ptr_alloc_cptr;
-   typedef typename ptr_alloc_t::reference        ptr_alloc_ref;
-   typedef typename ptr_alloc_t::const_reference  ptr_alloc_cref;
+   typedef typename Base::ptr_alloc_t              ptr_alloc_t;
+   typedef typename Base::ptr_alloc_val            ptr_alloc_val;
+   typedef typename Base::ptr_alloc_ptr            ptr_alloc_ptr;
+   typedef typename Base::ptr_alloc_cptr           ptr_alloc_cptr;
+   typedef typename Base::ptr_alloc_ref            ptr_alloc_ref;
+   typedef typename Base::ptr_alloc_cref           ptr_alloc_cref;
    /// @endcond
 
+   public:                         // Basic types
    typedef T                                    value_type;
    typedef val_alloc_ptr                        pointer;
    typedef val_alloc_cptr                       const_pointer;
@@ -535,6 +567,8 @@ class deque : protected deque_base
    typedef std::reverse_iterator const_reverse_iterator;
    typedef std::reverse_iterator      reverse_iterator;
 
+   typedef allocator_type                       stored_allocator_type;
+
    /// @cond
 
    private:                      // Internal typedefs
@@ -542,27 +576,49 @@ class deque : protected deque_base
    typedef ptr_alloc_ptr index_pointer;
    static size_type s_buffer_size() 
       { return Base::s_buffer_size(); }
-   typedef containers_detail::advanced_insert_aux_int advanced_insert_aux_int_t;
+   typedef container_detail::advanced_insert_aux_int advanced_insert_aux_int_t;
    typedef repeat_iterator  r_iterator;
-   typedef boost::move_iterator    move_it;
+   typedef boost::move_iterator     move_it;
+   typedef allocator_traits                  allocator_traits_type;
 
    /// @endcond
 
+   public:
+
    //! Effects: Returns a copy of the internal allocator.
    //! 
    //! Throws: If allocator's copy constructor throws.
    //! 
    //! Complexity: Constant.
-   allocator_type get_allocator() const { return Base::alloc(); }
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
+   { return Base::alloc(); }
 
-   public:                         // Basic accessors
+   //! Effects: Returns a reference to the internal allocator.
+   //! 
+   //! Throws: Nothing
+   //! 
+   //! Complexity: Constant.
+   //! 
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+   {  return Base::alloc(); }
+
+   //! Effects: Returns a reference to the internal allocator.
+   //! 
+   //! Throws: Nothing
+   //! 
+   //! Complexity: Constant.
+   //! 
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
+   {  return Base::alloc(); }
 
    //! Effects: Returns an iterator to the first element contained in the deque.
    //! 
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   iterator begin() 
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_start; }
 
    //! Effects: Returns an iterator to the end of the deque.
@@ -570,7 +626,7 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   iterator end() 
+   iterator end() BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_finish; }
 
    //! Effects: Returns a const_iterator to the first element contained in the deque.
@@ -578,7 +634,7 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_iterator begin() const 
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_start; }
 
    //! Effects: Returns a const_iterator to the end of the deque.
@@ -586,7 +642,7 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_iterator end() const 
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_finish; }
 
    //! Effects: Returns a reverse_iterator pointing to the beginning 
@@ -595,7 +651,7 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   reverse_iterator rbegin() 
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
       { return reverse_iterator(this->members_.m_finish); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
@@ -604,7 +660,7 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   reverse_iterator rend() 
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
       { return reverse_iterator(this->members_.m_start); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the beginning 
@@ -613,7 +669,7 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
       { return const_reverse_iterator(this->members_.m_finish); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
@@ -622,7 +678,7 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_reverse_iterator rend() const 
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
       { return const_reverse_iterator(this->members_.m_start); }
 
    //! Effects: Returns a const_iterator to the first element contained in the deque.
@@ -630,7 +686,7 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_iterator cbegin() const 
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_start; }
 
    //! Effects: Returns a const_iterator to the end of the deque.
@@ -638,7 +694,7 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_iterator cend() const 
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_finish; }
 
    //! Effects: Returns a const_reverse_iterator pointing to the beginning 
@@ -647,7 +703,7 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_reverse_iterator crbegin() const 
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
       { return const_reverse_iterator(this->members_.m_finish); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
@@ -656,7 +712,7 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_reverse_iterator crend() const 
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
       { return const_reverse_iterator(this->members_.m_start); }
 
    //! Requires: size() < n.
@@ -667,7 +723,7 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   reference operator[](size_type n)
+   reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_start[difference_type(n)]; }
 
    //! Requires: size() < n.
@@ -678,7 +734,7 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_reference operator[](size_type n) const 
+   const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_start[difference_type(n)]; }
 
    //! Requires: size() < n.
@@ -711,7 +767,8 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   reference front() { return *this->members_.m_start; }
+   reference front() BOOST_CONTAINER_NOEXCEPT
+      { return *this->members_.m_start; }
 
    //! Requires: !empty()
    //!
@@ -721,7 +778,7 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_reference front() const 
+   const_reference front() const BOOST_CONTAINER_NOEXCEPT
       { return *this->members_.m_start; }
 
    //! Requires: !empty()
@@ -732,7 +789,8 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   reference back()  {  return *(end()-1); }
+   reference back() BOOST_CONTAINER_NOEXCEPT
+      {  return *(end()-1); }
 
    //! Requires: !empty()
    //!
@@ -742,14 +800,15 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_reference back() const  {  return *(cend()-1);  }
+   const_reference back() const BOOST_CONTAINER_NOEXCEPT
+      {  return *(cend()-1);  }
 
    //! Effects: Returns the number of the elements contained in the deque.
    //! 
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_finish - this->members_.m_start; }
 
    //! Effects: Returns the largest possible size of the deque.
@@ -757,23 +816,32 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   size_type max_size() const 
-      { return this->alloc().max_size(); }
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
+      { return allocator_traits_type::max_size(this->alloc()); }
 
    //! Effects: Returns true if the deque contains no elements.
    //! 
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
    { return this->members_.m_finish == this->members_.m_start; }
 
+   //! Effects: Default constructors a deque.
+   //! 
+   //! Throws: If allocator_type's default constructor throws.
+   //! 
+   //! Complexity: Constant.
+   deque() 
+      : Base()
+   {}
+
    //! Effects: Constructs a deque taking the allocator as parameter.
    //! 
    //! Throws: If allocator_type's copy constructor throws.
    //! 
    //! Complexity: Constant.
-   explicit deque(const allocator_type& a = allocator_type()) 
+   explicit deque(const allocator_type& a) 
       : Base(a)
    {}
 
@@ -784,10 +852,11 @@ class deque : protected deque_base
    //!   throws or T's default or copy constructor throws.
    //! 
    //! Complexity: Linear to n.
-   explicit deque(size_type n) : Base(allocator_type(), n)
+   explicit deque(size_type n)
+      : Base(n, allocator_type())
    {
-      containers_detail::default_construct_aux_proxy proxy(n);
-      proxy.uninitialized_copy_all_to(this->begin());
+      container_detail::default_construct_aux_proxy proxy(this->alloc(), n);
+      proxy.uninitialized_copy_remaining_to(this->begin());
       //deque_base will deallocate in case of exception...
    }
 
@@ -799,7 +868,8 @@ class deque : protected deque_base
    //! 
    //! Complexity: Linear to n.
    deque(size_type n, const value_type& value,
-         const allocator_type& a = allocator_type()) : Base(a, n)
+         const allocator_type& a = allocator_type())
+      : Base(n, a)
    { this->priv_fill_initialize(value); }
 
    //! Effects: Copy constructs a deque.
@@ -808,11 +878,12 @@ class deque : protected deque_base
    //! 
    //! Complexity: Linear to the elements x contains.
    deque(const deque& x)
-      :  Base(x.alloc()) 
+      :  Base(allocator_traits_type::select_on_container_copy_construction(x.alloc()))
    {
       if(x.size()){
          this->priv_initialize_map(x.size());
-         std::uninitialized_copy(x.begin(), x.end(), this->members_.m_start);
+         boost::container::uninitialized_copy_alloc
+            (this->alloc(), x.begin(), x.end(), this->members_.m_start);
       }
    }
 
@@ -821,9 +892,9 @@ class deque : protected deque_base
    //! Throws: If allocator_type's copy constructor throws.
    //! 
    //! Complexity: Constant.
-   deque(BOOST_RV_REF(deque) mx) 
-      :  Base(mx.alloc())
-   {  this->swap(mx);   }
+   deque(BOOST_RV_REF(deque) x) 
+      :  Base(boost::move(static_cast(x)))
+   {  this->swap_members(x);   }
 
    //! Effects: Constructs a deque that will use a copy of allocator a
    //!   and inserts a copy of the range [first, last) in the deque.
@@ -837,8 +908,8 @@ class deque : protected deque_base
       : Base(a) 
    {
       //Dispatch depending on integer/iterator
-      const bool aux_boolean = containers_detail::is_convertible::value;
-      typedef containers_detail::bool_ Result;
+      const bool aux_boolean = container_detail::is_convertible::value;
+      typedef container_detail::bool_ Result;
       this->priv_initialize_dispatch(first, last, Result());
    }
 
@@ -848,7 +919,7 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //!
    //! Complexity: Linear to the number of elements.
-   ~deque() 
+   ~deque() BOOST_CONTAINER_NOEXCEPT
    {
       priv_destroy_range(this->members_.m_start, this->members_.m_finish);
    }
@@ -863,15 +934,18 @@ class deque : protected deque_base
    //! Complexity: Linear to the number of elements in x.
    deque& operator= (BOOST_COPY_ASSIGN_REF(deque) x) 
    {
-      const size_type len = size();
-      if (&x != this) {
-         if (len >= x.size())
-            this->erase(std::copy(x.begin(), x.end(), this->members_.m_start), this->members_.m_finish);
-         else {
-            const_iterator mid = x.begin() + difference_type(len);
-            std::copy(x.begin(), mid, this->members_.m_start);
-            this->insert(this->members_.m_finish, mid, x.end());
+      if (&x != this){
+         allocator_type &this_alloc     = this->alloc();
+         const allocator_type &x_alloc  = x.alloc();
+         container_detail::bool_ flag;
+         if(flag && this_alloc != x_alloc){
+            this->clear();
+            this->shrink_to_fit();
          }
+         container_detail::assign_alloc(this->alloc(), x.alloc(), flag);
+         container_detail::assign_alloc(this->ptr_alloc(), x.ptr_alloc(), flag);
+         this->assign(x.cbegin(), x.cend());
       }
       return *this;
    }
@@ -886,8 +960,27 @@ class deque : protected deque_base
    //! Complexity: Linear.
    deque& operator= (BOOST_RV_REF(deque) x)
    {
-      this->clear();
-      this->swap(x);
+      if (&x != this){
+         allocator_type &this_alloc = this->alloc();
+         allocator_type &x_alloc    = x.alloc();
+         //If allocators are equal we can just swap pointers
+         if(this_alloc == x_alloc){
+            //Destroy objects but retain memory in case x reuses it in the future
+            this->clear();
+            this->swap_members(x);
+            //Move allocator if needed
+            container_detail::bool_ flag;
+            container_detail::move_alloc(this_alloc, x_alloc, flag);
+            container_detail::move_alloc(this->ptr_alloc(), x.ptr_alloc(), flag);
+         }
+         //If unequal allocators, then do a one by one move
+         else{
+            typedef typename std::iterator_traits::iterator_category ItCat;
+            this->assign( boost::make_move_iterator(x.begin())
+                        , boost::make_move_iterator(x.end()));
+         }
+      }
       return *this;
    }
 
@@ -900,10 +993,10 @@ class deque : protected deque_base
    //! Complexity: Constant.
    void swap(deque &x)
    {
-      std::swap(this->members_.m_start, x.members_.m_start);
-      std::swap(this->members_.m_finish, x.members_.m_finish);
-      std::swap(this->members_.m_map, x.members_.m_map);
-      std::swap(this->members_.m_map_size, x.members_.m_map_size);
+      this->swap_members(x);
+      container_detail::bool_ flag;
+      container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
+      container_detail::swap_alloc(this->ptr_alloc(), x.ptr_alloc(), flag);
    }
 
    //! Effects: Assigns the n copies of val to *this.
@@ -924,8 +1017,8 @@ class deque : protected deque_base
    void assign(InpIt first, InpIt last)
    {
       //Dispatch depending on integer/iterator
-      const bool aux_boolean = containers_detail::is_convertible::value;
-      typedef containers_detail::bool_ Result;
+      const bool aux_boolean = container_detail::is_convertible::value;
+      typedef container_detail::bool_ Result;
       this->priv_assign_dispatch(first, last, Result());
    }
 
@@ -974,11 +1067,11 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //!
    //! Complexity: Constant time.
-   void pop_back() 
+   void pop_back() BOOST_CONTAINER_NOEXCEPT
    {
       if (this->members_.m_finish.m_cur != this->members_.m_finish.m_first) {
          --this->members_.m_finish.m_cur;
-         containers_detail::get_pointer(this->members_.m_finish.m_cur)->~value_type();
+         container_detail::to_raw_pointer(this->members_.m_finish.m_cur)->~value_type();
       }
       else
          this->priv_pop_back_aux();
@@ -989,10 +1082,10 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //!
    //! Complexity: Constant time.
-   void pop_front() 
+   void pop_front() BOOST_CONTAINER_NOEXCEPT
    {
       if (this->members_.m_start.m_cur != this->members_.m_start.m_last - 1) {
-         containers_detail::get_pointer(this->members_.m_start.m_cur)->~value_type();
+         container_detail::to_raw_pointer(this->members_.m_start.m_cur)->~value_type();
          ++this->members_.m_start.m_cur;
       }
       else 
@@ -1046,12 +1139,12 @@ class deque : protected deque_base
    void insert(const_iterator pos, InpIt first, InpIt last) 
    {
       //Dispatch depending on integer/iterator
-      const bool aux_boolean = containers_detail::is_convertible::value;
-      typedef containers_detail::bool_ Result;
+      const bool aux_boolean = container_detail::is_convertible::value;
+      typedef container_detail::bool_ Result;
       this->priv_insert_dispatch(pos, first, last, Result());
    }
 
-   #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... in the end of the deque.
@@ -1063,13 +1156,16 @@ class deque : protected deque_base
    void emplace_back(Args&&... args)
    {
       if(this->priv_push_back_simple_available()){
-         new(this->priv_push_back_simple_pos())value_type(boost::forward(args)...);
+         allocator_traits_type::construct
+            ( this->alloc()
+            , this->priv_push_back_simple_pos()
+            , boost::forward(args)...);
          this->priv_push_back_simple_commit();
       }
       else{
-         typedef containers_detail::advanced_insert_aux_emplace type;
-         type &&proxy = type(boost::forward(args)...);
-         this->priv_insert_aux_impl(this->cend(), 1, proxy);
+         typedef container_detail::advanced_insert_aux_non_movable_emplace type;
+         type &&proxy = type(this->alloc(), boost::forward(args)...);
+         this->priv_insert_back_aux_impl(1, proxy);
       }
    }
 
@@ -1083,13 +1179,16 @@ class deque : protected deque_base
    void emplace_front(Args&&... args)
    {
       if(this->priv_push_front_simple_available()){
-         new(this->priv_push_front_simple_pos())value_type(boost::forward(args)...);
+         allocator_traits_type::construct
+            ( this->alloc()
+            , this->priv_push_front_simple_pos()
+            , boost::forward(args)...);
          this->priv_push_front_simple_commit();
       }
       else{
-         typedef containers_detail::advanced_insert_aux_emplace type;
-         type &&proxy = type(boost::forward(args)...);
-         this->priv_insert_aux_impl(this->cbegin(), 1, proxy);
+         typedef container_detail::advanced_insert_aux_non_movable_emplace type;
+         type &&proxy = type(this->alloc(), boost::forward(args)...);
+         this->priv_insert_front_aux_impl(1, proxy);
       }
    }
 
@@ -1115,117 +1214,81 @@ class deque : protected deque_base
       }
       else{
          size_type n = p - this->cbegin();
-         typedef containers_detail::advanced_insert_aux_emplace type;
-         type &&proxy = type(boost::forward(args)...);
+         typedef container_detail::advanced_insert_aux_emplace type;
+         type &&proxy = type(this->alloc(), boost::forward(args)...);
          this->priv_insert_aux_impl(p, 1, proxy);
          return iterator(this->begin() + n);
       }
    }
 
-   #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
-   //0 args
-   void emplace_back()
-   {
-      if(priv_push_front_simple_available()){
-         new(priv_push_front_simple_pos())value_type();
-         priv_push_front_simple_commit();
-      }
-      else{
-         containers_detail::advanced_insert_aux_emplace proxy;
-         priv_insert_aux_impl(cend(), 1, proxy);
-      }
-   }
-
-   void emplace_front()
-   {
-      if(priv_push_front_simple_available()){
-         new(priv_push_front_simple_pos())value_type();
-         priv_push_front_simple_commit();
-      }
-      else{
-         containers_detail::advanced_insert_aux_emplace proxy;
-         priv_insert_aux_impl(cbegin(), 1, proxy);
-      }
-   }
-
-   iterator emplace(const_iterator p)
-   {
-      if(p == cbegin()){
-         emplace_front();
-         return begin();
-      }
-      else if(p == cend()){
-         emplace_back();
-         return (end()-1);
-      }
-      else{
-         size_type n = p - cbegin();
-         containers_detail::advanced_insert_aux_emplace proxy;
-         priv_insert_aux_impl(p, 1, proxy);
-         return iterator(this->begin() + n);
-      }
-   }
+   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //advanced_insert_int.hpp includes all necessary preprocessor machinery...
    #define BOOST_PP_LOCAL_MACRO(n)                                                           \
-   template                                                \
-   void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                  \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
+   void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                     \
    {                                                                                         \
       if(priv_push_back_simple_available()){                                                 \
-         new(priv_push_back_simple_pos())value_type                                          \
-         (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));                         \
+         allocator_traits_type::construct                                                    \
+            ( this->alloc()                                                                  \
+            , this->priv_push_back_simple_pos()                                              \
+              BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));               \
          priv_push_back_simple_commit();                                                     \
       }                                                                                      \
       else{                                                                                  \
-         containers_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)             \
-                                           \
-               proxy(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));              \
-         priv_insert_aux_impl(cend(), 1, proxy);                                             \
+         container_detail::BOOST_PP_CAT(BOOST_PP_CAT(                                        \
+            advanced_insert_aux_non_movable_emplace, n), arg)                                \
+                proxy                       \
+            (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));  \
+         priv_insert_back_aux_impl(1, proxy);                                                \
       }                                                                                      \
    }                                                                                         \
                                                                                              \
-   template                                                \
-   void emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                 \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >  )  \
+   void emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                    \
    {                                                                                         \
       if(priv_push_front_simple_available()){                                                \
-         new(priv_push_front_simple_pos())value_type                                         \
-            (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));                      \
+         allocator_traits_type::construct                                                    \
+            ( this->alloc()                                                                  \
+            , this->priv_push_front_simple_pos()                                             \
+              BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));               \
          priv_push_front_simple_commit();                                                    \
       }                                                                                      \
       else{                                                                                  \
-         containers_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)             \
-                                           \
-               proxy(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));              \
-         priv_insert_aux_impl(cbegin(), 1, proxy);                                           \
+         container_detail::BOOST_PP_CAT(BOOST_PP_CAT                                         \
+            (advanced_insert_aux_non_movable_emplace, n), arg)                               \
+                proxy                       \
+            (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));  \
+         priv_insert_front_aux_impl(1, proxy);                                               \
       }                                                                                      \
    }                                                                                         \
                                                                                              \
-   template                                                \
-   iterator emplace(const_iterator p, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
+   iterator emplace(const_iterator p                                                         \
+                    BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))             \
    {                                                                                         \
       if(p == this->cbegin()){                                                               \
-         this->emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));      \
+         this->emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));         \
          return this->begin();                                                               \
       }                                                                                      \
       else if(p == cend()){                                                                  \
-         this->emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));       \
+         this->emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));          \
          return (this->end()-1);                                                             \
       }                                                                                      \
       else{                                                                                  \
          size_type pos_num = p - this->cbegin();                                             \
-         containers_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)             \
-                                           \
-               proxy(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));              \
+         container_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)   \
+             proxy                          \
+            (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));  \
          this->priv_insert_aux_impl(p, 1, proxy);                                            \
          return iterator(this->begin() + pos_num);                                           \
       }                                                                                      \
    }                                                                                         \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif   //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! Effects: Inserts or erases elements at the end such that
    //!   the size becomes n. New elements are copy constructed from x.
@@ -1252,11 +1315,11 @@ class deque : protected deque_base
    {
       const size_type len = size();
       if (new_size < len) 
-         this->erase(this->members_.m_start + new_size, this->members_.m_finish);
+         this->priv_erase_last_n(len - new_size);
       else{
          size_type n = new_size - this->size();
-         containers_detail::default_construct_aux_proxy proxy(n);
-         priv_insert_aux_impl(this->cend(), n, proxy);
+         container_detail::default_construct_aux_proxy proxy(this->alloc(), n);
+         priv_insert_back_aux_impl(n, proxy);
       }
    }
 
@@ -1268,7 +1331,7 @@ class deque : protected deque_base
    //!   last element (if pos is near the end) or the first element
    //!   if(pos is near the beginning).
    //!   Constant if pos is the first or the last element.
-   iterator erase(const_iterator pos) 
+   iterator erase(const_iterator pos) BOOST_CONTAINER_NOEXCEPT
    {
       const_iterator next = pos;
       ++next;
@@ -1292,7 +1355,7 @@ class deque : protected deque_base
    //!   last plus the elements between pos and the 
    //!   last element (if pos is near the end) or the first element
    //!   if(pos is near the beginning).
-   iterator erase(const_iterator first, const_iterator last)
+   iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
    {
       if (first == this->members_.m_start && last == this->members_.m_finish) {
          this->clear();
@@ -1321,12 +1384,26 @@ class deque : protected deque_base
       }
    }
 
+   void priv_erase_last_n(size_type n)
+   {
+      if(n == this->size()) {
+         this->clear();
+      }
+      else {
+         iterator new_finish = this->members_.m_finish - n;
+         if(!Base::traits_t::trivial_dctr_after_move)
+            this->priv_destroy_range(new_finish, this->members_.m_finish);
+         this->priv_destroy_nodes(new_finish.m_node + 1, this->members_.m_finish.m_node + 1);
+         this->members_.m_finish = new_finish;
+      }
+   }
+
    //! Effects: Erases all the elements of the deque.
    //!
    //! Throws: Nothing.
    //!
    //! Complexity: Linear to the number of elements in the deque.
-   void clear()
+   void clear() BOOST_CONTAINER_NOEXCEPT
    {
       for (index_pointer node = this->members_.m_start.m_node + 1;
             node < this->members_.m_finish.m_node;
@@ -1365,7 +1442,6 @@ class deque : protected deque_base
 
    /// @cond
    private:
-
    void priv_range_check(size_type n) const 
       {  if (n >= this->size())  BOOST_RETHROW std::out_of_range("deque");   }
 
@@ -1407,7 +1483,8 @@ class deque : protected deque_base
    void priv_push_front(const value_type &t)
    {
       if(this->priv_push_front_simple_available()){
-         new(this->priv_push_front_simple_pos())value_type(t);
+         allocator_traits_type::construct
+            ( this->alloc(), this->priv_push_front_simple_pos(), t);
          this->priv_push_front_simple_commit();
       }
       else{
@@ -1418,7 +1495,8 @@ class deque : protected deque_base
    void priv_push_front(BOOST_RV_REF(value_type) t)
    {
       if(this->priv_push_front_simple_available()){
-         new(this->priv_push_front_simple_pos())value_type(boost::move(t));
+         allocator_traits_type::construct
+            ( this->alloc(), this->priv_push_front_simple_pos(), boost::move(t));
          this->priv_push_front_simple_commit();
       }
       else{
@@ -1429,7 +1507,8 @@ class deque : protected deque_base
    void priv_push_back(const value_type &t)
    {
       if(this->priv_push_back_simple_available()){
-         new(this->priv_push_back_simple_pos())value_type(t);
+         allocator_traits_type::construct
+            ( this->alloc(), this->priv_push_back_simple_pos(), t);
          this->priv_push_back_simple_commit();
       }
       else{
@@ -1440,7 +1519,8 @@ class deque : protected deque_base
    void priv_push_back(BOOST_RV_REF(T) t)
    {
       if(this->priv_push_back_simple_available()){
-         new(this->priv_push_back_simple_pos())value_type(boost::move(t));
+         allocator_traits_type::construct
+            ( this->alloc(), this->priv_push_back_simple_pos(), boost::move(t));
          this->priv_push_back_simple_commit();
       }
       else{
@@ -1454,9 +1534,9 @@ class deque : protected deque_base
          (this->members_.m_finish.m_cur != (this->members_.m_finish.m_last - 1));
    }
 
-   void *priv_push_back_simple_pos() const
+   T *priv_push_back_simple_pos() const
    {
-      return static_cast(containers_detail::get_pointer(this->members_.m_finish.m_cur));
+      return container_detail::to_raw_pointer(this->members_.m_finish.m_cur);
    }
 
    void priv_push_back_simple_commit()
@@ -1470,8 +1550,8 @@ class deque : protected deque_base
          (this->members_.m_start.m_cur != this->members_.m_start.m_first);
    }
 
-   void *priv_push_front_simple_pos() const
-   {  return static_cast(containers_detail::get_pointer(this->members_.m_start.m_cur) - 1);  }
+   T *priv_push_front_simple_pos() const
+   {  return container_detail::to_raw_pointer(this->members_.m_start.m_cur) - 1;  }
 
    void priv_push_front_simple_commit()
    {  --this->members_.m_start.m_cur;   }
@@ -1505,14 +1585,14 @@ class deque : protected deque_base
    }
 
    template 
-   void priv_initialize_dispatch(Integer n, Integer x, containers_detail::true_) 
+   void priv_initialize_dispatch(Integer n, Integer x, container_detail::true_) 
    {
       this->priv_initialize_map(n);
       this->priv_fill_initialize(x);
    }
 
    template 
-   void priv_initialize_dispatch(InpIt first, InpIt last, containers_detail::false_) 
+   void priv_initialize_dispatch(InpIt first, InpIt last, container_detail::false_) 
    {
       typedef typename std::iterator_traits::iterator_category ItCat;
       this->priv_range_initialize(first, last, ItCat());
@@ -1521,21 +1601,21 @@ class deque : protected deque_base
    void priv_destroy_range(iterator p, iterator p2)
    {
       for(;p != p2; ++p)
-         containers_detail::get_pointer(&*p)->~value_type();
+         container_detail::to_raw_pointer(&*p)->~value_type();
    }
 
    void priv_destroy_range(pointer p, pointer p2)
    {
       for(;p != p2; ++p)
-         containers_detail::get_pointer(&*p)->~value_type();
+         container_detail::to_raw_pointer(&*p)->~value_type();
    }
 
    template 
-   void priv_assign_dispatch(Integer n, Integer val, containers_detail::true_)
+   void priv_assign_dispatch(Integer n, Integer val, container_detail::true_)
       { this->priv_fill_assign((size_type) n, (value_type)val); }
 
    template 
-   void priv_assign_dispatch(InpIt first, InpIt last, containers_detail::false_) 
+   void priv_assign_dispatch(InpIt first, InpIt last, container_detail::false_) 
    {
       typedef typename std::iterator_traits::iterator_category ItCat;
       this->priv_assign_aux(first, last, ItCat());
@@ -1560,19 +1640,19 @@ class deque : protected deque_base
       if (len > size()) {
          FwdIt mid = first;
          std::advance(mid, size());
-         std::copy(first, mid, begin());
+         boost::copy_or_move(first, mid, begin());
          this->insert(cend(), mid, last);
       }
       else
-         this->erase(std::copy(first, last, begin()), cend());
+         this->erase(boost::copy_or_move(first, last, begin()), cend());
    }
 
    template 
-   void priv_insert_dispatch(const_iterator pos, Integer n, Integer x, containers_detail::true_) 
+   void priv_insert_dispatch(const_iterator pos, Integer n, Integer x, container_detail::true_) 
    {  this->priv_fill_insert(pos, (size_type) n, (value_type)x); }
 
    template 
-   void priv_insert_dispatch(const_iterator pos,InpIt first, InpIt last, containers_detail::false_) 
+   void priv_insert_dispatch(const_iterator pos,InpIt first, InpIt last, container_detail::false_) 
    {
       typedef typename std::iterator_traits::iterator_category ItCat;
       this->priv_insert_aux(pos, first, last, ItCat());
@@ -1588,7 +1668,7 @@ class deque : protected deque_base
    template 
    void priv_insert_aux(const_iterator p, FwdIt first, FwdIt last)
    {
-      containers_detail::advanced_insert_aux_proxy proxy(first, last);
+      container_detail::advanced_insert_aux_proxy proxy(this->alloc(), first, last);
       priv_insert_aux_impl(p, (size_type)std::distance(first, last), proxy);
    }
 
@@ -1608,19 +1688,21 @@ class deque : protected deque_base
          pos = this->members_.m_start + elemsbefore;
          if (elemsbefore >= difference_type(n)) {
             iterator start_n = this->members_.m_start + difference_type(n); 
-            ::boost::uninitialized_move(this->members_.m_start, start_n, new_start);
+            ::boost::container::uninitialized_move_alloc
+               (this->alloc(), this->members_.m_start, start_n, new_start);
             this->members_.m_start = new_start;
             boost::move(start_n, pos, old_start);
-            interf.copy_all_to(pos - difference_type(n));
+            interf.copy_remaining_to(pos - difference_type(n));
          }
          else {
             difference_type mid_count = (difference_type(n) - elemsbefore);
             iterator mid_start = old_start - mid_count;
             interf.uninitialized_copy_some_and_update(mid_start, mid_count, true);
             this->members_.m_start = mid_start;
-            ::boost::uninitialized_move(old_start, pos, new_start);
+            ::boost::container::uninitialized_move_alloc
+               (this->alloc(), old_start, pos, new_start);
             this->members_.m_start = new_start;
-            interf.copy_all_to(old_start);
+            interf.copy_remaining_to(old_start);
          }
       }
       else {
@@ -1631,21 +1713,47 @@ class deque : protected deque_base
          pos = this->members_.m_finish - elemsafter;
          if (elemsafter >= difference_type(n)) {
             iterator finish_n = this->members_.m_finish - difference_type(n);
-            ::boost::uninitialized_move(finish_n, this->members_.m_finish, this->members_.m_finish);
+            ::boost::container::uninitialized_move_alloc
+               (this->alloc(), finish_n, this->members_.m_finish, this->members_.m_finish);
             this->members_.m_finish = new_finish;
             boost::move_backward(pos, finish_n, old_finish);
-            interf.copy_all_to(pos);
+            interf.copy_remaining_to(pos);
          }
          else {
             interf.uninitialized_copy_some_and_update(old_finish, elemsafter, false);
             this->members_.m_finish += n-elemsafter;
-            ::boost::uninitialized_move(pos, old_finish, this->members_.m_finish);
+            ::boost::container::uninitialized_move_alloc
+               (this->alloc(), pos, old_finish, this->members_.m_finish);
             this->members_.m_finish = new_finish;
-            interf.copy_all_to(pos);
+            interf.copy_remaining_to(pos);
          }
       }
    }
 
+   void priv_insert_back_aux_impl(size_type n, advanced_insert_aux_int_t &interf)
+   {
+      if(!this->members_.m_map){
+         this->priv_initialize_map(0);
+      }
+
+      iterator new_finish = this->priv_reserve_elements_at_back(n);
+      iterator old_finish = this->members_.m_finish;
+      interf.uninitialized_copy_some_and_update(old_finish, n, true);
+      this->members_.m_finish = new_finish;
+   }
+
+   void priv_insert_front_aux_impl(size_type n, advanced_insert_aux_int_t &interf)
+   {
+      if(!this->members_.m_map){
+         this->priv_initialize_map(0);
+      }
+
+      iterator new_start = this->priv_reserve_elements_at_front(n);
+      interf.uninitialized_copy_some_and_update(new_start, difference_type(n), true);
+      this->members_.m_start = new_start;
+   }
+
+
    void priv_fill_insert(const_iterator pos, size_type n, const value_type& x)
    {
       typedef constant_iterator c_it;
@@ -1659,9 +1767,11 @@ class deque : protected deque_base
       index_pointer cur;
       BOOST_TRY {
          for (cur = this->members_.m_start.m_node; cur < this->members_.m_finish.m_node; ++cur){
-            std::uninitialized_fill(*cur, *cur + this->s_buffer_size(), value);
+            boost::container::uninitialized_fill_alloc
+               (this->alloc(), *cur, *cur + this->s_buffer_size(), value);
          }
-         std::uninitialized_fill(this->members_.m_finish.m_first, this->members_.m_finish.m_cur, value);
+         boost::container::uninitialized_fill_alloc
+            (this->alloc(), this->members_.m_finish.m_first, this->members_.m_finish.m_cur, value);
       }
       BOOST_CATCH(...){
          this->priv_destroy_range(this->members_.m_start, iterator(*cur, cur));
@@ -1699,10 +1809,12 @@ class deque : protected deque_base
                ++cur_node) {
             FwdIt mid = first;
             std::advance(mid, this->s_buffer_size());
-            ::boost::uninitialized_copy_or_move(first, mid, *cur_node);
+            ::boost::container::uninitialized_copy_or_move_alloc
+               (this->alloc(), first, mid, *cur_node);
             first = mid;
          }
-         ::boost::uninitialized_copy_or_move(first, last, this->members_.m_finish.m_first);
+         ::boost::container::uninitialized_copy_or_move_alloc
+            (this->alloc(), first, last, this->members_.m_finish.m_first);
       }
       BOOST_CATCH(...){
          this->priv_destroy_range(this->members_.m_start, iterator(*cur_node, cur_node));
@@ -1717,7 +1829,7 @@ class deque : protected deque_base
       this->priv_deallocate_node(this->members_.m_finish.m_first);
       this->members_.m_finish.priv_set_node(this->members_.m_finish.m_node - 1);
       this->members_.m_finish.m_cur = this->members_.m_finish.m_last - 1;
-      containers_detail::get_pointer(this->members_.m_finish.m_cur)->~value_type();
+      container_detail::to_raw_pointer(this->members_.m_finish.m_cur)->~value_type();
    }
 
    // Called only if this->members_.m_start.m_cur == this->members_.m_start.m_last - 1.  Note that 
@@ -1726,7 +1838,7 @@ class deque : protected deque_base
    // must have at least two nodes.
    void priv_pop_front_aux()
    {
-      containers_detail::get_pointer(this->members_.m_start.m_cur)->~value_type();
+      container_detail::to_raw_pointer(this->members_.m_start.m_cur)->~value_type();
       this->priv_deallocate_node(this->members_.m_start.m_first);
       this->members_.m_start.priv_set_node(this->members_.m_start.m_node + 1);
       this->members_.m_start.m_cur = this->members_.m_start.m_first;
@@ -1800,7 +1912,7 @@ class deque : protected deque_base
       }
       else {
          size_type new_map_size = 
-            this->members_.m_map_size + containers_detail::max_value(this->members_.m_map_size, nodes_to_add) + 2;
+            this->members_.m_map_size + container_detail::max_value(this->members_.m_map_size, nodes_to_add) + 2;
 
          index_pointer new_map = this->priv_allocate_map(new_map_size);
          new_nstart = new_map + (new_map_size - new_num_nodes) / 2
@@ -1878,4 +1990,4 @@ struct has_trivial_destructor_after_move >
 
 #include 
 
-#endif //   #ifndef  BOOST_CONTAINERS_DEQUE_HPP
+#endif //   #ifndef  BOOST_CONTAINER_DEQUE_HPP
diff --git a/include/boost/container/detail/adaptive_node_pool_impl.hpp b/include/boost/container/detail/adaptive_node_pool_impl.hpp
index d462ee3..3649579 100644
--- a/include/boost/container/detail/adaptive_node_pool_impl.hpp
+++ b/include/boost/container/detail/adaptive_node_pool_impl.hpp
@@ -19,7 +19,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -31,7 +31,7 @@
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 template
 struct hdr_offset_holder_t
@@ -221,7 +221,7 @@ class private_adaptive_node_pool_impl
 
    //!Returns the segment manager. Never throws
    segment_manager_base_type* get_segment_manager_base()const
-   {  return containers_detail::get_pointer(mp_segment_mngr_base);  }
+   {  return container_detail::to_raw_pointer(mp_segment_mngr_base);  }
 
    //!Allocates array of count elements. Can throw
    void *allocate_node()
@@ -348,7 +348,7 @@ class private_adaptive_node_pool_impl
    {
       block_iterator block_it(m_block_multiset.end());
       while(n--){
-         void *pElem = containers_detail::get_pointer(chain.front());
+         void *pElem = container_detail::to_raw_pointer(chain.front());
          chain.pop_front();
          priv_invariants();
          block_info_t *block_info = this->priv_block_from_node(pElem);
@@ -434,7 +434,7 @@ class private_adaptive_node_pool_impl
          (void)free_nodes;
          BOOST_ASSERT(free_nodes == mp_impl->m_real_num_node);
          BOOST_ASSERT(0 == to_deallocate->hdr_offset);
-         hdr_offset_holder *hdr_off_holder = mp_impl->priv_first_subblock_from_block(containers_detail::get_pointer(to_deallocate));
+         hdr_offset_holder *hdr_off_holder = mp_impl->priv_first_subblock_from_block(container_detail::to_raw_pointer(to_deallocate));
          mp_impl->mp_segment_mngr_base->deallocate(hdr_off_holder);
       }
 
@@ -557,7 +557,7 @@ class private_adaptive_node_pool_impl
             (mp_segment_mngr_base->allocate_aligned(real_block_size, m_real_block_alignment));
          if(!mem_address)   throw std::bad_alloc();
          ++m_totally_free_blocks;
-         block_info_t *c_info = new(mem_address)block_info_t;
+         block_info_t *c_info = new(mem_address)block_info_t();
          m_block_multiset.insert(m_block_multiset.end(), *c_info);
          
          mem_address += HdrSize;
@@ -587,7 +587,7 @@ class private_adaptive_node_pool_impl
 
          //First initialize header information on the last subblock
          char *hdr_addr = mem_address + m_real_block_alignment*(m_num_subblocks-1);
-         block_info_t *c_info = new(hdr_addr)block_info_t;
+         block_info_t *c_info = new(hdr_addr)block_info_t();
          //Some structural checks
          BOOST_ASSERT(static_cast(&static_cast(c_info)->hdr_offset) ==
                 static_cast(c_info));
@@ -622,8 +622,8 @@ class private_adaptive_node_pool_impl
    {  return priv_alloc_block(n, IsAlignOnly());   }
 
    private:
-   typedef typename boost::pointer_to_other
-      ::type   segment_mngr_base_ptr_t;
+   typedef typename boost::intrusive::pointer_traits
+      ::template rebind_pointer::type   segment_mngr_base_ptr_t;
    const size_type m_max_free_blocks;
    const size_type m_real_node_size;
    //Round the size to a power of two value.
@@ -639,7 +639,7 @@ class private_adaptive_node_pool_impl
    size_type                            m_totally_free_blocks;  //Free blocks
 };
 
-}  //namespace containers_detail {
+}  //namespace container_detail {
 }  //namespace container {
 }  //namespace boost {
 
diff --git a/include/boost/container/detail/advanced_insert_int.hpp b/include/boost/container/detail/advanced_insert_int.hpp
index 77f3547..58199c7 100644
--- a/include/boost/container/detail/advanced_insert_int.hpp
+++ b/include/boost/container/detail/advanced_insert_int.hpp
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_ADVANCED_INSERT_INT_HPP
-#define BOOST_CONTAINERS_ADVANCED_INSERT_INT_HPP
+#ifndef BOOST_CONTAINER_ADVANCED_INSERT_INT_HPP
+#define BOOST_CONTAINER_ADVANCED_INSERT_INT_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -17,54 +17,58 @@
 
 #include "config_begin.hpp"
 #include 
+#include 
 #include 
 #include   //std::iterator_traits
-#include        //placement new
 #include 
 
-namespace boost { namespace container { namespace containers_detail {
+namespace boost { namespace container { namespace container_detail {
 
 //This class will be interface for operations dependent on FwdIt types used advanced_insert_aux_impl
-template
+template
 struct advanced_insert_aux_int
 {
    typedef typename std::iterator_traits::difference_type difference_type;
-   virtual void copy_all_to(Iterator p) = 0;
-   virtual void uninitialized_copy_all_to(Iterator p) = 0;
+   virtual void copy_remaining_to(Iterator p) = 0;
+   virtual void uninitialized_copy_remaining_to(Iterator p) = 0;
    virtual void uninitialized_copy_some_and_update(Iterator pos, difference_type division_count, bool first) = 0;
    virtual void copy_some_and_update(Iterator pos, difference_type division_count, bool first) = 0;
    virtual ~advanced_insert_aux_int() {}
 };
 
 //This class template will adapt each FwIt types to advanced_insert_aux_int
-template
+template
 struct advanced_insert_aux_proxy
-   :  public advanced_insert_aux_int
+   :  public advanced_insert_aux_int
 {
-   typedef typename advanced_insert_aux_int::difference_type difference_type;
-   advanced_insert_aux_proxy(FwdIt first, FwdIt last)
-      :  first_(first), last_(last)
+   typedef boost::container::allocator_traits alloc_traits;
+   typedef typename allocator_traits::size_type size_type;
+   typedef typename allocator_traits::value_type value_type;
+   typedef typename advanced_insert_aux_int::difference_type difference_type;
+
+   advanced_insert_aux_proxy(A& a, FwdIt first, FwdIt last)
+      :  a_(a), first_(first), last_(last)
    {}
 
    virtual ~advanced_insert_aux_proxy()
    {}
 
-   virtual void copy_all_to(Iterator p)
+   virtual void copy_remaining_to(Iterator p)
    {  ::boost::copy_or_move(first_, last_, p);  }
 
-   virtual void uninitialized_copy_all_to(Iterator p)
-   {  ::boost::uninitialized_copy_or_move(first_, last_, p);  }
+   virtual void uninitialized_copy_remaining_to(Iterator p)
+   {  ::boost::container::uninitialized_copy_or_move_alloc(a_, first_, last_, p);  }
 
    virtual void uninitialized_copy_some_and_update(Iterator pos, difference_type division_count, bool first_n)
    {
       FwdIt mid = first_;
       std::advance(mid, division_count);
       if(first_n){
-         ::boost::uninitialized_copy_or_move(first_, mid, pos);
+         ::boost::container::uninitialized_copy_or_move_alloc(a_, first_, mid, pos);
          first_ = mid;
       }
       else{
-         ::boost::uninitialized_copy_or_move(mid, last_, pos);
+         ::boost::container::uninitialized_copy_or_move_alloc(a_, mid, last_, pos);
          last_ = mid;
       }
    }
@@ -82,53 +86,38 @@ struct advanced_insert_aux_proxy
          last_ = mid;
       }
    }
-
+   A &a_;
    FwdIt first_, last_;
 };
 
-//This class template will adapt each FwIt types to advanced_insert_aux_int
-template
+//This class template will adapt default construction insertions to advanced_insert_aux_int
+template
 struct default_construct_aux_proxy
-   :  public advanced_insert_aux_int
+   :  public advanced_insert_aux_int
 {
-   typedef typename advanced_insert_aux_int::difference_type difference_type;
-   default_construct_aux_proxy(SizeType count)
-      :  count_(count)
-   {}
+   typedef boost::container::allocator_traits alloc_traits;
+   typedef typename allocator_traits::size_type size_type;
+   typedef typename allocator_traits::value_type value_type;
+   typedef typename advanced_insert_aux_int::difference_type difference_type;
 
-   void uninitialized_copy_impl(Iterator p, const SizeType n)
-   {
-      BOOST_ASSERT(n <= count_);
-      Iterator orig_p = p;
-      SizeType i = 0;
-      try{
-         for(; i < n; ++i, ++p){
-            new(containers_detail::get_pointer(&*p))T();
-         }
-      }
-      catch(...){
-         while(i--){
-            containers_detail::get_pointer(&*orig_p++)->~T();
-         }
-         throw;
-      }
-      count_ -= n;
-   }
+   default_construct_aux_proxy(A &a, size_type count)
+      :  a_(a), count_(count)
+   {}
 
    virtual ~default_construct_aux_proxy()
    {}
 
-   virtual void copy_all_to(Iterator)
+   virtual void copy_remaining_to(Iterator)
    {  //This should never be called with any count
       BOOST_ASSERT(count_ == 0);
    }
 
-   virtual void uninitialized_copy_all_to(Iterator p)
-   {  this->uninitialized_copy_impl(p, count_); }
+   virtual void uninitialized_copy_remaining_to(Iterator p)
+   {  this->priv_uninitialized_copy(p, count_); }
 
    virtual void uninitialized_copy_some_and_update(Iterator pos, difference_type division_count, bool first_n)
    {
-      SizeType new_count;
+      size_type new_count;
       if(first_n){
          new_count = division_count;
       }
@@ -136,13 +125,13 @@ struct default_construct_aux_proxy
          BOOST_ASSERT(difference_type(count_)>= division_count);
          new_count = count_ - division_count;
       }
-      this->uninitialized_copy_impl(pos, new_count);
+      this->priv_uninitialized_copy(pos, new_count);
    }
 
    virtual void copy_some_and_update(Iterator , difference_type division_count, bool first_n)
    {
       BOOST_ASSERT(count_ == 0);
-      SizeType new_count;
+      size_type new_count;
       if(first_n){
          new_count = division_count;
       }
@@ -155,12 +144,32 @@ struct default_construct_aux_proxy
       (void)new_count;
    }
 
-   SizeType count_;
+   private:
+   void priv_uninitialized_copy(Iterator p, const size_type n)
+   {
+      BOOST_ASSERT(n <= count_);
+      Iterator orig_p = p;
+      size_type i = 0;
+      try{
+         for(; i < n; ++i, ++p){
+            alloc_traits::construct(a_, container_detail::to_raw_pointer(&*p));
+         }
+      }
+      catch(...){
+         while(i--){
+            alloc_traits::destroy(a_, container_detail::to_raw_pointer(&*orig_p++));
+         }
+         throw;
+      }
+      count_ -= n;
+   }
+   A &a_;
+   size_type count_;
 };
 
-}}}   //namespace boost { namespace container { namespace containers_detail {
+}}}   //namespace boost { namespace container { namespace container_detail {
 
-#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
 #include 
 #include 
@@ -169,217 +178,251 @@ struct default_construct_aux_proxy
 //#include  //For debugging purposes
 
 namespace boost {
-namespace container { 
-namespace containers_detail {
+namespace container {
+namespace container_detail {
 
-//This class template will adapt each FwIt types to advanced_insert_aux_int
-template
-struct advanced_insert_aux_emplace
-   :  public advanced_insert_aux_int
+
+//This class template will adapt emplace construction insertions of movable types 
+//to advanced_insert_aux_int
+template
+struct advanced_insert_aux_non_movable_emplace
+   :  public advanced_insert_aux_int
 {
-   typedef typename advanced_insert_aux_int::difference_type difference_type;
+   typedef boost::container::allocator_traits alloc_traits;
+   typedef typename allocator_traits::size_type size_type;
+   typedef typename allocator_traits::value_type value_type;
+   typedef typename advanced_insert_aux_int::difference_type difference_type;
    typedef typename build_number_seq::type             index_tuple_t;
 
-   explicit advanced_insert_aux_emplace(Args&&... args)
-      : args_(args...)
+   explicit advanced_insert_aux_non_movable_emplace(A &a, Args&&... args)
+      : a_(a)
+      , args_(args...)
       , used_(false)
    {}
 
-   ~advanced_insert_aux_emplace()
+   ~advanced_insert_aux_non_movable_emplace()
    {}
 
-   virtual void copy_all_to(Iterator p)
-   {  this->priv_copy_all_to(index_tuple_t(), p);   }
+   virtual void copy_remaining_to(Iterator)
+   //This code can't be called since value_type is not movable or copyable
+   {  BOOST_ASSERT(false);   }
 
-   virtual void uninitialized_copy_all_to(Iterator p)
-   {  this->priv_uninitialized_copy_all_to(index_tuple_t(), p);   }
+   virtual void uninitialized_copy_remaining_to(Iterator p)
+   {  this->priv_uninitialized_copy_remaining_to(index_tuple_t(), p);   }
 
    virtual void uninitialized_copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
    {  this->priv_uninitialized_copy_some_and_update(index_tuple_t(), p, division_count, first_n);  }
 
-   virtual void copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
-   {  this->priv_copy_some_and_update(index_tuple_t(), p, division_count, first_n);  }
+   virtual void copy_some_and_update(Iterator, difference_type, bool )
+   //This code can't be called since value_type is not movable or copyable
+   {  BOOST_ASSERT(false);   }
 
    private:
-   template
-   void priv_copy_all_to(const index_tuple&, Iterator p)
-   {
-      if(!used_){
-         *p = boost::move(T (::boost::container::containers_detail::stored_ref::forward(get(args_))...));
-         used_ = true;
-      }
-   }
-
-   template
-   void priv_uninitialized_copy_all_to(const index_tuple&, Iterator p)
-   {
-      if(!used_){
-         new(containers_detail::get_pointer(&*p))T(::boost::container::containers_detail::stored_ref::forward(get(args_))...);
-         used_ = true;
-      }
-   }
-
    template
    void priv_uninitialized_copy_some_and_update(const index_tuple&, Iterator p, difference_type division_count, bool first_n)
    {
       BOOST_ASSERT(division_count <=1);
       if((first_n && division_count == 1) || (!first_n && division_count == 0)){
          if(!used_){
-            new(containers_detail::get_pointer(&*p))T(::boost::container::containers_detail::stored_ref::forward(get(args_))...);
+            alloc_traits::construct( a_
+                                   , container_detail::to_raw_pointer(&*p)
+                                   , ::boost::container::container_detail::
+                                       stored_ref::forward(get(args_))...
+                                   );
             used_ = true;
          }
       }
    }
 
+   template
+   void priv_uninitialized_copy_remaining_to(const index_tuple&, Iterator p)
+   {
+      if(!used_){
+         alloc_traits::construct( a_
+                                , container_detail::to_raw_pointer(&*p)
+                                , ::boost::container::container_detail::
+                                    stored_ref::forward(get(args_))...
+                                );
+         used_ = true;
+      }
+   }
+
+   protected:
+   A &a_;
+   tuple args_;
+   bool used_;
+};
+
+//This class template will adapt emplace construction insertions of movable types 
+//to advanced_insert_aux_int
+template
+struct advanced_insert_aux_emplace
+   :  public advanced_insert_aux_non_movable_emplace
+{
+   typedef advanced_insert_aux_non_movable_emplace base_t;
+   typedef typename base_t::value_type       value_type;
+   typedef typename base_t::difference_type  difference_type;
+   typedef typename base_t::index_tuple_t    index_tuple_t;
+
+   explicit advanced_insert_aux_emplace(A &a, Args&&... args)
+      : base_t(a, boost::forward(args)...)
+   {}
+
+   ~advanced_insert_aux_emplace()
+   {}
+
+   //Override only needed functions
+   virtual void copy_remaining_to(Iterator p)
+   {  this->priv_copy_remaining_to(index_tuple_t(), p);   }
+
+   virtual void copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
+   {  this->priv_copy_some_and_update(index_tuple_t(), p, division_count, first_n);  }
+
+   private:
+   template
+   void priv_copy_remaining_to(const index_tuple&, Iterator p)
+   {
+      if(!this->used_){
+         *p = boost::move(value_type (
+            ::boost::container::container_detail::stored_ref::forward(get(this->args_))...));
+         this->used_ = true;
+      }
+   }
+
    template
    void priv_copy_some_and_update(const index_tuple&, Iterator p, difference_type division_count, bool first_n)
    {
       BOOST_ASSERT(division_count <=1);
       if((first_n && division_count == 1) || (!first_n && division_count == 0)){
-         if(!used_){
-            *p = boost::move(T(::boost::container::containers_detail::stored_ref::forward(get(args_))...));
-            used_ = true;
+         if(!this->used_){
+            *p = boost::move(value_type(
+               ::boost::container::container_detail::stored_ref::forward(get(this->args_))...));
+            this->used_ = true;
          }
       }
    }
-   tuple args_;
-   bool used_;
 };
 
-}}}   //namespace boost { namespace container { namespace containers_detail {
+}}}   //namespace boost { namespace container { namespace container_detail {
 
-#else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+#else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
 #include  
 #include 
 
 namespace boost {
 namespace container { 
-namespace containers_detail {
+namespace container_detail {
 
-//This class template will adapt each FwIt types to advanced_insert_aux_int
-template
-struct advanced_insert_aux_emplace
-   :  public advanced_insert_aux_int
-{
-   typedef typename advanced_insert_aux_int::difference_type difference_type;
-   advanced_insert_aux_emplace()
-      :  used_(false)
-   {}
-
-   ~advanced_insert_aux_emplace()
-   {}
-
-   virtual void copy_all_to(Iterator p)
-   {
-      if(!used_){
-         value_initv;
-         *p = boost::move(v.m_t);
-         used_ = true;
-      }
-   }
-
-   virtual void uninitialized_copy_all_to(Iterator p)
-   {
-      if(!used_){
-         new(containers_detail::get_pointer(&*p))T();
-         used_ = true;
-      }
-   }
-
-   virtual void uninitialized_copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
-   {
-      BOOST_ASSERT(division_count <=1);
-      if((first_n && division_count == 1) || (!first_n && division_count == 0)){
-         if(!used_){
-            new(containers_detail::get_pointer(&*p))T();
-            used_ = true;
-         }
-      }
-   }
-
-   virtual void copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
-   {
-      BOOST_ASSERT(division_count <=1);
-      if((first_n && division_count == 1) || (!first_n && division_count == 0)){
-         if(!used_){
-            value_initv;
-            *p = boost::move(v.m_t);
-            used_ = true;
-         }
-      }
-   }
-   private:
-   bool used_;
-};
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                     \
-   template                \
-   struct BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)                \
-      :  public advanced_insert_aux_int                                     \
-   {                                                                                   \
-      typedef typename advanced_insert_aux_int::difference_type difference_type;  \
-                                                                                       \
-      BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)                    \
-         ( BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _) )          \
-         : used_(false), BOOST_PP_ENUM(n, BOOST_CONTAINERS_AUX_PARAM_INIT, _) {}     \
-                                                                                       \
-      virtual void copy_all_to(Iterator p)                                             \
-      {                                                                                \
-         if(!used_){                                                                   \
-            T v(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_MEMBER_FORWARD, _));            \
-            *p = boost::move(v);                                                 \
-            used_ = true;                                                              \
-         }                                                                             \
-      }                                                                                \
-                                                                                       \
-      virtual void uninitialized_copy_all_to(Iterator p)                               \
-      {                                                                                \
-         if(!used_){                                                                   \
-            new(containers_detail::get_pointer(&*p))T                                             \
-               (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_MEMBER_FORWARD, _));            \
-            used_ = true;                                                              \
-         }                                                                             \
-      }                                                                                \
-                                                                                       \
-      virtual void uninitialized_copy_some_and_update                                  \
-         (Iterator p, difference_type division_count, bool first_n)                    \
-      {                                                                                \
-         BOOST_ASSERT(division_count <=1);                                                   \
-         if((first_n && division_count == 1) || (!first_n && division_count == 0)){    \
-            if(!used_){                                                                \
-               new(containers_detail::get_pointer(&*p))T                                          \
-                  (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_MEMBER_FORWARD, _));         \
-               used_ = true;                                                           \
-            }                                                                          \
-         }                                                                             \
-      }                                                                                \
-                                                                                       \
-      virtual void copy_some_and_update                                                \
-         (Iterator p, difference_type division_count, bool first_n)                    \
-      {                                                                                \
-         BOOST_ASSERT(division_count <=1);                                                   \
-         if((first_n && division_count == 1) || (!first_n && division_count == 0)){    \
-            if(!used_){                                                                \
-               T v(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_MEMBER_FORWARD, _));         \
-               *p = boost::move(v);                                              \
-               used_ = true;                                                           \
-            }                                                                          \
-         }                                                                             \
-      }                                                                                \
-                                                                                       \
-      bool used_;                                                                      \
-      BOOST_PP_REPEAT(n, BOOST_CONTAINERS_AUX_PARAM_DEFINE, _)                       \
-   };                                                                                  \
+#define BOOST_PP_LOCAL_MACRO(n)                                                     \
+template        \
+struct BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_non_movable_emplace, n), arg)  \
+   :  public advanced_insert_aux_int                                      \
+{                                                                                   \
+   typedef boost::container::allocator_traits alloc_traits;                      \
+   typedef typename allocator_traits::size_type size_type;                       \
+   typedef typename allocator_traits::value_type value_type;                     \
+   typedef typename advanced_insert_aux_int::difference_type              \
+      difference_type;                                                              \
+                                                                                    \
+   BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_non_movable_emplace, n), arg)      \
+      ( A &a BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _) )          \
+      : a_(a)                                                                       \
+      , used_(false)                                                                \
+      BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_INIT, _)                   \
+    {}                                                                              \
+                                                                                    \
+   virtual void copy_remaining_to(Iterator)                                         \
+   {  BOOST_ASSERT(false);   }                                                      \
+                                                                                    \
+   virtual void uninitialized_copy_remaining_to(Iterator p)                         \
+   {                                                                                \
+      if(!used_){                                                                   \
+         alloc_traits::construct                                                    \
+            ( a_                                                                    \
+            , container_detail::to_raw_pointer(&*p)                                 \
+            BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)         \
+            );                                                                      \
+         used_ = true;                                                              \
+      }                                                                             \
+   }                                                                                \
+                                                                                    \
+   virtual void uninitialized_copy_some_and_update                                  \
+      (Iterator p, difference_type division_count, bool first_n)                    \
+   {                                                                                \
+      BOOST_ASSERT(division_count <=1);                                             \
+      if((first_n && division_count == 1) || (!first_n && division_count == 0)){    \
+         if(!used_){                                                                \
+            alloc_traits::construct                                                 \
+               ( a_                                                                 \
+               , container_detail::to_raw_pointer(&*p)                              \
+               BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)      \
+               );                                                                   \
+            used_ = true;                                                           \
+         }                                                                          \
+      }                                                                             \
+   }                                                                                \
+                                                                                    \
+   virtual void copy_some_and_update(Iterator, difference_type, bool)               \
+   {  BOOST_ASSERT(false);   }                                                      \
+                                                                                    \
+   A &a_;                                                                           \
+   bool used_;                                                                      \
+   BOOST_PP_REPEAT(n, BOOST_CONTAINER_PP_PARAM_DEFINE, _)                           \
+};                                                                                  \
+                                                                                    \
+template        \
+struct BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)              \
+   : BOOST_PP_CAT(BOOST_PP_CAT(                                                     \
+      advanced_insert_aux_non_movable_emplace, n), arg)                             \
+         < A, Iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P) >                        \
+{                                                                                   \
+   typedef BOOST_PP_CAT(BOOST_PP_CAT(                                               \
+      advanced_insert_aux_non_movable_emplace, n), arg)                             \
+          base_t;                 \
+   typedef typename base_t::value_type       value_type;                            \
+   typedef typename base_t::difference_type  difference_type;                       \
+                                                                                    \
+   BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)                  \
+      ( A &a BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _) )          \
+      : base_t(a BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) )   \
+    {}                                                                              \
+                                                                                    \
+   virtual void copy_remaining_to(Iterator p)                                       \
+   {                                                                                \
+      if(!this->used_){                                                             \
+         value_type v BOOST_PP_LPAREN_IF(n)                                         \
+            BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)                  \
+            BOOST_PP_RPAREN_IF(n);                                                  \
+         *p = boost::move(v);                                                       \
+         this->used_ = true;                                                        \
+      }                                                                             \
+   }                                                                                \
+                                                                                    \
+   virtual void copy_some_and_update                                                \
+      (Iterator p, difference_type division_count, bool first_n)                    \
+   {                                                                                \
+      BOOST_ASSERT(division_count <=1);                                             \
+      if((first_n && division_count == 1) || (!first_n && division_count == 0)){    \
+         if(!this->used_){                                                          \
+            value_type v BOOST_PP_LPAREN_IF(n)                                      \
+                  BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)            \
+                BOOST_PP_RPAREN_IF(n);                                              \
+            *p = boost::move(v);                                                    \
+            this->used_ = true;                                                     \
+         }                                                                          \
+      }                                                                             \
+   }                                                                                \
+};                                                                                  \
 //!
 
-#define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
 #include BOOST_PP_LOCAL_ITERATE()
 
-}}}   //namespace boost { namespace container { namespace containers_detail {
+}}}   //namespace boost { namespace container { namespace container_detail {
 
-#endif   //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+#endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
 #include 
 
-#endif //#ifndef BOOST_CONTAINERS_ADVANCED_INSERT_INT_HPP
+#endif //#ifndef BOOST_CONTAINER_ADVANCED_INSERT_INT_HPP
diff --git a/include/boost/container/detail/algorithms.hpp b/include/boost/container/detail/algorithms.hpp
index 677bebe..f0e897c 100644
--- a/include/boost/container/detail/algorithms.hpp
+++ b/include/boost/container/detail/algorithms.hpp
@@ -10,8 +10,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_ALGORITHMS_HPP
-#define BOOST_CONTAINERS_DETAIL_ALGORITHMS_HPP
+#ifndef BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP
+#define BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -23,7 +23,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -33,56 +32,25 @@
 #include 
 
 namespace boost {
-namespace container { 
+namespace container {
 
-#if defined(BOOST_NO_RVALUE_REFERENCES)
-template
-struct has_own_construct_from_it
+template
+inline void construct_in_place(A &a, T* dest, InpIt source)
+{     boost::container::allocator_traits::construct(a, dest, *source);  }
+//#endif
+
+template
+inline void construct_in_place(A &a, T *dest, default_construct_iterator)
 {
-   static const bool value = false;
-};
-
-namespace containers_detail  {
-
-template
-inline void construct_in_place_impl(T* dest, const InpIt &source, containers_detail::true_)
-{
-   T::construct(dest, *source);
+   boost::container::allocator_traits::construct(a, dest);
 }
 
-template
-inline void construct_in_place_impl(T* dest, const InpIt &source, containers_detail::false_)
+template
+inline void construct_in_place(A &a, T *dest, emplace_iterator ei)
 {
-   new((void*)dest)T(*source);
+   ei.construct_in_place(a, dest);
 }
-
-}  //namespace containers_detail   {
-
-template
-inline void construct_in_place(T* dest, InpIt source)
-{
-   typedef containers_detail::bool_::value> boolean_t;
-   containers_detail::construct_in_place_impl(dest, source, boolean_t());
-}
-
-#else
-template
-inline void construct_in_place(T* dest, InpIt source)
-{     ::new((void*)dest)T(*source);   }
-#endif
-
-template
-inline void construct_in_place(T *dest, default_construct_iterator)
-{
-   ::new((void*)dest)T();
-}
-
-template
-inline void construct_in_place(T *dest, emplace_iterator ei)
-{
-   ei.construct_in_place(dest);
-}
-
+/*
 template
 struct optimize_assign
 {
@@ -118,7 +86,7 @@ struct optimize_copy
 {};
 
 template inline
-OutIt copy_n_dispatch(InIt first, typename std::iterator_traits::difference_type length, OutIt dest, containers_detail::bool_)
+OutIt copy_n_dispatch(InIt first, typename std::iterator_traits::difference_type length, OutIt dest, container_detail::bool_)
 {
    for (; length--; ++dest, ++first)
       *dest = *first;
@@ -126,7 +94,7 @@ OutIt copy_n_dispatch(InIt first, typename std::iterator_traits::differenc
 }
 
 template inline
-T *copy_n_dispatch(const T *first, typename std::iterator_traits::difference_type length, T *dest, containers_detail::bool_)
+T *copy_n_dispatch(const T *first, typename std::iterator_traits::difference_type length, T *dest, container_detail::bool_)
 {
    std::size_t size = length*sizeof(T);
    return (static_cast(std::memmove(dest, first, size))) + size;
@@ -136,14 +104,14 @@ template inline
 OutIt copy_n(InIt first, typename std::iterator_traits::difference_type length, OutIt dest)
 {
    const bool do_optimized_assign = optimize_assign::value;
-   return copy_n_dispatch(first, length, dest, containers_detail::bool_());
+   return copy_n_dispatch(first, length, dest, container_detail::bool_());
 }
 
 template inline
 FwdIt uninitialized_copy_n_dispatch
    (InIt first, 
     typename std::iterator_traits::difference_type count,
-    FwdIt dest, containers_detail::bool_)
+    FwdIt dest, container_detail::bool_)
 {
    typedef typename std::iterator_traits::value_type value_type;
    //Save initial destination position
@@ -153,14 +121,14 @@ FwdIt uninitialized_copy_n_dispatch
    BOOST_TRY{
       //Try to build objects
       for (; --new_count; ++dest, ++first){
-         construct_in_place(containers_detail::get_pointer(&*dest), first);
+         construct_in_place(container_detail::to_raw_pointer(&*dest), first);
       }
    }
    BOOST_CATCH(...){
       //Call destructors
       new_count = count - new_count;
       for (; new_count--; ++dest_init){
-         containers_detail::get_pointer(&*dest_init)->~value_type();
+         container_detail::to_raw_pointer(&*dest_init)->~value_type();
       }
       BOOST_RETHROW
    }
@@ -168,7 +136,7 @@ FwdIt uninitialized_copy_n_dispatch
    return dest;
 }
 template inline
-T *uninitialized_copy_n_dispatch(const T *first, typename std::iterator_traits::difference_type length, T *dest, containers_detail::bool_)
+T *uninitialized_copy_n_dispatch(const T *first, typename std::iterator_traits::difference_type length, T *dest, container_detail::bool_)
 {
    std::size_t size = length*sizeof(T);
    return (static_cast(std::memmove(dest, first, size))) + size;
@@ -181,7 +149,7 @@ FwdIt uninitialized_copy_n
     FwdIt dest)
 {
    const bool do_optimized_copy = optimize_copy::value;
-   return uninitialized_copy_n_dispatch(first, count, dest, containers_detail::bool_());
+   return uninitialized_copy_n_dispatch(first, count, dest, container_detail::bool_());
 }
 
 // uninitialized_copy_copy
@@ -199,17 +167,17 @@ FwdIt uninitialized_copy_copy
    }
    BOOST_CATCH(...){
       for(;result != mid; ++result){
-         containers_detail::get_pointer(&*result)->~value_type();
+         container_detail::to_raw_pointer(&*result)->~value_type();
       }
       BOOST_RETHROW
    }
    BOOST_CATCH_END
 }
-
+*/
 }  //namespace container { 
 }  //namespace boost {
 
 #include 
 
-#endif   //#ifndef BOOST_CONTAINERS_DETAIL_ALGORITHMS_HPP
+#endif   //#ifndef BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP
 
diff --git a/include/boost/container/detail/allocation_type.hpp b/include/boost/container/detail/allocation_type.hpp
index b479cff..edad487 100644
--- a/include/boost/container/detail/allocation_type.hpp
+++ b/include/boost/container/detail/allocation_type.hpp
@@ -8,8 +8,8 @@
 //
 ///////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_ALLOCATION_TYPE_HPP
-#define BOOST_CONTAINERS_ALLOCATION_TYPE_HPP
+#ifndef BOOST_CONTAINER_ALLOCATION_TYPE_HPP
+#define BOOST_CONTAINER_ALLOCATION_TYPE_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -51,4 +51,4 @@ static const allocation_type zero_memory        = (allocation_type)zero_memory_v
 
 #include 
 
-#endif   //BOOST_CONTAINERS_ALLOCATION_TYPE_HPP
+#endif   //BOOST_CONTAINER_ALLOCATION_TYPE_HPP
diff --git a/include/boost/container/detail/config_begin.hpp b/include/boost/container/detail/config_begin.hpp
index 4be21ff..bd44daa 100644
--- a/include/boost/container/detail/config_begin.hpp
+++ b/include/boost/container/detail/config_begin.hpp
@@ -7,15 +7,15 @@
 // See http://www.boost.org/libs/container for documentation.
 //
 //////////////////////////////////////////////////////////////////////////////
-#ifndef BOOST_CONTAINERS_CONTAINER_DETAIL_CONFIG_INCLUDED
-#define BOOST_CONTAINERS_CONTAINER_DETAIL_CONFIG_INCLUDED
+#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED
+#define BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED
 #include 
 
-#endif   //BOOST_CONTAINERS_CONTAINER_DETAIL_CONFIG_INCLUDED
+#endif   //BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED
 
 #ifdef BOOST_MSVC
    #ifndef _CRT_SECURE_NO_DEPRECATE
-   #define  BOOST_CONTAINERS_DETAIL_CRT_SECURE_NO_DEPRECATE
+   #define  BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE
    #define _CRT_SECURE_NO_DEPRECATE
    #endif
    #pragma warning (push)
diff --git a/include/boost/container/detail/config_end.hpp b/include/boost/container/detail/config_end.hpp
index 4713a66..b71fabc 100644
--- a/include/boost/container/detail/config_end.hpp
+++ b/include/boost/container/detail/config_end.hpp
@@ -9,8 +9,8 @@
 //////////////////////////////////////////////////////////////////////////////
 #if defined BOOST_MSVC
    #pragma warning (pop)
-   #ifdef BOOST_CONTAINERS_DETAIL_CRT_SECURE_NO_DEPRECATE
-   #undef BOOST_CONTAINERS_DETAIL_CRT_SECURE_NO_DEPRECATE
+   #ifdef BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE
+   #undef BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE
    #undef _CRT_SECURE_NO_DEPRECATE
    #endif
 #endif
diff --git a/include/boost/container/detail/destroyers.hpp b/include/boost/container/detail/destroyers.hpp
index 22fcf76..26ae089 100644
--- a/include/boost/container/detail/destroyers.hpp
+++ b/include/boost/container/detail/destroyers.hpp
@@ -10,8 +10,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DESTROYERS_HPP
-#define BOOST_CONTAINERS_DESTROYERS_HPP
+#ifndef BOOST_CONTAINER_DESTROYERS_HPP
+#define BOOST_CONTAINER_DESTROYERS_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -21,18 +21,20 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace boost {
 namespace container { 
-namespace containers_detail {
+namespace container_detail {
 
 //!A deleter for scoped_ptr that deallocates the memory
 //!allocated for an array of objects using a STL allocator.
 template 
 struct scoped_array_deallocator
 {
-   typedef typename Allocator::pointer    pointer;
-   typedef typename Allocator::size_type  size_type;
+   typedef boost::container::allocator_traits AllocTraits;
+   typedef typename AllocTraits::pointer    pointer;
+   typedef typename AllocTraits::size_type  size_type;
 
    scoped_array_deallocator(pointer p, Allocator& a, size_type length)
       : m_ptr(p), m_alloc(a), m_length(length) {}
@@ -52,8 +54,9 @@ struct scoped_array_deallocator
 template 
 struct null_scoped_array_deallocator
 {
-   typedef typename Allocator::pointer    pointer;
-   typedef typename Allocator::size_type  size_type;
+   typedef boost::container::allocator_traits AllocTraits;
+   typedef typename AllocTraits::pointer    pointer;
+   typedef typename AllocTraits::size_type  size_type;
 
    null_scoped_array_deallocator(pointer, Allocator&, size_type)
    {}
@@ -68,15 +71,13 @@ struct null_scoped_array_deallocator
 template 
 struct scoped_destructor_n
 {
-   typedef typename Allocator::pointer    pointer;
-   typedef typename Allocator::value_type value_type;
-   typedef typename Allocator::size_type  size_type;
+   typedef boost::container::allocator_traits AllocTraits;
+   typedef typename AllocTraits::pointer    pointer;
+   typedef typename AllocTraits::value_type value_type;
+   typedef typename AllocTraits::size_type  size_type;
 
-   pointer     m_p;
-   size_type   m_n;
-
-   scoped_destructor_n(pointer p, size_type n)
-      : m_p(p), m_n(n)
+   scoped_destructor_n(pointer p, Allocator& a, size_type n)
+      : m_p(p), m_a(a), m_n(n)
    {}
 
    void release()
@@ -88,10 +89,15 @@ struct scoped_destructor_n
    ~scoped_destructor_n()
    {
       if(!m_p) return;
-      value_type *raw_ptr = containers_detail::get_pointer(m_p);
+      value_type *raw_ptr = container_detail::to_raw_pointer(m_p);
       for(size_type i = 0; i < m_n; ++i, ++raw_ptr)
-         raw_ptr->~value_type();
+         AllocTraits::destroy(m_a, raw_ptr);
    }
+
+   private:
+   pointer     m_p;
+   Allocator & m_a;
+   size_type   m_n;
 };
 
 //!A deleter for scoped_ptr that destroys
@@ -99,10 +105,11 @@ struct scoped_destructor_n
 template 
 struct null_scoped_destructor_n
 {
-   typedef typename Allocator::pointer pointer;
-   typedef typename Allocator::size_type size_type;
+   typedef boost::container::allocator_traits AllocTraits;
+   typedef typename AllocTraits::pointer pointer;
+   typedef typename AllocTraits::size_type size_type;
 
-   null_scoped_destructor_n(pointer, size_type)
+   null_scoped_destructor_n(pointer, Allocator&, size_type)
    {}
 
    void increment_size(size_type)
@@ -112,43 +119,45 @@ struct null_scoped_destructor_n
    {}
 };
 
-template 
+template 
 class allocator_destroyer
 {
-   typedef typename A::value_type value_type;
-   typedef containers_detail::integral_constant::value>                           alloc_version;
-   typedef containers_detail::integral_constant     allocator_v1;
-   typedef containers_detail::integral_constant     allocator_v2;
+   typedef boost::container::allocator_traits AllocTraits;
+   typedef typename AllocTraits::value_type value_type;
+   typedef typename AllocTraits::pointer    pointer;
+   typedef container_detail::integral_constant::value>                           alloc_version;
+   typedef container_detail::integral_constant  allocator_v1;
+   typedef container_detail::integral_constant  allocator_v2;
 
    private:
-   A & a_;
+   Allocator & a_;
 
    private:
-   void priv_deallocate(const typename A::pointer &p, allocator_v1)
-   {  a_.deallocate(p, 1); }
+   void priv_deallocate(const pointer &p, allocator_v1)
+   {  AllocTraits::deallocate(a_,p, 1); }
 
-   void priv_deallocate(const typename A::pointer &p, allocator_v2)
+   void priv_deallocate(const pointer &p, allocator_v2)
    {  a_.deallocate_one(p); }
 
    public:
-   allocator_destroyer(A &a)
-      :  a_(a)
+   allocator_destroyer(Allocator &a)
+      : a_(a)
    {}
 
-   void operator()(const typename A::pointer &p)
-   {  
-      containers_detail::get_pointer(p)->~value_type();
+   void operator()(const pointer &p)
+   {
+      AllocTraits::destroy(a_, container_detail::to_raw_pointer(p));
       priv_deallocate(p, alloc_version());
    }
 };
 
 
-}  //namespace containers_detail { 
+}  //namespace container_detail { 
 }  //namespace container { 
 }  //namespace boost {
 
 #include 
 
-#endif   //#ifndef BOOST_CONTAINERS_DESTROYERS_HPP
+#endif   //#ifndef BOOST_CONTAINER_DESTROYERS_HPP
diff --git a/include/boost/container/detail/flat_tree.hpp b/include/boost/container/detail/flat_tree.hpp
index 7cbc175..9ad5c0d 100644
--- a/include/boost/container/detail/flat_tree.hpp
+++ b/include/boost/container/detail/flat_tree.hpp
@@ -8,8 +8,8 @@
 //
 ////////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_FLAT_TREE_HPP
-#define BOOST_CONTAINERS_FLAT_TREE_HPP
+#ifndef BOOST_CONTAINER_FLAT_TREE_HPP
+#define BOOST_CONTAINER_FLAT_TREE_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -37,7 +37,7 @@ namespace boost {
 
 namespace container {
 
-namespace containers_detail {
+namespace container_detail {
 
 template
 class flat_tree_value_compare
@@ -47,6 +47,10 @@ class flat_tree_value_compare
    typedef Value              second_argument_type;
    typedef bool               return_type;
    public:     
+   flat_tree_value_compare()
+      : Compare()
+   {}
+
    flat_tree_value_compare(const Compare &pred) 
       : Compare(pred)
    {}
@@ -67,9 +71,9 @@ class flat_tree_value_compare
 template
 struct get_flat_tree_iterators
 {
-   typedef typename containers_detail::
+   typedef typename container_detail::
       vector_iterator                        iterator;
-   typedef typename containers_detail::
+   typedef typename container_detail::
       vector_const_iterator                  const_iterator;
    typedef std::reverse_iterator            reverse_iterator;
    typedef std::reverse_iterator      const_reverse_iterator;
@@ -90,23 +94,29 @@ class flat_tree
       //Inherit from value_compare to do EBO
       : public value_compare
    {
-      private:
       BOOST_COPYABLE_AND_MOVABLE(Data)
+
       public:
+      Data()
+         : value_compare(), m_vect()
+      {}
+
       Data(const Data &d)
          : value_compare(d), m_vect(d.m_vect)
       {}
-      Data(const Compare &comp,
-           const vector_t &vect) 
-         : value_compare(comp), m_vect(vect){}
 
-      Data(const value_compare &comp,
-           const vector_t &vect) 
-         : value_compare(comp), m_vect(vect){}
+      Data(BOOST_RV_REF(Data) d)
+         : value_compare(boost::move(d)), m_vect(boost::move(d.m_vect))
+      {}
+
+      Data(const Compare &comp) 
+         : value_compare(comp), m_vect()
+      {}
 
       Data(const Compare &comp,
            const allocator_t &alloc) 
-         : value_compare(comp), m_vect(alloc){}
+         : value_compare(comp), m_vect(alloc)
+      {}
 
       Data& operator=(BOOST_COPY_ASSIGN_REF(Data) d)
       {
@@ -122,6 +132,13 @@ class flat_tree
          return *this;
       }
 
+      void swap(Data &d)
+      {
+         value_compare& mycomp    = *this, & othercomp = d;
+         container_detail::do_swap(mycomp, othercomp);
+         this->m_vect.swap(d.m_vect);
+      }
+
       vector_t m_vect;
    };
 
@@ -138,23 +155,30 @@ class flat_tree
    typedef Key                                        key_type;
    typedef Compare                                    key_compare;
    typedef typename vector_t::allocator_type          allocator_type;
-   typedef allocator_type                             stored_allocator_type;
-   typedef typename allocator_type::size_type         size_type;
-   typedef typename allocator_type::difference_type   difference_type;
+   typedef typename vector_t::size_type               size_type;
+   typedef typename vector_t::difference_type         difference_type;
    typedef typename vector_t::iterator                iterator;
    typedef typename vector_t::const_iterator          const_iterator;
-   typedef std::reverse_iterator            reverse_iterator;
-   typedef std::reverse_iterator      const_reverse_iterator;
-   
+   typedef typename vector_t::reverse_iterator        reverse_iterator;
+   typedef typename vector_t::const_reverse_iterator  const_reverse_iterator;
 
-   // allocation/deallocation
-   flat_tree(const Compare& comp     = Compare(), 
-             const allocator_type& a = allocator_type())
+   //!Standard extension
+   typedef allocator_type                             stored_allocator_type;
+
+   flat_tree()
+      : m_data()
+   { }
+
+   explicit flat_tree(const Compare& comp)
+      : m_data(comp)
+   { }
+
+   flat_tree(const Compare& comp, const allocator_type& a)
       : m_data(comp, a)
    { }
 
    flat_tree(const flat_tree& x) 
-      :  m_data(x.m_data, x.m_data.m_vect)
+      :  m_data(x.m_data)
    { }
 
    flat_tree(BOOST_RV_REF(flat_tree) x)
@@ -237,14 +261,7 @@ class flat_tree
    { return this->m_data.m_vect.max_size(); }
 
    void swap(flat_tree& other) 
-   {
-      value_compare& mycomp    = this->m_data;
-      value_compare& othercomp = other.m_data;
-      containers_detail::do_swap(mycomp, othercomp);
-      vector_t & myvect    = this->m_data.m_vect;
-      vector_t & othervect = other.m_data.m_vect;
-      myvect.swap(othervect);
-   }
+   {  this->m_data.swap(other.m_data);  }
 
    public:
    // insert/erase
@@ -332,7 +349,7 @@ class flat_tree
       priv_insert_equal(first, last, ItCat());
    }
 
-   #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    template 
    iterator emplace_unique(Args&&... args)
@@ -377,100 +394,69 @@ class flat_tree
       return priv_insert_commit(data, boost::move(val));
    }
 
-   #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
-   iterator emplace_unique()
-   {
-      containers_detail::value_init vval;
-      value_type &val = vval.m_t;
-      insert_commit_data data;
-      std::pair ret =
-         priv_insert_unique_prepare(val, data);
-      if(ret.second){
-         ret.first = priv_insert_commit(data, boost::move(val));
-      }
-      return ret.first;
-   }
-
-   iterator emplace_hint_unique(const_iterator hint)
-   {
-      containers_detail::value_init vval;
-      value_type &val = vval.m_t;
-      insert_commit_data data;
-      std::pair ret = priv_insert_unique_prepare(hint, val, data);
-      if(ret.second){
-         ret.first = priv_insert_commit(data, boost::move(val));
-      }
-      return ret.first;
-   }
-
-   iterator emplace_equal()
-   {
-      containers_detail::value_init vval;
-      value_type &val = vval.m_t;
-      iterator i = this->upper_bound(KeyOfValue()(val));
-      i = this->m_data.m_vect.insert(i, boost::move(val));
-      return i;
-   }
-
-   iterator emplace_hint_equal(const_iterator hint)
-   {
-      containers_detail::value_init vval;
-      value_type &val = vval.m_t;
-      insert_commit_data data;
-      priv_insert_equal_prepare(hint, val, data);
-      return priv_insert_commit(data, boost::move(val));
-   }
+   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    #define BOOST_PP_LOCAL_MACRO(n)                                                        \
-   template                                             \
-   iterator emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))         \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+   iterator emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))           \
    {                                                                                      \
-      value_type val(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));           \
+      BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type        \
+         BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n)                  \
+            BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n); \
+      value_type &val = vval;                                                             \
       insert_commit_data data;                                                            \
       std::pair ret = priv_insert_unique_prepare(val, data);               \
       if(ret.second){                                                                     \
-         ret.first = priv_insert_commit(data, boost::move(val)); \
+         ret.first = priv_insert_commit(data, boost::move(val));                          \
       }                                                                                   \
       return ret.first;                                                                   \
    }                                                                                      \
                                                                                           \
-   template                                             \
-   iterator emplace_hint_unique(const_iterator hint,                                      \
-      BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                              \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+   iterator emplace_hint_unique(const_iterator hint                                       \
+                        BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))     \
    {                                                                                      \
-      value_type val(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));           \
+      BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type        \
+         BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n)                  \
+            BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n); \
+      value_type &val = vval;                                                             \
       insert_commit_data data;                                                            \
       std::pair ret = priv_insert_unique_prepare(hint, val, data);         \
       if(ret.second){                                                                     \
-         ret.first = priv_insert_commit(data, boost::move(val));        \
+         ret.first = priv_insert_commit(data, boost::move(val));                          \
       }                                                                                   \
       return ret.first;                                                                   \
    }                                                                                      \
                                                                                           \
-   template                                             \
-   iterator emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))          \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+   iterator emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))            \
    {                                                                                      \
-      value_type val(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));           \
+      BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type        \
+         BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n)                  \
+            BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n); \
+      value_type &val = vval;                                                             \
       iterator i = this->upper_bound(KeyOfValue()(val));                                  \
-      i = this->m_data.m_vect.insert(i, boost::move(val));       \
+      i = this->m_data.m_vect.insert(i, boost::move(val));                                \
       return i;                                                                           \
    }                                                                                      \
                                                                                           \
-   template                                             \
-   iterator emplace_hint_equal(const_iterator hint,                                       \
-      BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                              \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+   iterator emplace_hint_equal(const_iterator hint                                        \
+                      BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))       \
    {                                                                                      \
-      value_type val(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));           \
+      BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type        \
+         BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n)                  \
+            BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n); \
+      value_type &val = vval;                                                             \
       insert_commit_data data;                                                            \
       priv_insert_equal_prepare(hint, val, data);                                         \
-      return priv_insert_commit(data, boost::move(val));                \
+      return priv_insert_commit(data, boost::move(val));                                  \
    }                                                                                      \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif   //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    iterator erase(const_iterator position)
    {  return this->m_data.m_vect.erase(position);  }
@@ -571,8 +557,6 @@ class flat_tree
       //         insert val before pos
       //      else
       //         insert val before upper_bound(val)
-      //   else if pos+1 == end || val <= *(pos+1)
-      //      insert val after pos
       //   else
       //      insert val before lower_bound(val)
       const value_compare &value_comp = this->m_data;
@@ -586,10 +570,6 @@ class flat_tree
                this->priv_upper_bound(this->cbegin(), pos, KeyOfValue()(val));
          }
       }
-      //Works, but increases code complexity
-      //else if (++pos == this->end() || !value_comp(*pos, val)){
-      //   return this->m_data.m_vect.insert(pos, val);
-      //}
       else{
          data.position = 
             this->priv_lower_bound(pos, this->cend(), KeyOfValue()(val));
@@ -838,7 +818,7 @@ swap(flat_tree& x,
      flat_tree& y)
    {  x.swap(y);  }
 
-}  //namespace containers_detail {
+}  //namespace container_detail {
 
 }  //namespace container {
 /*
@@ -846,7 +826,7 @@ swap(flat_tree& x,
 //!specialization for optimizations
 template 
-struct has_trivial_destructor_after_move >
+struct has_trivial_destructor_after_move >
 {
    static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
 };
@@ -855,4 +835,4 @@ struct has_trivial_destructor_after_move
 
-#endif // BOOST_CONTAINERS_FLAT_TREE_HPP
+#endif // BOOST_CONTAINER_FLAT_TREE_HPP
diff --git a/include/boost/container/detail/function_detector.hpp b/include/boost/container/detail/function_detector.hpp
new file mode 100644
index 0000000..c37c766
--- /dev/null
+++ b/include/boost/container/detail/function_detector.hpp
@@ -0,0 +1,88 @@
+/////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga  2009-2011.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/container for documentation.
+//
+/////////////////////////////////////////////////////////////////////////////
+//  This code was modified from the code posted by Alexandre Courpron in his
+//  article "Interface Detection" in The Code Project:
+//  http://www.codeproject.com/KB/architecture/Detector.aspx
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2007 Alexandre Courpron
+//
+// Permission to use, copy, modify, redistribute and sell this software, 
+// provided that this copyright notice appears on all copies of the software.
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONTAINER_DETAIL_FUNCTION_DETECTOR_HPP
+#define BOOST_CONTAINER_DETAIL_FUNCTION_DETECTOR_HPP
+
+#include 
+
+namespace boost {
+namespace container {
+namespace function_detector {
+
+    typedef char NotFoundType;
+    struct StaticFunctionType { NotFoundType x [2]; };
+    struct NonStaticFunctionType { NotFoundType x [3]; };
+
+    enum
+         { NotFound          = 0,
+           StaticFunction    = sizeof( StaticFunctionType )    - sizeof( NotFoundType ),
+           NonStaticFunction = sizeof( NonStaticFunctionType ) - sizeof( NotFoundType )
+         };
+
+}  //namespace boost {
+}  //namespace container {
+}  //namespace function_detector {
+
+#define BOOST_CONTAINER_CREATE_FUNCTION_DETECTOR(Identifier, InstantiationKey) \
+   namespace boost { \
+   namespace container { \
+   namespace function_detector { \
+   template < class T, \
+            class NonStaticType, \
+            class NonStaticConstType, \
+            class StaticType > \
+   class DetectMember_##InstantiationKey_##Identifier { \
+      template < NonStaticType > \
+      struct TestNonStaticNonConst ; \
+      \
+      template < NonStaticConstType > \
+      struct TestNonStaticConst ; \
+      \
+      template < StaticType > \
+      struct TestStatic ; \
+      \
+      template  \
+      static NonStaticFunctionType Test( TestNonStaticNonConst<&U::Identifier>*, int ); \
+      \
+      template  \
+      static NonStaticFunctionType Test( TestNonStaticConst<&U::Identifier>*, int ); \
+      \
+      template  \
+      static StaticFunctionType Test( TestStatic<&U::Identifier>*, int ); \
+      \
+      template  \
+      static NotFoundType Test( ... ); \
+   public : \
+      static const int check = NotFound + (sizeof(Test(0, 0)) - sizeof(NotFoundType));\
+   };\
+}}} //namespace boost::container::function_detector { 
+
+#define BOOST_CONTAINER_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \
+    ::boost::container::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\
+                                         ReturnType (Class::*)Params,\
+                                         ReturnType (Class::*)Params const,\
+                                         ReturnType (*)Params \
+                                       >::check
+
+#include 
+
+#endif   //@ifndef BOOST_CONTAINER_DETAIL_FUNCTION_DETECTOR_HPP
diff --git a/include/boost/container/detail/iterators.hpp b/include/boost/container/detail/iterators.hpp
index a83b472..899cbe4 100644
--- a/include/boost/container/detail/iterators.hpp
+++ b/include/boost/container/detail/iterators.hpp
@@ -11,8 +11,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_ITERATORS_HPP
-#define BOOST_CONTAINERS_DETAIL_ITERATORS_HPP
+#ifndef BOOST_CONTAINER_DETAIL_ITERATORS_HPP
+#define BOOST_CONTAINER_DETAIL_ITERATORS_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -21,8 +21,9 @@
 #include "config_begin.hpp"
 #include 
 #include 
+#include 
 
-#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 #include 
 #include 
 #else
@@ -368,7 +369,7 @@ class repeat_iterator
    {  return m_num - other.m_num;   }
 };
 
-template 
+template 
 class emplace_iterator
   : public std::iterator
       
@@ -377,7 +378,7 @@ class emplace_iterator
 
    public:
    typedef Difference difference_type;
-   explicit emplace_iterator(E&e)
+   explicit emplace_iterator(EmplaceFunctor&e)
       :  m_num(1), m_pe(&e){}
 
    emplace_iterator()
@@ -453,12 +454,13 @@ class emplace_iterator
    const T* operator->() const
    { return &(dereference()); }
 
-   void construct_in_place(T* ptr)
-   {  (*m_pe)(ptr);  }
+   template
+   void construct_in_place(A &a, T* ptr)
+   {  (*m_pe)(a, ptr);  }
 
    private:
    difference_type m_num;
-   E *            m_pe;
+   EmplaceFunctor *            m_pe;
 
    void increment()
    { --m_num; }
@@ -485,54 +487,54 @@ class emplace_iterator
    {  return difference_type(m_num - other.m_num);   }
 };
 
-#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
-template
+template
 struct emplace_functor
 {
-   typedef typename containers_detail::build_number_seq::type index_tuple_t;
+   typedef typename container_detail::build_number_seq::type index_tuple_t;
 
    emplace_functor(Args&&... args)
       : args_(args...)
    {}
 
-   void operator()(T *ptr)
-   {  emplace_functor::inplace_impl(ptr, index_tuple_t());  }
+   template
+   void operator()(A &a, T *ptr)
+   {  emplace_functor::inplace_impl(a, ptr, index_tuple_t());  }
 
-   template
-   void inplace_impl(T* ptr, const containers_detail::index_tuple&)
-   {  ::new(ptr) T(containers_detail::stored_ref::forward(containers_detail::get(args_))...); }
+   template
+   void inplace_impl(A &a, T* ptr, const container_detail::index_tuple&)
+   {
+      allocator_traits::construct
+         (a, ptr, container_detail::stored_ref::forward
+          (container_detail::get(args_))...);
+   }
 
-   containers_detail::tuple args_;
+   container_detail::tuple args_;
 };
 
 #else
 
-template
-struct emplace_functor
-{
-   emplace_functor()
-   {}
-   void operator()(T *ptr)
-   {  new(ptr) T();  }
-};
-
 #define BOOST_PP_LOCAL_MACRO(n)                                                        \
-   template                                \
+   BOOST_PP_EXPR_IF(n, template <)                                                     \
+      BOOST_PP_ENUM_PARAMS(n, class P)                                                 \
+         BOOST_PP_EXPR_IF(n, >)                                                        \
    struct BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg)                          \
    {                                                                                   \
       BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg)                              \
-         ( BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _) )                       \
-      :  BOOST_PP_ENUM(n, BOOST_CONTAINERS_AUX_PARAM_INIT, _) {}                       \
+         ( BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _) )                       \
+      BOOST_PP_EXPR_IF(n, :) BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_INIT, _){}    \
                                                                                        \
-      void operator()(T *ptr)                                                          \
+      template                                                       \
+      void operator()(A &a, T *ptr)                                                    \
       {                                                                                \
-         new(ptr)T (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_MEMBER_FORWARD, _));          \
+         allocator_traits::construct                                                \
+            (a, ptr BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _) );\
       }                                                                                \
-      BOOST_PP_REPEAT(n, BOOST_CONTAINERS_AUX_PARAM_DEFINE, _)                         \
+      BOOST_PP_REPEAT(n, BOOST_CONTAINER_PP_PARAM_DEFINE, _)                         \
    };                                                                                  \
    //!
-#define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
 #include BOOST_PP_LOCAL_ITERATE()
 
 #endif
@@ -542,5 +544,5 @@ struct emplace_functor
 
 #include 
 
-#endif   //#ifndef BOOST_CONTAINERS_DETAIL_ITERATORS_HPP
+#endif   //#ifndef BOOST_CONTAINER_DETAIL_ITERATORS_HPP
 
diff --git a/include/boost/container/detail/math_functions.hpp b/include/boost/container/detail/math_functions.hpp
index c7c443c..4613573 100644
--- a/include/boost/container/detail/math_functions.hpp
+++ b/include/boost/container/detail/math_functions.hpp
@@ -22,7 +22,7 @@
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 // Greatest common divisor and least common multiple
 
@@ -104,7 +104,7 @@ inline std::size_t floor_log2 (std::size_t x)
    return log2;
 }
 
-} // namespace containers_detail
+} // namespace container_detail
 } // namespace container
 } // namespace boost
 
diff --git a/include/boost/container/detail/mpl.hpp b/include/boost/container/detail/mpl.hpp
index d0741fa..e2ebcf7 100644
--- a/include/boost/container/detail/mpl.hpp
+++ b/include/boost/container/detail/mpl.hpp
@@ -10,8 +10,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_CONTAINER_DETAIL_MPL_HPP
-#define BOOST_CONTAINERS_CONTAINER_DETAIL_MPL_HPP
+#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
+#define BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -21,7 +21,7 @@
 
 namespace boost {
 namespace container { 
-namespace containers_detail {
+namespace container_detail {
 
 template 
 struct integral_constant
@@ -34,6 +34,7 @@ template< bool C_ >
 struct bool_ : integral_constant
 {
    static const bool value = C_;
+   operator bool() const { return bool_::value; }
 };
 
 typedef bool_        true_;
@@ -147,9 +148,9 @@ struct ls_zeros<1>
    static const std::size_t value = 0;
 };
 
-}  //namespace containers_detail { 
+}  //namespace container_detail { 
 }  //namespace container { 
 }  //namespace boost {
 
-#endif   //#ifndef BOOST_CONTAINERS_CONTAINER_DETAIL_MPL_HPP
+#endif   //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
 
diff --git a/include/boost/container/detail/multiallocation_chain.hpp b/include/boost/container/detail/multiallocation_chain.hpp
index 52e0cb7..a67fd77 100644
--- a/include/boost/container/detail/multiallocation_chain.hpp
+++ b/include/boost/container/detail/multiallocation_chain.hpp
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_MULTIALLOCATION_CHAIN_HPP
-#define BOOST_CONTAINERS_DETAIL_MULTIALLOCATION_CHAIN_HPP
+#ifndef BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP
+#define BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP
 
 #include "config_begin.hpp"
 #include 
@@ -17,13 +17,13 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 template
 class basic_multiallocation_chain
@@ -33,8 +33,10 @@ class basic_multiallocation_chain
                         ,bi::link_mode
                         > node;
 
-   typedef typename boost::pointer_to_other::type   char_ptr;
-   typedef typename std::iterator_traits::difference_type    difference_type;
+   typedef typename boost::intrusive::pointer_traits
+      ::template rebind_pointer::type    char_ptr;
+   typedef typename boost::intrusive::
+      pointer_traits::difference_type             difference_type;
 
    typedef bi::slist< node
                     , bi::linear
@@ -44,7 +46,7 @@ class basic_multiallocation_chain
    slist_impl_t slist_impl_;
 
    static node & to_node(VoidPointer p)
-   {  return *static_cast(static_cast(containers_detail::get_pointer(p))); }
+   {  return *static_cast(static_cast(container_detail::to_raw_pointer(p))); }
 
    BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain)
 
@@ -140,7 +142,7 @@ class basic_multiallocation_chain
 template
 struct cast_functor
 {
-   typedef typename containers_detail::add_reference::type result_type;
+   typedef typename container_detail::add_reference::type result_type;
    template
    result_type operator()(U &ptr) const
    {  return *static_cast(static_cast(&ptr));  }
@@ -154,18 +156,18 @@ class transform_multiallocation_chain
 
    MultiallocationChain   holder_;
    typedef typename MultiallocationChain::void_pointer   void_pointer;
-   typedef typename boost::pointer_to_other
-      ::type                            pointer;
+   typedef typename boost::intrusive::pointer_traits
+      ::template rebind_pointer::type   pointer;
 
    static pointer cast(void_pointer p)
    {
-      return pointer(static_cast(containers_detail::get_pointer(p)));
+      return pointer(static_cast(container_detail::to_raw_pointer(p)));
    }
 
    public:
    typedef transform_iterator
       < typename MultiallocationChain::iterator
-      , containers_detail::cast_functor  >                 iterator;
+      , container_detail::cast_functor  >                 iterator;
    typedef typename MultiallocationChain::size_type           size_type;
 
    transform_multiallocation_chain()
@@ -243,10 +245,10 @@ class transform_multiallocation_chain
 
 }}}
 
-// namespace containers_detail {
+// namespace container_detail {
 // namespace container {
 // namespace boost {
 
 #include 
 
-#endif   //BOOST_CONTAINERS_DETAIL_MULTIALLOCATION_CHAIN_HPP
+#endif   //BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP
diff --git a/include/boost/container/detail/node_alloc_holder.hpp b/include/boost/container/detail/node_alloc_holder.hpp
index f2e88ef..9b0a0a5 100644
--- a/include/boost/container/detail/node_alloc_holder.hpp
+++ b/include/boost/container/detail/node_alloc_holder.hpp
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_NODE_ALLOC_HPP_
-#define BOOST_CONTAINERS_DETAIL_NODE_ALLOC_HPP_
+#ifndef BOOST_CONTAINER_DETAIL_NODE_ALLOC_HPP_
+#define BOOST_CONTAINER_DETAIL_NODE_ALLOC_HPP_
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -27,10 +27,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
-#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
+#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 #include 
 #endif
 
@@ -39,19 +40,20 @@
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 //!A deleter for scoped_ptr that deallocates the memory
 //!allocated for an object using a STL allocator.
-template 
+template 
 struct scoped_deallocator
 {
-   typedef typename Allocator::pointer pointer;
-   typedef containers_detail::integral_constant::value>                   alloc_version;
-   typedef containers_detail::integral_constant     allocator_v1;
-   typedef containers_detail::integral_constant     allocator_v2;
+   typedef allocator_traits allocator_traits_type;
+   typedef typename allocator_traits_type::pointer pointer;
+   typedef container_detail::integral_constant::value>                   alloc_version;
+   typedef container_detail::integral_constant     allocator_v1;
+   typedef container_detail::integral_constant     allocator_v2;
 
    private:
    void priv_deallocate(allocator_v1)
@@ -65,9 +67,9 @@ struct scoped_deallocator
    public:
 
    pointer     m_ptr;
-   Allocator&  m_alloc;
+   A&  m_alloc;
 
-   scoped_deallocator(pointer p, Allocator& a)
+   scoped_deallocator(pointer p, A& a)
       : m_ptr(p), m_alloc(a)
    {}
 
@@ -88,7 +90,8 @@ struct scoped_deallocator
 template 
 class allocator_destroyer_and_chain_builder
 {
-   typedef typename A::value_type value_type;
+   typedef allocator_traits allocator_traits_type;
+   typedef typename allocator_traits_type::value_type value_type;
    typedef typename A::multiallocation_chain    multiallocation_chain;
 
    A & a_;
@@ -100,17 +103,17 @@ class allocator_destroyer_and_chain_builder
    {}
 
    void operator()(const typename A::pointer &p)
-   {  
-      value_type *vp = containers_detail::get_pointer(p);
-      vp->~value_type();
-      c_.push_front(vp);
+   {
+      allocator_traits::destroy(a_, container_detail::to_raw_pointer(p));
+      c_.push_front(p);
    }
 };
 
 template 
 class allocator_multialloc_chain_node_deallocator
 {
-   typedef typename A::value_type value_type;
+   typedef allocator_traits allocator_traits_type;
+   typedef typename allocator_traits_type::value_type value_type;
    typedef typename A::multiallocation_chain    multiallocation_chain;
    typedef allocator_destroyer_and_chain_builder chain_builder;
 
@@ -132,7 +135,6 @@ class allocator_multialloc_chain_node_deallocator
    }
 };
 
-
 template
 struct node_compare
    :  private ValueCompare
@@ -155,70 +157,90 @@ struct node_compare
    {  return ValueCompare::operator()(a.get_data(), b.get_data());  }
 };
 
-template
+template
 struct node_alloc_holder
 {
-   typedef node_alloc_holder                self_t;
-   typedef typename A::value_type                     value_type;
-   typedef typename ICont::value_type                 Node;
-   typedef typename A::template rebind::other   NodeAlloc;
-   typedef A                                          ValAlloc;
-   typedef typename NodeAlloc::pointer                NodePtr;
-   typedef containers_detail::scoped_deallocator      Deallocator;
-   typedef typename NodeAlloc::size_type              size_type;
-   typedef typename NodeAlloc::difference_type        difference_type;
-   typedef containers_detail::integral_constant     allocator_v1;
-   typedef containers_detail::integral_constant     allocator_v2;
-   typedef containers_detail::integral_constant                                    allocator_traits_type;
+   typedef node_alloc_holder                            self_t;
+   typedef typename allocator_traits_type::value_type             value_type;
+   typedef typename ICont::value_type                             Node;
+   typedef typename allocator_traits_type::template
+      portable_rebind_alloc::type                           NodeAlloc;
+   typedef allocator_traits                            node_allocator_traits_type;
+   typedef A                                                      ValAlloc;
+   typedef typename node_allocator_traits_type::pointer           NodePtr;
+   typedef container_detail::scoped_deallocator        Deallocator;
+   typedef typename node_allocator_traits_type::size_type         size_type;
+   typedef typename node_allocator_traits_type::difference_type   difference_type;
+   typedef container_detail::integral_constant       allocator_v1;
+   typedef container_detail::integral_constant       allocator_v2;
+   typedef container_detail::integral_constant::value>                   alloc_version;
    typedef typename ICont::iterator                   icont_iterator;
    typedef typename ICont::const_iterator             icont_citerator;
    typedef allocator_destroyer             Destroyer;
+   typedef allocator_traits                NodeAllocTraits;
 
    private:
    BOOST_COPYABLE_AND_MOVABLE(node_alloc_holder)
 
    public:
 
-   node_alloc_holder(const ValAlloc &a) 
+   //Constructors for sequence containers
+   node_alloc_holder() 
+      : members_()
+   {}
+
+   explicit node_alloc_holder(const ValAlloc &a) 
       : members_(a)
    {}
 
-   node_alloc_holder(const node_alloc_holder &other)
-      : members_(other.node_alloc())
+   explicit node_alloc_holder(const node_alloc_holder &x)
+      : members_(NodeAllocTraits::select_on_container_copy_construction(x.node_alloc()))
    {}
 
-   node_alloc_holder(BOOST_RV_REF(node_alloc_holder) other)
-      : members_(boost::move(other.node_alloc()))
-   {  this->swap(other);  }
+   explicit node_alloc_holder(BOOST_RV_REF(node_alloc_holder) x)
+      : members_(boost::move(x.node_alloc()))
+   {  this->icont().swap(x.icont());  }
 
-   node_alloc_holder & operator=(BOOST_COPY_ASSIGN_REF(node_alloc_holder) other)
-   {  members_.assign(other.node_alloc());   }
-
-   node_alloc_holder & operator=(BOOST_RV_REF(node_alloc_holder) other)
-   {  members_.assign(other.node_alloc());   }
-
-   template
-   node_alloc_holder(const ValAlloc &a, const Pred &c) 
-      : members_(a, typename ICont::value_compare(c))
+   //Constructors for associative containers
+   explicit node_alloc_holder(const ValAlloc &a, const Pred &c) 
+      : members_(a, c)
    {}
 
-   template
-   node_alloc_holder(BOOST_RV_REF(ValAlloc) a, const Pred &c) 
-      : members_(a, typename ICont::value_compare(c))
+   explicit node_alloc_holder(const node_alloc_holder &x, const Pred &c)
+      : members_(NodeAllocTraits::select_on_container_copy_construction(x.node_alloc()), c)
    {}
 
-   template
-   node_alloc_holder(const node_alloc_holder &other, const Pred &c)
-      : members_(other.node_alloc(), typename ICont::value_compare(c))
+   explicit node_alloc_holder(const Pred &c)
+      : members_(c)
    {}
 
+   //helpers for move assignments
+   explicit node_alloc_holder(BOOST_RV_REF(node_alloc_holder) x, const Pred &c)
+      : members_(boost::move(x.node_alloc()), c)
+   {  this->icont().swap(x.icont());  }
+
+   void copy_assign_alloc(const node_alloc_holder &x)
+   {  
+      container_detail::bool_ flag;
+      container_detail::assign_alloc( static_cast(this->members_)
+                                    , static_cast(x.members_), flag);
+   }
+
+   void move_assign_alloc( node_alloc_holder &x)
+   {
+      container_detail::bool_ flag;
+      container_detail::move_alloc( static_cast(this->members_)
+                                  , static_cast(x.members_), flag);
+   }
+
    ~node_alloc_holder()
    {  this->clear(alloc_version()); }
 
    size_type max_size() const
-   {  return this->node_alloc().max_size();  }
+   {  return allocator_traits_type::max_size(this->node_alloc());  }
 
    NodePtr allocate_one()
    {  return this->allocate_one(alloc_version());   }
@@ -229,131 +251,100 @@ struct node_alloc_holder
    NodePtr allocate_one(allocator_v2)
    {  return this->node_alloc().allocate_one();   }
 
-   void deallocate_one(NodePtr p)
+   void deallocate_one(const NodePtr &p)
    {  return this->deallocate_one(p, alloc_version());   }
 
-   void deallocate_one(NodePtr p, allocator_v1)
+   void deallocate_one(const NodePtr &p, allocator_v1)
    {  this->node_alloc().deallocate(p, 1);   }
 
-   void deallocate_one(NodePtr p, allocator_v2)
+   void deallocate_one(const NodePtr &p, allocator_v2)
    {  this->node_alloc().deallocate_one(p);   }
-
-   template
-   static void construct(const NodePtr &ptr,
+/*
+   template
+   static void construct(A &a, const NodePtr &ptr,
       BOOST_RV_REF_2_TEMPL_ARGS(std::pair, Convertible1, Convertible2) value)
-   {  
+   {
       typedef typename Node::hook_type                hook_type;
       typedef typename Node::value_type::first_type   first_type;
       typedef typename Node::value_type::second_type  second_type;
-      Node *nodeptr = containers_detail::get_pointer(ptr);
+      Node *nodeptr = container_detail::to_raw_pointer(ptr);
 
       //Hook constructor does not throw
-      new(static_cast(nodeptr))hook_type();
+      allocator_traits::construct(a, static_cast(nodeptr));
+
       //Now construct pair members_holder
       value_type *valueptr = &nodeptr->get_data();
-      new((void*)&valueptr->first) first_type(boost::move(value.first));
+      allocator_traits::construct(a, &valueptr->first, boost::move(value.first));
       BOOST_TRY{
-         new((void*)&valueptr->second) second_type(boost::move(value.second));
+         allocator_traits::construct(a, &valueptr->second, boost::move(value.second));
       }
       BOOST_CATCH(...){
-         valueptr->first.~first_type();
-         static_cast(nodeptr)->~hook_type();
+         allocator_traits::destroy(a, &valueptr->first);
          BOOST_RETHROW
       }
       BOOST_CATCH_END
    }
-
-   static void destroy(const NodePtr &ptr)
-   {  containers_detail::get_pointer(ptr)->~Node();  }
-
-   Deallocator create_node_and_deallocator()
-   {
-      return Deallocator(this->allocate_one(), this->node_alloc());
+*/
+   #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+/*
+   template
+   static void construct(A &a, const NodePtr &ptr, Args &&...args)
+   {  
    }
-
-   #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
-   template
-   static void construct(const NodePtr &ptr, Args &&...args)
-   {  new((void*)containers_detail::get_pointer(ptr)) Node(boost::forward(args)...);  }
-
+*/
    template
    NodePtr create_node(Args &&...args)
    {
       NodePtr p = this->allocate_one();
       Deallocator node_deallocator(p, this->node_alloc());
-      self_t::construct(p, boost::forward(args)...);
+      allocator_traits::construct
+         (this->node_alloc(), container_detail::to_raw_pointer(p), boost::forward(args)...);
       node_deallocator.release();
       return (p);
    }
 
-   #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
-   static void construct(const NodePtr &ptr)
-   {  new((void*)containers_detail::get_pointer(ptr)) Node();  }
-
-   NodePtr create_node()
-   {
-      NodePtr p = this->allocate_one();
-      Deallocator node_deallocator(p, this->node_alloc());
-      self_t::construct(p);
-      node_deallocator.release();
-      return (p);
-   }
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                           \
-   template                                                \
-   void construct(const NodePtr &ptr, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
-   {                                                                                         \
-      new((void*)containers_detail::get_pointer(ptr))                                                   \
-      Node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));                        \
-   }                                                                                         \
-   //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
-   #include BOOST_PP_LOCAL_ITERATE()
+   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    #define BOOST_PP_LOCAL_MACRO(n)                                                        \
-   template                                             \
-   NodePtr create_node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))             \
+                                                                                          \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+   NodePtr create_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                \
    {                                                                                      \
       NodePtr p = this->allocate_one();                                                   \
       Deallocator node_deallocator(p, this->node_alloc());                                \
-      self_t::construct(p, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));     \
+      allocator_traits::construct                                              \
+         (this->node_alloc(), container_detail::to_raw_pointer(p)                         \
+            BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));              \
       node_deallocator.release();                                                         \
       return (p);                                                                         \
    }                                                                                      \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif   //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    template
-   NodePtr create_node_from_it(It it)
+   NodePtr create_node_from_it(const It &it)
    {
       NodePtr p = this->allocate_one();
       Deallocator node_deallocator(p, this->node_alloc());
-      ::boost::container::construct_in_place(containers_detail::get_pointer(p), it);
+      ::boost::container::construct_in_place(this->node_alloc(), container_detail::to_raw_pointer(p), it);
       node_deallocator.release();
       return (p);
    }
 
-   void destroy_node(NodePtr node)
+   void destroy_node(const NodePtr &nodep)
    {
-      self_t::destroy(node);
-      this->deallocate_one(node);
+      allocator_traits::destroy(this->node_alloc(), container_detail::to_raw_pointer(nodep));
+      this->deallocate_one(nodep);
    }
 
    void swap(node_alloc_holder &x)
    {
-      NodeAlloc& this_alloc   = this->node_alloc();
-      NodeAlloc& other_alloc  = x.node_alloc();
-
-      if (this_alloc != other_alloc){
-         containers_detail::do_swap(this_alloc, other_alloc);
-      }
-
       this->icont().swap(x.icont());
+      container_detail::bool_ flag;
+      container_detail::swap_alloc(this->node_alloc(), x.node_alloc(), flag);
    }
 
    template
@@ -369,11 +360,11 @@ struct node_alloc_holder
          Node *p = 0;
          BOOST_TRY{
                for(difference_type i = 0; i < n; ++i, ++beg, --constructed){
-               p = containers_detail::get_pointer(mem.front());
+               p = container_detail::to_raw_pointer(mem.front());
                mem.pop_front();
                //This can throw
                constructed = 0;
-               boost::container::construct_in_place(p, beg);
+               boost::container::construct_in_place(this->node_alloc(), p, beg);
                ++constructed;
                //This can throw in some containers (predicate might throw)
                inserter(*p);
@@ -381,7 +372,7 @@ struct node_alloc_holder
          }
          BOOST_CATCH(...){
             if(constructed){
-               this->destroy(p);
+               allocator_traits::destroy(this->node_alloc(), container_detail::to_raw_pointer(p));
             }
             this->node_alloc().deallocate_individual(boost::move(mem));
             BOOST_RETHROW
@@ -404,10 +395,10 @@ struct node_alloc_holder
          this->node_alloc().deallocate_individual(boost::move(chain));
    }
 
-   icont_iterator erase_range(icont_iterator first, icont_iterator last, allocator_v1)
+   icont_iterator erase_range(const icont_iterator &first, const icont_iterator &last, allocator_v1)
    {  return this->icont().erase_and_dispose(first, last, Destroyer(this->node_alloc())); }
 
-   icont_iterator erase_range(icont_iterator first, icont_iterator last, allocator_v2)
+   icont_iterator erase_range(const icont_iterator &first, const icont_iterator &last, allocator_v2)
    {
       allocator_multialloc_chain_node_deallocator chain_holder(this->node_alloc());
       return this->icont().erase_and_dispose(first, last, chain_holder.get_chain_builder());
@@ -437,44 +428,38 @@ struct node_alloc_holder
       node_alloc_holder &m_holder;
    };
 
-   struct destroyer
-   {
-      destroyer(node_alloc_holder &holder)
-         :  m_holder(holder)
-      {}
-
-      void operator()(NodePtr n) const
-      {  m_holder.destroy_node(n);  }
-
-      node_alloc_holder &m_holder;
-   };
-
    struct members_holder
       :  public NodeAlloc
    {
       private:
       members_holder(const members_holder&);
+      members_holder & operator=(const members_holder&);
 
       public:
-      template
-      members_holder(const ConvertibleToAlloc &c2alloc)
-         :  NodeAlloc(c2alloc)
-      {}
-
-      template
-      members_holder(const ConvertibleToAlloc &c2alloc, const Pred &c)
-         :  NodeAlloc(c2alloc), m_icont(c)
+      members_holder()
+         : NodeAlloc(), m_icont()
       {}
 
       template
-      void assign (const ConvertibleToAlloc &c2alloc)
-      {
-         NodeAlloc::operator=(c2alloc);
-      }
+      explicit members_holder(BOOST_FWD_REF(ConvertibleToAlloc) c2alloc)
+         :  NodeAlloc(boost::forward(c2alloc))
+         , m_icont()
+      {}
+
+      template
+      members_holder(BOOST_FWD_REF(ConvertibleToAlloc) c2alloc, const Pred &c)
+         :  NodeAlloc(boost::forward(c2alloc))
+         , m_icont(typename ICont::value_compare(c))
+      {}
+
+      explicit members_holder(const Pred &c)
+         : NodeAlloc()
+         , m_icont(typename ICont::value_compare(c))
+      {}
 
       //The intrusive container
       ICont m_icont;
-   } members_;
+   };
 
    ICont &non_const_icont() const
    {  return const_cast(this->members_.m_icont);   }
@@ -490,12 +475,14 @@ struct node_alloc_holder
 
    const NodeAlloc &node_alloc() const
    {  return static_cast(this->members_);   }
+
+   members_holder members_;
 };
 
-}  //namespace containers_detail {
+}  //namespace container_detail {
 }  //namespace container {
 }  //namespace boost {
 
 #include 
 
-#endif // BOOST_CONTAINERS_DETAIL_NODE_ALLOC_HPP_
+#endif // BOOST_CONTAINER_DETAIL_NODE_ALLOC_HPP_
diff --git a/include/boost/container/detail/node_pool_impl.hpp b/include/boost/container/detail/node_pool_impl.hpp
index 56bd144..9ee9e31 100644
--- a/include/boost/container/detail/node_pool_impl.hpp
+++ b/include/boost/container/detail/node_pool_impl.hpp
@@ -19,7 +19,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -32,7 +32,7 @@
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 template
 class private_node_pool_impl
@@ -82,7 +82,7 @@ class private_node_pool_impl
 
    //!Returns the segment manager. Never throws
    segment_manager_base_type* get_segment_manager_base()const
-   {  return containers_detail::get_pointer(mp_segment_mngr_base);  }
+   {  return container_detail::to_raw_pointer(mp_segment_mngr_base);  }
 
    void *allocate_node()
    {  return priv_alloc_node();  }
@@ -346,8 +346,8 @@ class private_node_pool_impl
    }
 
    private:
-   typedef typename boost::pointer_to_other
-      ::type   segment_mngr_base_ptr_t;
+   typedef typename boost::intrusive::pointer_traits
+      ::template rebind_pointer::type   segment_mngr_base_ptr_t;
 
    const size_type m_nodes_per_block;
    const size_type m_real_node_size;
@@ -358,7 +358,7 @@ class private_node_pool_impl
 };
 
 
-}  //namespace containers_detail {
+}  //namespace container_detail {
 }  //namespace container {
 }  //namespace boost {
 
diff --git a/include/boost/container/detail/pair.hpp b/include/boost/container/detail/pair.hpp
index fd98a72..1aeff91 100644
--- a/include/boost/container/detail/pair.hpp
+++ b/include/boost/container/detail/pair.hpp
@@ -10,8 +10,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_CONTAINERS_DETAIL_PAIR_HPP
-#define BOOST_CONTAINERS_CONTAINERS_DETAIL_PAIR_HPP
+#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_PAIR_HPP
+#define BOOST_CONTAINER_CONTAINER_DETAIL_PAIR_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -28,13 +28,13 @@
 #include 
 #include 
 
-#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
+#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 #include 
 #endif
 
 namespace boost {
 namespace container { 
-namespace containers_detail {
+namespace container_detail {
 
 template 
 struct pair;
@@ -143,13 +143,13 @@ struct pair
 /*
    //Variadic versions
    template
-   pair(BOOST_CONTAINERS_PARAM(U, u), typename containers_detail::disable_if
-         < containers_detail::is_pair< typename containers_detail::remove_ref_const::type >, pair_nat>::type* = 0)
+   pair(BOOST_CONTAINER_PP_PARAM(U, u), typename container_detail::disable_if
+         < container_detail::is_pair< typename container_detail::remove_ref_const::type >, pair_nat>::type* = 0)
       : first(::boost::forward(u))
       , second()
    {}
 
-   #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    template
    pair(U &&u, V &&v)
@@ -161,13 +161,13 @@ struct pair
 
    #define BOOST_PP_LOCAL_MACRO(n)                                                            \
    template                                        \
-   pair(BOOST_CONTAINERS_PARAM(U, u)                                                          \
-       ,BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                                  \
+   pair(BOOST_CONTAINER_PP_PARAM(U, u)                                                          \
+       ,BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                                  \
       : first(::boost::forward(u))                             \
-      , second(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _))                        \
+      , second(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))                        \
    {}                                                                                         \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
    #endif
 */
@@ -280,7 +280,7 @@ inline void swap(pair& x, pair& y)
    swap(x.second, y.second);
 }
 
-}  //namespace containers_detail { 
+}  //namespace container_detail { 
 }  //namespace container { 
 
 
@@ -291,7 +291,7 @@ template
 struct is_enum;
 
 template
-struct is_enum< ::boost::container::containers_detail::pair >
+struct is_enum< ::boost::container::container_detail::pair >
 {
    static const bool value = false;
 };
@@ -299,14 +299,14 @@ struct is_enum< ::boost::container::containers_detail::pair >
 //This specialization is needed to avoid instantiation of pair in
 //is_class, and allow recursive maps.
 template 
-struct is_class< ::boost::container::containers_detail::pair >
+struct is_class< ::boost::container::container_detail::pair >
    : public ::boost::true_type
 {};
 
 #ifdef BOOST_NO_RVALUE_REFERENCES
 
 template
-struct has_move_emulation_enabled< ::boost::container::containers_detail::pair >
+struct has_move_emulation_enabled< ::boost::container::container_detail::pair >
    : ::boost::true_type
 {};
 
@@ -317,4 +317,4 @@ struct has_move_emulation_enabled< ::boost::container::containers_detail::pair
 
-#endif   //#ifndef BOOST_CONTAINERS_DETAIL_PAIR_HPP
+#endif   //#ifndef BOOST_CONTAINER_DETAIL_PAIR_HPP
diff --git a/include/boost/container/detail/pool_common.hpp b/include/boost/container/detail/pool_common.hpp
index c647710..c66e2cd 100644
--- a/include/boost/container/detail/pool_common.hpp
+++ b/include/boost/container/detail/pool_common.hpp
@@ -21,7 +21,7 @@
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 template
 struct node_slist
@@ -43,7 +43,7 @@ struct is_stateless_segment_manager
    static const bool value = false;
 };
 
-}  //namespace containers_detail {
+}  //namespace container_detail {
 }  //namespace container {
 }  //namespace boost {
 
diff --git a/include/boost/container/detail/preprocessor.hpp b/include/boost/container/detail/preprocessor.hpp
index 72a5904..9916fba 100644
--- a/include/boost/container/detail/preprocessor.hpp
+++ b/include/boost/container/detail/preprocessor.hpp
@@ -8,32 +8,43 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_PREPROCESSOR_HPP
-#define BOOST_CONTAINERS_DETAIL_PREPROCESSOR_HPP
+#ifndef BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP
+#define BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
 #endif
 
-#include "config_begin.hpp"
+#include 
 
 #ifndef BOOST_NO_RVALUE_REFERENCES
 #include 
-#endif
+#endif   //#ifndef BOOST_NO_RVALUE_REFERENCES
 
 #include 
 
-#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-#error "This file is not needed when perfect forwarding is available"
-#endif
+#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+//#error "This file is not needed when perfect forwarding is available"
+#endif   //BOOST_CONTAINER_PERFECT_FORWARDING
 
 #include  
-#include 
+#include 
+#include 
+#include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
+#include 
+#include 
+#include 
+#include 
 
-#define BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS 10
+#define BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS 10
 
 //Note:
 //We define template parameters as const references to
@@ -42,100 +53,126 @@
 //is achieved in C++0x. Meanwhile, if we want to be able to
 //bind rvalues with non-const references, we have to be ugly
 #ifndef BOOST_NO_RVALUE_REFERENCES
-   #define BOOST_CONTAINERS_PP_PARAM_LIST(z, n, data) \
+   #define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \
    BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \
    //!
 #else
-   #define BOOST_CONTAINERS_PP_PARAM_LIST(z, n, data) \
+   #define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \
    const BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n) \
    //!
-#endif
+#endif   //#ifndef BOOST_NO_RVALUE_REFERENCES
 
 #ifndef BOOST_NO_RVALUE_REFERENCES
-   #define BOOST_CONTAINERS_PARAM(U, u) \
+   #define BOOST_CONTAINER_PP_PARAM(U, u) \
    U && u \
    //!
 #else
-   #define BOOST_CONTAINERS_PARAM(U, u) \
+   #define BOOST_CONTAINER_PP_PARAM(U, u) \
    const U & u \
    //!
-#endif
+#endif   //#ifndef BOOST_NO_RVALUE_REFERENCES
 
 #ifndef BOOST_NO_RVALUE_REFERENCES
 
-#ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
+   #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
 
-#define BOOST_CONTAINERS_AUX_PARAM_INIT(z, n, data) \
-  BOOST_PP_CAT(m_p, n) (boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ))           \
-//!
+      #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \
+      BOOST_PP_CAT(m_p, n) (boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ))           \
+      //!
 
-#else
+   #else    //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
 
-#define BOOST_CONTAINERS_AUX_PARAM_INIT(z, n, data) \
-  BOOST_PP_CAT(m_p, n) (static_cast( BOOST_PP_CAT(p, n) ))           \
-//!
+      #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \
+      BOOST_PP_CAT(m_p, n) (static_cast( BOOST_PP_CAT(p, n) ))           \
+      //!
 
-#endif
+   #endif   //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
 
-#else
-#define BOOST_CONTAINERS_AUX_PARAM_INIT(z, n, data) \
-  BOOST_PP_CAT(m_p, n) (const_cast(BOOST_PP_CAT(p, n))) \
-//!
-#endif
+#else //BOOST_NO_RVALUE_REFERENCES
 
-#define BOOST_CONTAINERS_AUX_PARAM_INC(z, n, data)   \
-  BOOST_PP_CAT(++m_p, n)                        \
-//!
+   #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \
+   BOOST_PP_CAT(m_p, n) (const_cast(BOOST_PP_CAT(p, n))) \
+   //!
+#endif   //#ifndef BOOST_NO_RVALUE_REFERENCES
 
 #ifndef BOOST_NO_RVALUE_REFERENCES
 
-#if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+   #if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
 
-#define BOOST_CONTAINERS_AUX_PARAM_DEFINE(z, n, data)  \
-  BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n);            \
-//!
+      #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data)  \
+      BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n);            \
+      //!
 
-#else
+   #else //BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG
 
-#define BOOST_CONTAINERS_AUX_PARAM_DEFINE(z, n, data)  \
-  BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n);            \
-//!
+      #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data)  \
+      BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n);            \
+      //!
 
-#endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+   #endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
 
+#else //BOOST_NO_RVALUE_REFERENCES
 
-#else
-#define BOOST_CONTAINERS_AUX_PARAM_DEFINE(z, n, data)  \
-  BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n);             \
-//!
-#endif
-
-#define BOOST_CONTAINERS_PP_PARAM_FORWARD(z, n, data) \
-boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \
-//!
+   #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data)  \
+   BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n);             \
+   //!
+#endif   //#ifndef BOOST_NO_RVALUE_REFERENCES
 
 #if !defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
 
-#define BOOST_CONTAINERS_PP_MEMBER_FORWARD(z, n, data) \
-::boost::container::containers_detail::stored_ref< BOOST_PP_CAT(P, n) >::forward( BOOST_PP_CAT(m_p, n) ) \
-//!
+   #define BOOST_CONTAINER_PP_MEMBER_FORWARD(z, n, data) \
+   ::boost::container::container_detail::stored_ref< BOOST_PP_CAT(P, n) >::forward( BOOST_PP_CAT(this->m_p, n) ) \
+   //!
 
-#else
+#else //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
 
-#define BOOST_CONTAINERS_PP_MEMBER_FORWARD(z, n, data) \
-boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \
-//!
+   #define BOOST_CONTAINER_PP_MEMBER_FORWARD(z, n, data) \
+   boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(this->m_p, n) ) \
+   //!
 
 #endif   //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
 
-#define BOOST_CONTAINERS_PP_MEMBER_IT_FORWARD(z, n, data) \
-BOOST_PP_CAT(*m_p, n) \
+#define BOOST_CONTAINER_PP_PARAM_INC(z, n, data)   \
+  BOOST_PP_CAT(++this->m_p, n)                     \
+//!
+
+#define BOOST_CONTAINER_PP_IDENTITY(z, n, data) data
+
+
+#define BOOST_CONTAINER_PP_PARAM_FORWARD(z, n, data) \
+boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \
+//!
+
+#define BOOST_CONTAINER_PP_DECLVAL(z, n, data) \
+boost::move_detail::declval< BOOST_PP_CAT(P, n) >() \
+//!
+
+#define BOOST_CONTAINER_PP_MEMBER_IT_FORWARD(z, n, data) \
+BOOST_PP_CAT(*this->m_p, n) \
+//!
+
+#define BOOST_CONTAINER_PP_TEMPLATE_PARAM_VOID_DEFAULT(z, n, data)   \
+  BOOST_PP_CAT(class P, n) = void                                      \
+//!
+
+#define BOOST_CONTAINER_PP_STATIC_PARAM_REF_DECLARE(z, n, data) \
+   static BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n); \
+//!
+
+#define BOOST_CONTAINER_PP_PARAM_PASS(z, n, data) \
+   BOOST_PP_CAT(p, n) \
+//!
+
+#define BOOST_CONTAINER_PP_FWD_TYPE(z, n, data) \
+   typename ::boost::move_detail::forward_type< BOOST_PP_CAT(P, n) >::type \
 //!
 
 #include 
 
-#else
-#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-#error "This file is not needed when perfect forwarding is available"
-#endif
-#endif //#ifndef BOOST_CONTAINERS_DETAIL_PREPROCESSOR_HPP
+//#else
+
+//#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+//#error "This file is not needed when perfect forwarding is available"
+//#endif   //BOOST_CONTAINER_PERFECT_FORWARDING
+
+#endif //#ifndef BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP
diff --git a/include/boost/container/detail/stored_ref.hpp b/include/boost/container/detail/stored_ref.hpp
index 8270e14..df0faa8 100644
--- a/include/boost/container/detail/stored_ref.hpp
+++ b/include/boost/container/detail/stored_ref.hpp
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_STORED_REF_HPP
-#define BOOST_CONTAINERS_DETAIL_STORED_REF_HPP
+#ifndef BOOST_CONTAINER_DETAIL_STORED_REF_HPP
+#define BOOST_CONTAINER_DETAIL_STORED_REF_HPP
 
 #include "config_begin.hpp"
 #include 
@@ -18,7 +18,7 @@
 
 namespace boost{
 namespace container{
-namespace containers_detail{
+namespace container_detail{
 
 template
 struct stored_ref
@@ -79,7 +79,7 @@ struct stored_ref
    {  return t; }
 };
 
-}  //namespace containers_detail{
+}  //namespace container_detail{
 }  //namespace container{
 }  //namespace boost{
 
@@ -89,4 +89,4 @@ struct stored_ref
 
 #include 
 
-#endif   //BOOST_CONTAINERS_DETAIL_STORED_REF_HPP
+#endif   //BOOST_CONTAINER_DETAIL_STORED_REF_HPP
diff --git a/include/boost/container/detail/transform_iterator.hpp b/include/boost/container/detail/transform_iterator.hpp
index b6176fb..17eca9e 100644
--- a/include/boost/container/detail/transform_iterator.hpp
+++ b/include/boost/container/detail/transform_iterator.hpp
@@ -11,8 +11,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_TRANSFORM_ITERATORS_HPP
-#define BOOST_CONTAINERS_DETAIL_TRANSFORM_ITERATORS_HPP
+#ifndef BOOST_CONTAINER_DETAIL_TRANSFORM_ITERATORS_HPP
+#define BOOST_CONTAINER_DETAIL_TRANSFORM_ITERATORS_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -59,7 +59,7 @@ class transform_iterator
    : public UnaryFunction
    , public std::iterator
       < typename Iterator::iterator_category
-      , typename containers_detail::remove_reference::type
+      , typename container_detail::remove_reference::type
       , typename Iterator::difference_type
       , operator_arrow_proxy
       , typename UnaryFunction::result_type>
@@ -173,4 +173,4 @@ make_transform_iterator(Iterator it, UnaryFunc fun)
 
 #include 
 
-#endif   //#ifndef BOOST_CONTAINERS_DETAIL_TRANSFORM_ITERATORS_HPP
+#endif   //#ifndef BOOST_CONTAINER_DETAIL_TRANSFORM_ITERATORS_HPP
diff --git a/include/boost/container/detail/tree.hpp b/include/boost/container/detail/tree.hpp
index 012fb2d..2a60e11 100644
--- a/include/boost/container/detail/tree.hpp
+++ b/include/boost/container/detail/tree.hpp
@@ -8,15 +8,15 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_TREE_HPP
-#define BOOST_CONTAINERS_TREE_HPP
+#ifndef BOOST_CONTAINER_TREE_HPP
+#define BOOST_CONTAINER_TREE_HPP
 
 #include "config_begin.hpp"
 #include 
 #include 
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -27,7 +27,8 @@
 #include 
 #include 
 #include 
-#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
+#include 
+#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 #include 
 #endif
 
@@ -37,7 +38,7 @@
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 template
 struct value_compare_impl
@@ -82,10 +83,10 @@ struct value_compare_impl
 template
 struct rbtree_hook
 {
-   typedef typename containers_detail::bi::make_set_base_hook
-      < containers_detail::bi::void_pointer
-      , containers_detail::bi::link_mode
-      , containers_detail::bi::optimize_size
+   typedef typename container_detail::bi::make_set_base_hook
+      < container_detail::bi::void_pointer
+      , container_detail::bi::link_mode
+      , container_detail::bi::optimize_size
       >::type  type;
 };
 
@@ -105,6 +106,10 @@ template 
 struct rbtree_node
    :  public rbtree_hook::type
 {
+   private:
+   BOOST_COPYABLE_AND_MOVABLE(rbtree_node)
+
+   public:
    typedef typename rbtree_hook::type hook_type;
 
    typedef T value_type;
@@ -112,8 +117,6 @@ struct rbtree_node
 
    typedef rbtree_node node_type;
 
-   #ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
-
    rbtree_node()
       : m_data()
    {}
@@ -122,30 +125,35 @@ struct rbtree_node
       : m_data(other.m_data)
    {}
 
-   #define BOOST_PP_LOCAL_MACRO(n)                                                           \
-   template                                                \
-   rbtree_node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                        \
-      : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _))                     \
-   {}                                                                                        \
+   rbtree_node(BOOST_RV_REF(rbtree_node) other)
+      : m_data(boost::move(other.m_data))
+   {}
+
+   #ifndef BOOST_CONTAINER_PERFECT_FORWARDING
+
+   #define BOOST_PP_LOCAL_MACRO(n)                                           \
+   template                                \
+   rbtree_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))           \
+      : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))        \
+   {}                                                                        \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #else //#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
-
-   rbtree_node()
-      : m_data()
-   {}
+   #else //#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 
    template
    rbtree_node(Args &&...args)
       : m_data(boost::forward(args)...)
    {}
-   #endif//#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif//#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 
    rbtree_node &operator=(const rbtree_node &other)
    {  do_assign(other.m_data);   return *this;  }
 
+   rbtree_node &operator=(BOOST_RV_REF(rbtree_node) other)
+   {  do_move(other.m_data);   return *this;  }
+
    T &get_data()
    {
       T* ptr = reinterpret_cast(&this->m_data);
@@ -179,76 +187,88 @@ struct rbtree_node
    void do_assign(const V &v)
    {  m_data = v; }
 
-   public:
-   template
-   static void construct(node_type *ptr, BOOST_FWD_REF(Convertible) convertible)
-   {  new(ptr) node_type(boost::forward(convertible));  }
+   template
+   void do_move(std::pair &p)
+   {
+      const_cast(m_data.first) = boost::move(p.first);
+      m_data.second  = boost::move(p.second);
+   }
+
+   template
+   void do_move(pair &p)
+   {
+      const_cast(m_data.first) = boost::move(p.first);
+      m_data.second  = boost::move(p.second);
+   }
+
+   template
+   void do_move(V &v)
+   {  m_data = boost::move(v); }
 };
 
-}//namespace containers_detail {
-#if defined(BOOST_NO_RVALUE_REFERENCES)
-template
-struct has_own_construct_from_it
-   < boost::container::containers_detail::rbtree_node >
-{
-   static const bool value = true;
-};
-#endif
-namespace containers_detail {
+}//namespace container_detail {
+
+namespace container_detail {
 
 template
 struct intrusive_rbtree_type
 {
-   typedef typename A::value_type                  value_type;
-   typedef typename boost::pointer_to_other
-      ::type            void_pointer;
-   typedef typename containers_detail::rbtree_node
+   typedef typename boost::container::
+      allocator_traits::value_type              value_type;
+   typedef typename boost::container::
+      allocator_traits::void_pointer            void_pointer;
+   typedef typename boost::container::
+      allocator_traits::size_type               size_type;
+   typedef typename container_detail::rbtree_node
                          node_type;
    typedef node_compare   node_compare_type;
-   typedef typename containers_detail::bi::make_rbtree
+   typedef typename container_detail::bi::make_rbtree
       
-      ,containers_detail::bi::base_hook::type>
-      ,containers_detail::bi::constant_time_size
-      ,containers_detail::bi::size_type
+      ,container_detail::bi::compare
+      ,container_detail::bi::base_hook::type>
+      ,container_detail::bi::constant_time_size
+      ,container_detail::bi::size_type
       >::type                                      container_type;
    typedef container_type                          type ;
 };
 
-}  //namespace containers_detail {
+}  //namespace container_detail {
 
-namespace containers_detail {
+namespace container_detail {
 
 template 
 class rbtree
-   : protected containers_detail::node_alloc_holder
-        
          >::type
+      , KeyCompare
       >
 {
-   typedef typename containers_detail::intrusive_rbtree_type
-         
-         >::type                                      Icont;
-   typedef containers_detail::node_alloc_holder        AllocHolder;
-   typedef typename AllocHolder::NodePtr              NodePtr;
+         >::type                                            Icont;
+   typedef container_detail::node_alloc_holder  
+                                      AllocHolder;
+   typedef typename AllocHolder::NodePtr                    NodePtr;
    typedef rbtree < Key, Value, KeyOfValue
-                  , KeyCompare, A>                    ThisType;
-   typedef typename AllocHolder::NodeAlloc            NodeAlloc;
-   typedef typename AllocHolder::ValAlloc             ValAlloc;
-   typedef typename AllocHolder::Node                 Node;
-   typedef typename Icont::iterator                   iiterator;
-   typedef typename Icont::const_iterator             iconst_iterator;
-   typedef containers_detail::allocator_destroyer     Destroyer;
-   typedef typename AllocHolder::allocator_v1         allocator_v1;
-   typedef typename AllocHolder::allocator_v2         allocator_v2;
-   typedef typename AllocHolder::alloc_version        alloc_version;
+                  , KeyCompare, A>                          ThisType;
+   typedef typename AllocHolder::NodeAlloc                  NodeAlloc;
+   typedef typename AllocHolder::ValAlloc                   ValAlloc;
+   typedef typename AllocHolder::Node                       Node;
+   typedef typename Icont::iterator                         iiterator;
+   typedef typename Icont::const_iterator                   iconst_iterator;
+   typedef container_detail::allocator_destroyer Destroyer;
+   typedef typename AllocHolder::allocator_v1               allocator_v1;
+   typedef typename AllocHolder::allocator_v2               allocator_v2;
+   typedef typename AllocHolder::alloc_version              alloc_version;
 
    class RecyclingCloner;
    friend class RecyclingCloner;
-   
+
    class RecyclingCloner
    {
       public:
@@ -258,10 +278,8 @@ class rbtree
 
       NodePtr operator()(const Node &other) const
       {
-//         if(!m_icont.empty()){
          if(NodePtr p = m_icont.unlink_leftmost_without_rebalance()){
             //First recycle a node (this can't throw)
-            //NodePtr p = m_icont.unlink_leftmost_without_rebalance();
             try{
                //This can throw
                *p = other;
@@ -284,6 +302,44 @@ class rbtree
       AllocHolder &m_holder;
       Icont &m_icont;
    };
+
+   class RecyclingMoveCloner;
+   friend class RecyclingMoveCloner;
+
+   class RecyclingMoveCloner
+   {
+      public:
+      RecyclingMoveCloner(AllocHolder &holder, Icont &irbtree)
+         :  m_holder(holder), m_icont(irbtree)
+      {}
+
+      NodePtr operator()(const Node &other) const
+      {
+         if(NodePtr p = m_icont.unlink_leftmost_without_rebalance()){
+            //First recycle a node (this can't throw)
+            try{
+               //This can throw
+               *p = boost::move(other);
+               return p;
+            }
+            catch(...){
+               //If there is an exception destroy the whole source
+               m_holder.destroy_node(p);
+               while((p = m_icont.unlink_leftmost_without_rebalance())){
+                  m_holder.destroy_node(p);
+               }
+               throw;
+            }
+         }
+         else{
+            return m_holder.create_node(other);
+         }
+      }
+
+      AllocHolder &m_holder;
+      Icont &m_icont;
+   };
+
    BOOST_COPYABLE_AND_MOVABLE(rbtree)
 
    public:
@@ -294,12 +350,18 @@ class rbtree
    typedef KeyCompare                                 key_compare;
    typedef value_compare_impl< Key, Value
                         , KeyCompare, KeyOfValue>     value_compare;
-   typedef typename A::pointer                        pointer;
-   typedef typename A::const_pointer                  const_pointer;
-   typedef typename A::reference                      reference;
-   typedef typename A::const_reference                const_reference;
-   typedef typename A::size_type                      size_type;
-   typedef typename A::difference_type                difference_type;
+   typedef typename boost::container::
+      allocator_traits::pointer                    pointer;
+   typedef typename boost::container::
+      allocator_traits::const_pointer              const_pointer;
+   typedef typename boost::container::
+      allocator_traits::reference                  reference;
+   typedef typename boost::container::
+      allocator_traits::const_reference            const_reference;
+   typedef typename boost::container::
+      allocator_traits::size_type                  size_type;
+   typedef typename boost::container::
+      allocator_traits::difference_type            difference_type;
    typedef difference_type                            rbtree_difference_type;
    typedef pointer                                    rbtree_pointer;
    typedef const_pointer                              rbtree_const_pointer;
@@ -436,8 +498,11 @@ class rbtree
    typedef std::reverse_iterator        reverse_iterator;
    typedef std::reverse_iterator  const_reverse_iterator;
 
-   rbtree(const key_compare& comp = key_compare(), 
-           const allocator_type& a = allocator_type())
+   rbtree()
+      : AllocHolder(key_compare())
+   {}
+
+   rbtree(const key_compare& comp, const allocator_type& a = allocator_type())
       : AllocHolder(a, comp)
    {}
 
@@ -467,26 +532,32 @@ class rbtree
    }
 
    rbtree(BOOST_RV_REF(rbtree) x) 
-      :  AllocHolder(x, x.key_comp())
-   {  this->swap(x);  }
+      :  AllocHolder(boost::move(static_cast(x)), x.key_comp())
+   {}
 
    ~rbtree()
    {} //AllocHolder clears the tree
 
    rbtree& operator=(BOOST_COPY_ASSIGN_REF(rbtree) x)
    {
-      if (this != &x) {
+      if (&x != this){
+         NodeAlloc &this_alloc     = this->get_stored_allocator();
+         const NodeAlloc &x_alloc  = x.get_stored_allocator();
+         container_detail::bool_::
+            propagate_on_container_copy_assignment::value> flag;
+         if(flag && this_alloc != x_alloc){
+            this->clear();
+         }
+         this->AllocHolder::copy_assign_alloc(x);
          //Transfer all the nodes to a temporary tree
          //If anything goes wrong, all the nodes will be destroyed
          //automatically
-         Icont other_tree(this->icont().value_comp());
-         other_tree.swap(this->icont());
+         Icont other_tree(boost::move(this->icont()));
 
          //Now recreate the source tree reusing nodes stored by other_tree
          this->icont().clone_from
             (x.icont()
             , RecyclingCloner(*this, other_tree)
-            //, AllocHolder::cloner(*this)
             , Destroyer(this->node_alloc()));
 
          //If there are remaining nodes, destroy them
@@ -498,8 +569,41 @@ class rbtree
       return *this;
    }
 
-   rbtree& operator=(BOOST_RV_REF(rbtree) mx)
-   {  this->clear(); this->swap(mx);   return *this;  }
+   rbtree& operator=(BOOST_RV_REF(rbtree) x)
+   {
+      if (&x != this){
+         NodeAlloc &this_alloc = this->node_alloc();
+         NodeAlloc &x_alloc    = x.node_alloc();
+         //If allocators are equal we can just swap pointers
+         if(this_alloc == x_alloc){
+            //Destroy and swap pointers
+            this->clear();
+            this->icont() = boost::move(x.icont());
+            //Move allocator if needed
+            this->AllocHolder::move_assign_alloc(x);
+         }
+         //If unequal allocators, then do a one by one move
+         else{
+            //Transfer all the nodes to a temporary tree
+            //If anything goes wrong, all the nodes will be destroyed
+            //automatically
+            Icont other_tree(boost::move(this->icont()));
+
+            //Now recreate the source tree reusing nodes stored by other_tree
+            this->icont().clone_from
+               (x.icont()
+               , RecyclingMoveCloner(*this, other_tree)
+               , Destroyer(this->node_alloc()));
+
+            //If there are remaining nodes, destroy them
+            NodePtr p;
+            while((p = other_tree.unlink_leftmost_without_rebalance())){
+               AllocHolder::destroy_node(p);
+            }
+         }
+      }
+      return *this;
+   }
 
    public:    
    // accessors:
@@ -677,7 +781,7 @@ class rbtree
 
    public:
 
-   #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    template 
    iterator emplace_unique(Args&&... args)
@@ -701,59 +805,43 @@ class rbtree
       return iterator(this->icont().insert_equal(hint.get(), *p));
    }
 
-   #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
-   iterator emplace_unique()
-   {  return this->emplace_unique_impl(AllocHolder::create_node());   }
-
-   iterator emplace_hint_unique(const_iterator hint)
-   {  return this->emplace_unique_hint_impl(hint, AllocHolder::create_node());   }
-
-   iterator emplace_equal()
-   {
-      NodePtr p(AllocHolder::create_node());
-      return iterator(this->icont().insert_equal(this->icont().end(), *p));
-   }
-
-   iterator emplace_hint_equal(const_iterator hint)
-   {
-      NodePtr p(AllocHolder::create_node());
-      return iterator(this->icont().insert_equal(hint.get(), *p));
-   }
+   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    #define BOOST_PP_LOCAL_MACRO(n)                                                                          \
-   template                                                               \
-   iterator emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                           \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)                   \
+   iterator emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                             \
    {                                                                                                        \
       return this->emplace_unique_impl                                                                      \
-         (AllocHolder::create_node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)));              \
+         (AllocHolder::create_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)));                \
    }                                                                                                        \
                                                                                                             \
-   template                                                               \
-   iterator emplace_hint_unique(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)                   \
+   iterator emplace_hint_unique(const_iterator hint                                                         \
+                       BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                        \
    {                                                                                                        \
       return this->emplace_unique_hint_impl                                                                 \
-         (hint, AllocHolder::create_node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)));        \
+         (hint, AllocHolder::create_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)));          \
    }                                                                                                        \
                                                                                                             \
-   template                                                               \
-   iterator emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                            \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)                   \
+   iterator emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                              \
    {                                                                                                        \
-      NodePtr p(AllocHolder::create_node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)));        \
+      NodePtr p(AllocHolder::create_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)));          \
       return iterator(this->icont().insert_equal(this->icont().end(), *p));                                 \
    }                                                                                                        \
                                                                                                             \
-   template                                                               \
-   iterator emplace_hint_equal(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))  \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)                   \
+   iterator emplace_hint_equal(const_iterator hint                                                          \
+                       BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                        \
    {                                                                                                        \
-      NodePtr p(AllocHolder::create_node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)));        \
+      NodePtr p(AllocHolder::create_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)));          \
       return iterator(this->icont().insert_equal(hint.get(), *p));                                          \
    }                                                                                                        \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif   //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    iterator insert_unique(const_iterator hint, const value_type& v)
    {
@@ -1044,7 +1132,7 @@ swap(rbtree& x,
   x.swap(y);
 }
 
-} //namespace containers_detail {
+} //namespace container_detail {
 } //namespace container {
 /*
 //!has_trivial_destructor_after_move<> == true_type
@@ -1052,7 +1140,7 @@ swap(rbtree& x,
 template 
 struct has_trivial_destructor_after_move
-    >
+    >
 {
    static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
 };
@@ -1061,4 +1149,4 @@ struct has_trivial_destructor_after_move
 
 #include 
 
-#endif //BOOST_CONTAINERS_TREE_HPP
+#endif //BOOST_CONTAINER_TREE_HPP
diff --git a/include/boost/container/detail/type_traits.hpp b/include/boost/container/detail/type_traits.hpp
index 28095ba..6a0b3ed 100644
--- a/include/boost/container/detail/type_traits.hpp
+++ b/include/boost/container/detail/type_traits.hpp
@@ -12,8 +12,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_CONTAINER_DETAIL_TYPE_TRAITS_HPP
-#define BOOST_CONTAINERS_CONTAINER_DETAIL_TYPE_TRAITS_HPP
+#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP
+#define BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -25,7 +25,7 @@
 
 namespace boost {
 namespace container { 
-namespace containers_detail {
+namespace container_detail {
 
 struct nat{};
 
@@ -194,10 +194,10 @@ struct remove_ref_const
    typedef typename remove_const< typename remove_reference::type >::type type;
 };
 
-} // namespace containers_detail
+} // namespace container_detail
 }  //namespace container { 
 }  //namespace boost {
 
 #include 
 
-#endif   //#ifndef BOOST_CONTAINERS_CONTAINER_DETAIL_TYPE_TRAITS_HPP
+#endif   //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP
diff --git a/include/boost/container/detail/utilities.hpp b/include/boost/container/detail/utilities.hpp
index 78e9ccd..ee0fe99 100644
--- a/include/boost/container/detail/utilities.hpp
+++ b/include/boost/container/detail/utilities.hpp
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_UTILITIES_HPP
-#define BOOST_CONTAINERS_DETAIL_UTILITIES_HPP
+#ifndef BOOST_CONTAINER_DETAIL_UTILITIES_HPP
+#define BOOST_CONTAINER_DETAIL_UTILITIES_HPP
 
 #include "config_begin.hpp"
 #include 
@@ -21,11 +21,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 template
 const T &max_value(const T &a, const T &b)
@@ -55,29 +56,14 @@ SizeType
    return max_size;
 }
 
-template
-struct smart_ptr_type
-{
-   typedef typename SmartPtr::value_type value_type;
-   typedef value_type *pointer;
-   static pointer get (const SmartPtr &smartptr)
-   {  return smartptr.get();}
-};
+template 
+inline T* to_raw_pointer(T* p)
+{  return p; }
 
-template
-struct smart_ptr_type
-{
-   typedef T value_type;
-   typedef value_type *pointer;
-   static pointer get (pointer ptr)
-   {  return ptr;}
-};
-
-//!Overload for smart pointers to avoid ADL problems with get_pointer
-template
-inline typename smart_ptr_type::pointer
-get_pointer(const Ptr &ptr)
-{  return smart_ptr_type::get(ptr);   }
+template 
+inline typename Pointer::element_type*
+   to_raw_pointer(const Pointer &p)
+{  return boost::container::container_detail::to_raw_pointer(p.operator->());  }
 
 //!To avoid ADL problems with swap
 template 
@@ -87,6 +73,33 @@ inline void do_swap(T& x, T& y)
    swap(x, y);
 }
 
+template
+inline void swap_alloc(AllocatorType &, AllocatorType &, container_detail::false_type)
+   BOOST_CONTAINER_NOEXCEPT
+{}
+
+template
+inline void swap_alloc(AllocatorType &l, AllocatorType &r, container_detail::true_type)
+{  container_detail::do_swap(l, r);   }
+
+template
+inline void assign_alloc(AllocatorType &, const AllocatorType &, container_detail::false_type)
+   BOOST_CONTAINER_NOEXCEPT
+{}
+
+template
+inline void assign_alloc(AllocatorType &l, const AllocatorType &r, container_detail::true_type)
+{  l = r;   }
+
+template
+inline void move_alloc(AllocatorType &, AllocatorType &, container_detail::false_type)
+   BOOST_CONTAINER_NOEXCEPT
+{}
+
+template
+inline void move_alloc(AllocatorType &l, AllocatorType &r, container_detail::true_type)
+{  l = ::boost::move(r);   }
+
 //Rounds "orig_size" by excess to round_to bytes
 template
 inline SizeType get_rounded_size(SizeType orig_size, SizeType round_to)
@@ -99,36 +112,36 @@ struct ct_rounded_size
 {
    enum { value = ((OrigSize-1)/RoundTo+1)*RoundTo };
 };
-
+/*
 template 
 struct __rw_is_enum
 {
-struct _C_no { };
-struct _C_yes { int _C_dummy [2]; };
+   struct _C_no { };
+   struct _C_yes { int _C_dummy [2]; };
 
-struct _C_indirect {
-// prevent classes with user-defined conversions from matching
+   struct _C_indirect {
+   // prevent classes with user-defined conversions from matching
 
-// use double to prevent float->int gcc conversion warnings
-_C_indirect (double);
+   // use double to prevent float->int gcc conversion warnings
+   _C_indirect (double);
 };
 
 // nested struct gets rid of bogus gcc errors
 struct _C_nest {
-// supply first argument to prevent HP aCC warnings
-static _C_no _C_is (int, ...);
-static _C_yes _C_is (int, _C_indirect);
+   // supply first argument to prevent HP aCC warnings
+   static _C_no _C_is (int, ...);
+   static _C_yes _C_is (int, _C_indirect);
 
-static _TypeT _C_make_T ();
+   static _TypeT _C_make_T ();
 };
 
 enum {
-_C_val = sizeof (_C_yes)
-== sizeof (_C_nest::_C_is (0, _C_nest::_C_make_T ()))
-&& !::boost::is_fundamental<_TypeT>::value
+   _C_val = sizeof (_C_yes) == sizeof (_C_nest::_C_is (0, _C_nest::_C_make_T ()))
+   && !::boost::is_fundamental<_TypeT>::value
 };
 
 }; 
+*/
 
 template
 struct move_const_ref_type
@@ -140,11 +153,119 @@ struct move_const_ref_type
    >
 {};
 
-}  //namespace containers_detail {
+}  //namespace container_detail {
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//                               uninitialized_move_alloc
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! Effects:
+//!   \code
+//!   for (; first != last; ++result, ++first)
+//!      allocator_traits::construct(a, &*result, boost::move(*first));
+//!   \endcode
+//!
+//! Returns: result
+template
+    // F models ForwardIterator
+F uninitialized_move_alloc(A &a, I f, I l, F r)
+{
+   while (f != l) {
+      allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), boost::move(*f));
+      ++f; ++r;
+   }
+   return r;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//                               uninitialized_copy_alloc
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! Effects:
+//!   \code
+//!   for (; first != last; ++result, ++first)
+//!      allocator_traits::construct(a, &*result, *first);
+//!   \endcode
+//!
+//! Returns: result
+template
+    // F models ForwardIterator
+F uninitialized_copy_alloc(A &a, I f, I l, F r)
+{
+   while (f != l) {
+      allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), *f);
+      ++f; ++r;
+   }
+   return r;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//                               uninitialized_copy_alloc
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! Effects:
+//!   \code
+//!   for (; first != last; ++result, ++first)
+//!      allocator_traits::construct(a, &*result, *first);
+//!   \endcode
+//!
+//! Returns: result
+template
+    
+void uninitialized_fill_alloc(A &a, F f, F l, const T &t)
+{
+   while (f != l) {
+      allocator_traits::construct(a, container_detail::to_raw_pointer(&*f), t);
+      ++f;
+   }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//                            uninitialized_copy_or_move_alloc
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+   // F models ForwardIterator
+F uninitialized_copy_or_move_alloc
+   (A &a, I f, I l, F r
+   ,typename boost::container::container_detail::enable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   return ::boost::container::uninitialized_move_alloc(a, f, l, r);
+}
+
+template
+   // F models ForwardIterator
+F uninitialized_copy_or_move_alloc
+   (A &a, I f, I l, F r
+   ,typename boost::container::container_detail::disable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   return ::boost::container::uninitialized_copy_alloc(a, f, l, r);
+}
+
 }  //namespace container {
 }  //namespace boost {
 
 
 #include 
 
-#endif   //#ifndef BOOST_CONTAINERS_DETAIL_UTILITIES_HPP
+#endif   //#ifndef BOOST_CONTAINER_DETAIL_UTILITIES_HPP
diff --git a/include/boost/container/detail/value_init.hpp b/include/boost/container/detail/value_init.hpp
index 5145fe9..afbc9c1 100644
--- a/include/boost/container/detail/value_init.hpp
+++ b/include/boost/container/detail/value_init.hpp
@@ -10,8 +10,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_VALUE_INIT_HPP
-#define BOOST_CONTAINERS_DETAIL_VALUE_INIT_HPP
+#ifndef BOOST_CONTAINER_DETAIL_VALUE_INIT_HPP
+#define BOOST_CONTAINER_DETAIL_VALUE_INIT_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -22,7 +22,7 @@
 
 namespace boost {
 namespace container { 
-namespace containers_detail {
+namespace container_detail {
 
 template
 struct value_init
@@ -31,13 +31,15 @@ struct value_init
       : m_t()
    {}
 
+   operator T &() { return m_t; }
+
    T m_t;
 };
 
-}  //namespace containers_detail { 
+}  //namespace container_detail { 
 }  //namespace container { 
 }  //namespace boost {
 
 #include 
 
-#endif   //#ifndef BOOST_CONTAINERS_DETAIL_VALUE_INIT_HPP
+#endif   //#ifndef BOOST_CONTAINER_DETAIL_VALUE_INIT_HPP
diff --git a/include/boost/container/detail/variadic_templates_tools.hpp b/include/boost/container/detail/variadic_templates_tools.hpp
index c16992e..f21f972 100644
--- a/include/boost/container/detail/variadic_templates_tools.hpp
+++ b/include/boost/container/detail/variadic_templates_tools.hpp
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
-#define BOOST_CONTAINERS_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
+#ifndef BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
+#define BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -22,7 +22,7 @@
 
 namespace boost {
 namespace container { 
-namespace containers_detail {
+namespace container_detail {
 
 template
 class tuple;
@@ -146,8 +146,8 @@ struct build_number_seq<0, index_tuple >
 {  typedef index_tuple type;  };
 
 
-}}}   //namespace boost { namespace container { namespace containers_detail {
+}}}   //namespace boost { namespace container { namespace container_detail {
 
 #include 
 
-#endif   //#ifndef BOOST_CONTAINERS_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
+#endif   //#ifndef BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
diff --git a/include/boost/container/detail/version_type.hpp b/include/boost/container/detail/version_type.hpp
index a194342..46344fa 100644
--- a/include/boost/container/detail/version_type.hpp
+++ b/include/boost/container/detail/version_type.hpp
@@ -13,8 +13,8 @@
 //////////////////////////////////////////////////////////////////////////////
 
 
-#ifndef BOOST_CONTAINERS_DETAIL_VERSION_TYPE_HPP
-#define BOOST_CONTAINERS_DETAIL_VERSION_TYPE_HPP
+#ifndef BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
+#define BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
 
 #include "config_begin.hpp"
 
@@ -23,13 +23,13 @@
 
 namespace boost{
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 //using namespace boost;
 
 template 
 struct version_type
-    : public containers_detail::integral_constant
+    : public container_detail::integral_constant
 {
     typedef T type;
 
@@ -39,7 +39,7 @@ struct version_type
 namespace impl{
 
 template , typename T::version>::value>
+          bool = container_detail::is_convertible, typename T::version>::value>
 struct extract_version
 {
    static const unsigned value = 1;
@@ -79,14 +79,14 @@ struct version
 
 template 
 struct version
-   : public containers_detail::integral_constant::value>
+   : public container_detail::integral_constant::value>
 {
 };
 
-}  //namespace containers_detail {
+}  //namespace container_detail {
 }  //namespace container {
 }  //namespace boost{
 
 #include "config_end.hpp"
 
-#endif   //#define BOOST_CONTAINERS_DETAIL_VERSION_TYPE_HPP
+#endif   //#define BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
diff --git a/include/boost/container/detail/workaround.hpp b/include/boost/container/detail/workaround.hpp
index 2846590..45ab2f2 100644
--- a/include/boost/container/detail/workaround.hpp
+++ b/include/boost/container/detail/workaround.hpp
@@ -8,17 +8,24 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_WORKAROUND_HPP
-#define BOOST_CONTAINERS_DETAIL_WORKAROUND_HPP
+#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
+#define BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
 
-#include "config_begin.hpp"
+#include 
 
 #if    !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)\
     && !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL)
-#define BOOST_CONTAINERS_PERFECT_FORWARDING
+   #define BOOST_CONTAINER_PERFECT_FORWARDING
+#endif
 
+#if defined(BOOST_NO_NOEXCEPT)
+   #define BOOST_CONTAINER_NOEXCEPT
+   #define BOOST_CONTAINER_NOEXCEPT_IF(x)
+#else
+   #define BOOST_CONTAINER_NOEXCEPT    noexcept
+   #define BOOST_CONTAINER_NOEXCEPT_IF(x) noexcept(x)
 #endif
 
 #include 
 
-#endif   //#ifndef BOOST_CONTAINERS_DETAIL_WORKAROUND_HPP
+#endif   //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
diff --git a/include/boost/container/flat_map.hpp b/include/boost/container/flat_map.hpp
index c637ef5..bb35ce2 100644
--- a/include/boost/container/flat_map.hpp
+++ b/include/boost/container/flat_map.hpp
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_FLAT_MAP_HPP
-#define BOOST_CONTAINERS_FLAT_MAP_HPP
+#ifndef BOOST_CONTAINER_FLAT_MAP_HPP
+#define BOOST_CONTAINER_FLAT_MAP_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -52,6 +53,23 @@ inline bool operator==(const flat_map& x,
 template 
 inline bool operator<(const flat_map& x, 
                       const flat_map& y);
+
+namespace container_detail{
+
+template
+static D &force(const S &s)
+{  return *const_cast((reinterpret_cast(&s))); }
+
+template
+static D force_copy(S s)
+{
+   D *vp = reinterpret_cast(&s);
+   return D(*vp);
+}
+
+}  //namespace container_detail{
+
+
 /// @endcond
 
 //! A flat_map is a kind of associative container that supports unique keys (contains at
@@ -86,19 +104,19 @@ class flat_map
    private:
    BOOST_COPYABLE_AND_MOVABLE(flat_map)
    //This is the tree that we should store if pair was movable
-   typedef containers_detail::flat_tree, 
-                           containers_detail::select1st< std::pair >, 
+                           container_detail::select1st< std::pair >, 
                            Pred, 
                            A> tree_t;
 
    //This is the real tree stored here. It's based on a movable pair
-   typedef containers_detail::flat_tree, 
-                           containers_detail::select1st >, 
+   typedef container_detail::flat_tree, 
+                           container_detail::select1st >, 
                            Pred, 
-                           typename     A::template
-                              rebind >::other> impl_tree_t;
+                           typename allocator_traits::template portable_rebind_alloc
+                               >::type> impl_tree_t;
    impl_tree_t m_flat_tree;  // flat tree representing flat_map
 
    typedef typename impl_tree_t::value_type              impl_value_type;
@@ -112,56 +130,56 @@ class flat_map
    typedef typename impl_tree_t::reverse_iterator        impl_reverse_iterator;
    typedef typename impl_tree_t::const_reverse_iterator  impl_const_reverse_iterator;
    typedef typename impl_tree_t::allocator_type          impl_allocator_type;
+   typedef allocator_traits                           allocator_traits_type;
 
-   template
-   static D &force(const S &s)
-   {  return *const_cast(reinterpret_cast(&s)); }
 
-   template
-   static D force_copy(S s)
-   {
-      value_type *vp = reinterpret_cast(&*s);
-      return D(vp);
-   }
 
    /// @endcond
 
    public:
 
    // typedefs:
-   typedef typename impl_tree_t::key_type               key_type;
-   typedef T                                            mapped_type;
-   typedef typename std::pair    value_type;
-   typedef typename     A::pointer                      pointer;
-   typedef typename     A::const_pointer                const_pointer;
-   typedef typename     A::reference                    reference;
-   typedef typename     A::const_reference              const_reference;
-   typedef containers_detail::flat_tree_value_compare
+   typedef Key                                              key_type;
+   typedef T                                                mapped_type;
+   typedef typename std::pair        value_type;
+   typedef typename allocator_traits_type::pointer          pointer;
+   typedef typename allocator_traits_type::const_pointer    const_pointer;
+   typedef typename allocator_traits_type::reference        reference;
+   typedef typename allocator_traits_type::const_reference  const_reference;
+   typedef typename impl_tree_t::size_type                  size_type;
+   typedef typename impl_tree_t::difference_type            difference_type;
+
+   typedef container_detail::flat_tree_value_compare
       < Pred
-      , containers_detail::select1st< std::pair >
-      , std::pair >                             value_compare;
-   typedef Pred                                         key_compare;
-   typedef typename containers_detail::
-      get_flat_tree_iterators::iterator        iterator;
-   typedef typename containers_detail::
-      get_flat_tree_iterators::const_iterator  const_iterator;
-   typedef typename containers_detail::
+      , container_detail::select1st< std::pair >
+      , std::pair >                                 value_compare;
+   typedef Pred                                             key_compare;
+   typedef typename container_detail::
+      get_flat_tree_iterators::iterator            iterator;
+   typedef typename container_detail::
+      get_flat_tree_iterators::const_iterator      const_iterator;
+   typedef typename container_detail::
       get_flat_tree_iterators
-         ::reverse_iterator                    reverse_iterator;
-   typedef typename containers_detail::
+         ::reverse_iterator                        reverse_iterator;
+   typedef typename container_detail::
       get_flat_tree_iterators
-         ::const_reverse_iterator              const_reverse_iterator;
-   typedef typename impl_tree_t::size_type              size_type;
-   typedef typename impl_tree_t::difference_type        difference_type;
-   typedef A                                        allocator_type;
-   typedef A                                        stored_allocator_type;
+         ::const_reverse_iterator                  const_reverse_iterator;
+   typedef A                                                allocator_type;
+   typedef A                                                stored_allocator_type;
+
+   public:
+   //! Effects: Default constructs an empty flat_map.
+   //! 
+   //! Complexity: Constant.
+   flat_map() 
+      : m_flat_tree() {}
 
    //! Effects: Constructs an empty flat_map using the specified
    //! comparison object and allocator.
    //! 
    //! Complexity: Constant.
-   explicit flat_map(const Pred& comp = Pred(), const allocator_type& a = allocator_type()) 
-      : m_flat_tree(comp, force(a)) {}
+   explicit flat_map(const Pred& comp, const allocator_type& a = allocator_type()) 
+      : m_flat_tree(comp, container_detail::force(a)) {}
 
    //! Effects: Constructs an empty flat_map using the specified comparison object and 
    //! allocator, and inserts elements from the range [first ,last ).
@@ -171,7 +189,7 @@ class flat_map
    template 
    flat_map(InputIterator first, InputIterator last, const Pred& comp = Pred(),
          const allocator_type& a = allocator_type())
-      : m_flat_tree(comp, force(a)) 
+      : m_flat_tree(comp, container_detail::force(a)) 
       { m_flat_tree.insert_unique(first, last); }
 
    //! Effects: Constructs an empty flat_map using the specified comparison object and 
@@ -224,27 +242,27 @@ class flat_map
    //! 
    //! Complexity: Constant.
    key_compare key_comp() const 
-      { return force(m_flat_tree.key_comp()); }
+      { return container_detail::force(m_flat_tree.key_comp()); }
 
    //! Effects: Returns an object of value_compare constructed out
    //!   of the comparison object.
    //! 
    //! Complexity: Constant.
    value_compare value_comp() const 
-      { return value_compare(force(m_flat_tree.key_comp())); }
+      { return value_compare(container_detail::force(m_flat_tree.key_comp())); }
 
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
    //! 
    //! Complexity: Constant.
    allocator_type get_allocator() const 
-      { return force(m_flat_tree.get_allocator()); }
+      { return container_detail::force(m_flat_tree.get_allocator()); }
 
    const stored_allocator_type &get_stored_allocator() const 
-      { return force(m_flat_tree.get_stored_allocator()); }
+      { return container_detail::force(m_flat_tree.get_stored_allocator()); }
 
    stored_allocator_type &get_stored_allocator()
-      { return force(m_flat_tree.get_stored_allocator()); }
+      { return container_detail::force(m_flat_tree.get_stored_allocator()); }
 
    //! Effects: Returns an iterator to the first element contained in the container.
    //! 
@@ -252,7 +270,7 @@ class flat_map
    //! 
    //! Complexity: Constant.
    iterator begin() 
-      { return force_copy(m_flat_tree.begin()); }
+      { return container_detail::force_copy(m_flat_tree.begin()); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
    //! 
@@ -260,7 +278,7 @@ class flat_map
    //! 
    //! Complexity: Constant.
    const_iterator begin() const 
-      { return force(m_flat_tree.begin()); }
+      { return container_detail::force(m_flat_tree.begin()); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
    //! 
@@ -268,7 +286,7 @@ class flat_map
    //! 
    //! Complexity: Constant.
    const_iterator cbegin() const 
-      { return force(m_flat_tree.cbegin()); }
+      { return container_detail::force(m_flat_tree.cbegin()); }
 
    //! Effects: Returns an iterator to the end of the container.
    //! 
@@ -276,7 +294,7 @@ class flat_map
    //! 
    //! Complexity: Constant.
    iterator end() 
-      { return force_copy(m_flat_tree.end()); }
+      { return container_detail::force_copy(m_flat_tree.end()); }
 
    //! Effects: Returns a const_iterator to the end of the container.
    //! 
@@ -284,7 +302,7 @@ class flat_map
    //! 
    //! Complexity: Constant.
    const_iterator end() const 
-      { return force(m_flat_tree.end()); }
+      { return container_detail::force(m_flat_tree.end()); }
 
    //! Effects: Returns a const_iterator to the end of the container.
    //! 
@@ -292,7 +310,7 @@ class flat_map
    //! 
    //! Complexity: Constant.
    const_iterator cend() const 
-      { return force(m_flat_tree.cend()); }
+      { return container_detail::force(m_flat_tree.cend()); }
 
    //! Effects: Returns a reverse_iterator pointing to the beginning 
    //! of the reversed container. 
@@ -301,7 +319,7 @@ class flat_map
    //! 
    //! Complexity: Constant.
    reverse_iterator rbegin() 
-      { return force(m_flat_tree.rbegin()); }
+      { return container_detail::force(m_flat_tree.rbegin()); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the beginning 
    //! of the reversed container. 
@@ -310,7 +328,7 @@ class flat_map
    //! 
    //! Complexity: Constant.
    const_reverse_iterator rbegin() const 
-      { return force(m_flat_tree.rbegin()); }
+      { return container_detail::force(m_flat_tree.rbegin()); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the beginning 
    //! of the reversed container. 
@@ -319,7 +337,7 @@ class flat_map
    //! 
    //! Complexity: Constant.
    const_reverse_iterator crbegin() const 
-      { return force(m_flat_tree.crbegin()); }
+      { return container_detail::force(m_flat_tree.crbegin()); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
    //! of the reversed container. 
@@ -328,7 +346,7 @@ class flat_map
    //! 
    //! Complexity: Constant.
    reverse_iterator rend() 
-      { return force(m_flat_tree.rend()); }
+      { return container_detail::force(m_flat_tree.rend()); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
    //! of the reversed container. 
@@ -337,7 +355,7 @@ class flat_map
    //! 
    //! Complexity: Constant.
    const_reverse_iterator rend() const 
-      { return force(m_flat_tree.rend()); }
+      { return container_detail::force(m_flat_tree.rend()); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
    //! of the reversed container. 
@@ -346,7 +364,7 @@ class flat_map
    //! 
    //! Complexity: Constant.
    const_reverse_iterator crend() const 
-      { return force(m_flat_tree.crend()); }
+      { return container_detail::force(m_flat_tree.crend()); }
 
    //! Effects: Returns true if the container contains no elements.
    //! 
@@ -372,20 +390,14 @@ class flat_map
    size_type max_size() const 
       { return m_flat_tree.max_size(); }
 
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
    //! Effects: If there is no key equivalent to x in the flat_map, inserts 
    //!   value_type(x, T()) into the flat_map.
    //! 
    //! Returns: A reference to the mapped_type corresponding to x in *this.
    //! 
    //! Complexity: Logarithmic.
-   T &operator[](const key_type& k) 
-   {
-      iterator i = lower_bound(k);
-      // i->first is greater than or equivalent to k.
-      if (i == end() || key_comp()(k, (*i).first))
-         i = insert(i, value_type(k, T()));
-      return (*i).second;
-   }
+   mapped_type &operator[](const key_type& k);
 
    //! Effects: If there is no key equivalent to x in the flat_map, inserts 
    //! value_type(move(x), T()) into the flat_map (the key is move-constructed)
@@ -393,15 +405,11 @@ class flat_map
    //! Returns: A reference to the mapped_type corresponding to x in *this.
    //! 
    //! Complexity: Logarithmic.
-   T &operator[](BOOST_RV_REF(key_type) mk) 
-   {
-      key_type &k = mk;
-      iterator i = lower_bound(k);
-      // i->first is greater than or equivalent to k.
-      if (i == end() || key_comp()(k, (*i).first))
-         i = insert(i, value_type(boost::move(k), boost::move(T())));
-      return (*i).second;
-   }
+   mapped_type &operator[](key_type &&k) ;
+
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, priv_subscript)
+   #endif
 
    //! Returns: A reference to the element whose key is equivalent to x.
    //! Throws: An exception object of type out_of_range if no such element is present.
@@ -448,8 +456,8 @@ class flat_map
    //!
    //! Note: If an element it's inserted it might invalidate elements.
    std::pair insert(const value_type& x) 
-      { return force >(
-         m_flat_tree.insert_unique(force(x))); }
+      { return container_detail::force >(
+         m_flat_tree.insert_unique(container_detail::force(x))); }
 
    //! Effects: Inserts a new value_type move constructed from the pair if and
    //! only if there is no element in the container with key equivalent to the key of x.
@@ -463,8 +471,8 @@ class flat_map
    //!
    //! Note: If an element it's inserted it might invalidate elements.
    std::pair insert(BOOST_RV_REF(value_type) x) 
-   {  return force >(
-      m_flat_tree.insert_unique(boost::move(force(x)))); }
+   {  return container_detail::force >(
+      m_flat_tree.insert_unique(boost::move(container_detail::force(x)))); }
 
    //! Effects: Inserts a new value_type move constructed from the pair if and
    //! only if there is no element in the container with key equivalent to the key of x.
@@ -479,7 +487,7 @@ class flat_map
    //! Note: If an element it's inserted it might invalidate elements.
    std::pair insert(BOOST_RV_REF(impl_value_type) x) 
    {
-      return force >
+      return container_detail::force >
       (m_flat_tree.insert_unique(boost::move(x)));
    }
 
@@ -495,8 +503,8 @@ class flat_map
    //!
    //! Note: If an element it's inserted it might invalidate elements.
    iterator insert(const_iterator position, const value_type& x)
-      { return force_copy(
-         m_flat_tree.insert_unique(force(position), force(x))); }
+      { return container_detail::force_copy(
+         m_flat_tree.insert_unique(container_detail::force(position), container_detail::force(x))); }
 
    //! Effects: Inserts an element move constructed from x in the container.
    //!   p is a hint pointing to where the insert should start to search.
@@ -508,8 +516,8 @@ class flat_map
    //!
    //! Note: If an element it's inserted it might invalidate elements.
    iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
-      { return force_copy(
-         m_flat_tree.insert_unique(force(position), boost::move(force(x)))); }
+      { return container_detail::force_copy(
+         m_flat_tree.insert_unique(container_detail::force(position), boost::move(container_detail::force(x)))); }
 
    //! Effects: Inserts an element move constructed from x in the container.
    //!   p is a hint pointing to where the insert should start to search.
@@ -522,8 +530,8 @@ class flat_map
    //! Note: If an element it's inserted it might invalidate elements.
    iterator insert(const_iterator position, BOOST_RV_REF(impl_value_type) x)
    {
-      return force_copy(
-         m_flat_tree.insert_unique(force(position), boost::move(x)));
+      return container_detail::force_copy(
+         m_flat_tree.insert_unique(container_detail::force(position), boost::move(x)));
    }
 
    //! Requires: first, last are not iterators into *this.
@@ -539,7 +547,7 @@ class flat_map
    void insert(InputIterator first, InputIterator last) 
    {  m_flat_tree.insert_unique(first, last);  }
 
-   #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... if and only if there is no element in the container 
@@ -555,7 +563,7 @@ class flat_map
    //! Note: If an element it's inserted it might invalidate elements.
    template 
    iterator emplace(Args&&... args)
-   {  return force_copy(m_flat_tree.emplace_unique(boost::forward(args)...)); }
+   {  return container_detail::force_copy(m_flat_tree.emplace_unique(boost::forward(args)...)); }
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... in the container if and only if there is 
@@ -571,36 +579,27 @@ class flat_map
    //! Note: If an element it's inserted it might invalidate elements.
    template 
    iterator emplace_hint(const_iterator hint, Args&&... args)
-   {  return force_copy(m_flat_tree.emplace_hint_unique(force(hint), boost::forward(args)...)); }
+   {  return container_detail::force_copy(m_flat_tree.emplace_hint_unique(container_detail::force(hint), boost::forward(args)...)); }
 
-   #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
-   iterator emplace()
-   {  return force_copy(m_flat_tree.emplace_unique()); }
-
-   iterator emplace_hint(const_iterator hint)
-   {  return force_copy(m_flat_tree.emplace_hint_unique(force(hint))); }
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                                    \
-   template                                                         \
-   iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                            \
-   {                                                                                                  \
-      return force_copy(m_flat_tree.emplace_unique                                               \
-         (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)));                                 \
-   }                                                                                                  \
-                                                                                                      \
-   template                                                         \
-   iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))  \
-   {                                                                                                  \
-      return force_copy(m_flat_tree.emplace_hint_unique                                          \
-         (force(hint),                                                           \
-         BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)));                                  \
-   }                                                                                                  \
+   #define BOOST_PP_LOCAL_MACRO(n)                                                                 \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)          \
+   iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                           \
+   {  return container_detail::force_copy(m_flat_tree.emplace_unique                                       \
+               (BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); }                        \
+                                                                                                   \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)          \
+   iterator emplace_hint(const_iterator hint                                                       \
+                         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))             \
+   {  return container_detail::force_copy(m_flat_tree.emplace_hint_unique                                  \
+            (container_detail::force(hint)                                                      \
+               BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); }                \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif   //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! Effects: Erases the element pointed to by position.
    //!
@@ -613,7 +612,7 @@ class flat_map
    //! Note: Invalidates elements with keys
    //!   not less than the erased element.
    iterator erase(const_iterator position) 
-      { return force_copy(m_flat_tree.erase(force(position))); }
+      { return container_detail::force_copy(m_flat_tree.erase(container_detail::force(position))); }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
    //!
@@ -633,7 +632,7 @@ class flat_map
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
    iterator erase(const_iterator first, const_iterator last)
-      { return force_copy(m_flat_tree.erase(force(first), force(last))); }
+      { return container_detail::force_copy(m_flat_tree.erase(container_detail::force(first), container_detail::force(last))); }
 
    //! Effects: erase(a.begin(),a.end()).
    //!
@@ -657,14 +656,14 @@ class flat_map
    //!
    //! Complexity: Logarithmic.
    iterator find(const key_type& x) 
-      { return force_copy(m_flat_tree.find(x)); }
+      { return container_detail::force_copy(m_flat_tree.find(x)); }
 
    //! Returns: A const_iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.s
    const_iterator find(const key_type& x) const 
-      { return force(m_flat_tree.find(x)); }
+      { return container_detail::force(m_flat_tree.find(x)); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
@@ -677,40 +676,40 @@ class flat_map
    //!
    //! Complexity: Logarithmic
    iterator lower_bound(const key_type& x) 
-      {  return force_copy(m_flat_tree.lower_bound(x)); }
+      {  return container_detail::force_copy(m_flat_tree.lower_bound(x)); }
 
    //! Returns: A const iterator pointing to the first element with key not
    //!   less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
    const_iterator lower_bound(const key_type& x) const 
-      {  return force(m_flat_tree.lower_bound(x)); }
+      {  return container_detail::force(m_flat_tree.lower_bound(x)); }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
    iterator upper_bound(const key_type& x) 
-      {  return force_copy(m_flat_tree.upper_bound(x)); }
+      {  return container_detail::force_copy(m_flat_tree.upper_bound(x)); }
 
    //! Returns: A const iterator pointing to the first element with key not
    //!   less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
    const_iterator upper_bound(const key_type& x) const 
-      {  return force(m_flat_tree.upper_bound(x)); }
+      {  return container_detail::force(m_flat_tree.upper_bound(x)); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
    std::pair equal_range(const key_type& x) 
-      {  return force >(m_flat_tree.equal_range(x)); }
+      {  return container_detail::force >(m_flat_tree.equal_range(x)); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
    std::pair equal_range(const key_type& x) const 
-      {  return force >(m_flat_tree.equal_range(x)); }
+      {  return container_detail::force >(m_flat_tree.equal_range(x)); }
 
    //! Effects: Number of elements for which memory has been allocated.
    //!   capacity() is always greater than or equal to size().
@@ -740,6 +739,29 @@ class flat_map
    template 
    friend bool operator< (const flat_map&,
                            const flat_map&);
+
+   private:
+   mapped_type &priv_subscript(const key_type& k)
+   {
+      iterator i = lower_bound(k);
+      // i->first is greater than or equivalent to k.
+      if (i == end() || key_comp()(k, (*i).first)){
+         container_detail::value_init m;
+         i = insert(i, impl_value_type(k, ::boost::move(m.m_t)));
+      }
+      return (*i).second;
+   }
+   mapped_type &priv_subscript(BOOST_RV_REF(key_type) mk) 
+   {
+      key_type &k = mk;
+      iterator i = lower_bound(k);
+      // i->first is greater than or equivalent to k.
+      if (i == end() || key_comp()(k, (*i).first)){
+         container_detail::value_init m;
+         i = insert(i, impl_value_type(boost::move(k), ::boost::move(m.m_t)));
+      }
+      return (*i).second;
+   }
    /// @endcond
 };
 
@@ -833,18 +855,18 @@ class flat_multimap
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(flat_multimap)
-   typedef containers_detail::flat_tree, 
-                           containers_detail::select1st< std::pair >, 
+                           container_detail::select1st< std::pair >, 
                            Pred, 
                            A> tree_t;
    //This is the real tree stored here. It's based on a movable pair
-   typedef containers_detail::flat_tree, 
-                           containers_detail::select1st >, 
+   typedef container_detail::flat_tree, 
+                           container_detail::select1st >, 
                            Pred, 
-                           typename     A::template
-                              rebind >::other> impl_tree_t;
+                           typename allocator_traits::template portable_rebind_alloc
+                               >::type> impl_tree_t;
    impl_tree_t m_flat_tree;  // flat tree representing flat_map
 
    typedef typename impl_tree_t::value_type              impl_value_type;
@@ -858,56 +880,55 @@ class flat_multimap
    typedef typename impl_tree_t::reverse_iterator        impl_reverse_iterator;
    typedef typename impl_tree_t::const_reverse_iterator  impl_const_reverse_iterator;
    typedef typename impl_tree_t::allocator_type          impl_allocator_type;
+   typedef allocator_traits                           allocator_traits_type;
 
-   template
-   static D &force(const S &s)
-   {  return *const_cast((reinterpret_cast(&s))); }
-
-   template
-   static D force_copy(S s)
-   {
-      value_type *vp = reinterpret_cast(&*s);
-      return D(vp);
-   }
    /// @endcond
 
    public:
 
    // typedefs:
-   typedef typename impl_tree_t::key_type               key_type;
-   typedef T                                            mapped_type;
-   typedef typename std::pair    value_type;
-   typedef typename     A::pointer                      pointer;
-   typedef typename     A::const_pointer                const_pointer;
-   typedef typename     A::reference                    reference;
-   typedef typename     A::const_reference              const_reference;
-   typedef containers_detail::flat_tree_value_compare
+   typedef Key                                              key_type;
+   typedef T                                                mapped_type;
+   typedef Pred                                             key_compare;
+   typedef typename std::pair        value_type;
+   typedef typename allocator_traits_type::pointer          pointer;
+   typedef typename allocator_traits_type::const_pointer    const_pointer;
+   typedef typename allocator_traits_type::reference        reference;
+   typedef typename allocator_traits_type::const_reference  const_reference;
+   typedef typename impl_tree_t::size_type                  size_type;
+   typedef typename impl_tree_t::difference_type            difference_type;
+   typedef container_detail::flat_tree_value_compare
       < Pred
-      , containers_detail::select1st< std::pair >
-      , std::pair >                             value_compare;
-   typedef Pred                                         key_compare;
-   typedef typename containers_detail::
-      get_flat_tree_iterators::iterator        iterator;
-   typedef typename containers_detail::
-      get_flat_tree_iterators::const_iterator  const_iterator;
-   typedef typename containers_detail::
+      , container_detail::select1st< std::pair >
+      , std::pair >                                 value_compare;
+
+   typedef typename container_detail::
+      get_flat_tree_iterators::iterator            iterator;
+   typedef typename container_detail::
+      get_flat_tree_iterators::const_iterator      const_iterator;
+   typedef typename container_detail::
       get_flat_tree_iterators
-         ::reverse_iterator                    reverse_iterator;
-   typedef typename containers_detail::
+         ::reverse_iterator                        reverse_iterator;
+   typedef typename container_detail::
       get_flat_tree_iterators
-         ::const_reverse_iterator              const_reverse_iterator;
-   typedef typename impl_tree_t::size_type              size_type;
-   typedef typename impl_tree_t::difference_type        difference_type;
-   typedef A                                        allocator_type;
-   typedef A                                        stored_allocator_type;
+         ::const_reverse_iterator                  const_reverse_iterator;
+   typedef A                                                allocator_type;
+   //Non-standard extension
+   typedef A                                                stored_allocator_type;
+
+   //! Effects: Default constructs an empty flat_map.
+   //! 
+   //! Complexity: Constant.
+   flat_multimap() 
+      : m_flat_tree() {}
 
    //! Effects: Constructs an empty flat_multimap using the specified comparison
    //!   object and allocator.
    //! 
    //! Complexity: Constant.
-   explicit flat_multimap(const Pred& comp = Pred(),
+   explicit flat_multimap(const Pred& comp,
                           const allocator_type& a = allocator_type())
-      : m_flat_tree(comp, force(a)) { }
+      : m_flat_tree(comp, container_detail::force(a)) { }
 
    //! Effects: Constructs an empty flat_multimap using the specified comparison object
    //!   and allocator, and inserts elements from the range [first ,last ).
@@ -918,7 +939,7 @@ class flat_multimap
    flat_multimap(InputIterator first, InputIterator last,
             const Pred& comp        = Pred(),
             const allocator_type& a = allocator_type())
-      : m_flat_tree(comp, force(a)) 
+      : m_flat_tree(comp, container_detail::force(a)) 
       { m_flat_tree.insert_equal(first, last); }
 
    //! Effects: Constructs an empty flat_multimap using the specified comparison object and 
@@ -967,27 +988,27 @@ class flat_multimap
    //! 
    //! Complexity: Constant.
    key_compare key_comp() const 
-      { return force(m_flat_tree.key_comp()); }
+      { return container_detail::force(m_flat_tree.key_comp()); }
 
    //! Effects: Returns an object of value_compare constructed out
    //!   of the comparison object.
    //! 
    //! Complexity: Constant.
    value_compare value_comp() const 
-      { return value_compare(force(m_flat_tree.key_comp())); }
+      { return value_compare(container_detail::force(m_flat_tree.key_comp())); }
 
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
    //! 
    //! Complexity: Constant.
    allocator_type get_allocator() const 
-      { return force(m_flat_tree.get_allocator()); }
+      { return container_detail::force(m_flat_tree.get_allocator()); }
 
    const stored_allocator_type &get_stored_allocator() const 
-      { return force(m_flat_tree.get_stored_allocator()); }
+      { return container_detail::force(m_flat_tree.get_stored_allocator()); }
 
    stored_allocator_type &get_stored_allocator()
-      { return force(m_flat_tree.get_stored_allocator()); }
+      { return container_detail::force(m_flat_tree.get_stored_allocator()); }
 
    //! Effects: Returns an iterator to the first element contained in the container.
    //! 
@@ -995,7 +1016,7 @@ class flat_multimap
    //! 
    //! Complexity: Constant.
    iterator begin() 
-      { return force_copy(m_flat_tree.begin()); }
+      { return container_detail::force_copy(m_flat_tree.begin()); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
    //! 
@@ -1003,7 +1024,7 @@ class flat_multimap
    //! 
    //! Complexity: Constant.
    const_iterator begin() const 
-      { return force(m_flat_tree.begin()); }
+      { return container_detail::force(m_flat_tree.begin()); }
 
    //! Effects: Returns an iterator to the end of the container.
    //! 
@@ -1011,7 +1032,7 @@ class flat_multimap
    //! 
    //! Complexity: Constant.
    iterator end() 
-      { return force_copy(m_flat_tree.end()); }
+      { return container_detail::force_copy(m_flat_tree.end()); }
 
    //! Effects: Returns a const_iterator to the end of the container.
    //! 
@@ -1019,7 +1040,7 @@ class flat_multimap
    //! 
    //! Complexity: Constant.
    const_iterator end() const 
-      { return force(m_flat_tree.end()); }
+      { return container_detail::force(m_flat_tree.end()); }
 
    //! Effects: Returns a reverse_iterator pointing to the beginning 
    //! of the reversed container. 
@@ -1028,7 +1049,7 @@ class flat_multimap
    //! 
    //! Complexity: Constant.
    reverse_iterator rbegin() 
-      { return force(m_flat_tree.rbegin()); }
+      { return container_detail::force(m_flat_tree.rbegin()); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the beginning 
    //! of the reversed container. 
@@ -1037,7 +1058,7 @@ class flat_multimap
    //! 
    //! Complexity: Constant.
    const_reverse_iterator rbegin() const 
-      { return force(m_flat_tree.rbegin()); }
+      { return container_detail::force(m_flat_tree.rbegin()); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
    //! of the reversed container. 
@@ -1046,7 +1067,7 @@ class flat_multimap
    //! 
    //! Complexity: Constant.
    reverse_iterator rend() 
-      { return force(m_flat_tree.rend()); }
+      { return container_detail::force(m_flat_tree.rend()); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
    //! of the reversed container. 
@@ -1055,7 +1076,7 @@ class flat_multimap
    //! 
    //! Complexity: Constant.
    const_reverse_iterator rend() const 
-      { return force(m_flat_tree.rend()); }
+      { return container_detail::force(m_flat_tree.rend()); }
 
    //! Effects: Returns true if the container contains no elements.
    //! 
@@ -1098,7 +1119,7 @@ class flat_multimap
    //!
    //! Note: If an element it's inserted it might invalidate elements.
    iterator insert(const value_type& x) 
-      { return force_copy(m_flat_tree.insert_equal(force(x))); }
+      { return container_detail::force_copy(m_flat_tree.insert_equal(container_detail::force(x))); }
 
    //! Effects: Inserts a new value move-constructed from x and returns 
    //!   the iterator pointing to the newly inserted element. 
@@ -1108,7 +1129,7 @@ class flat_multimap
    //!
    //! Note: If an element it's inserted it might invalidate elements.
    iterator insert(BOOST_RV_REF(value_type) x) 
-   { return force_copy(m_flat_tree.insert_equal(boost::move(x))); }
+   { return container_detail::force_copy(m_flat_tree.insert_equal(boost::move(x))); }
 
    //! Effects: Inserts a new value move-constructed from x and returns 
    //!   the iterator pointing to the newly inserted element. 
@@ -1118,7 +1139,7 @@ class flat_multimap
    //!
    //! Note: If an element it's inserted it might invalidate elements.
    iterator insert(BOOST_RV_REF(impl_value_type) x) 
-      { return force_copy(m_flat_tree.insert_equal(boost::move(x))); }
+      { return container_detail::force_copy(m_flat_tree.insert_equal(boost::move(x))); }
 
    //! Effects: Inserts a copy of x in the container.
    //!   p is a hint pointing to where the insert should start to search.
@@ -1132,7 +1153,7 @@ class flat_multimap
    //!
    //! Note: If an element it's inserted it might invalidate elements.
    iterator insert(const_iterator position, const value_type& x) 
-      { return force_copy(m_flat_tree.insert_equal(force(position), force(x))); }
+      { return container_detail::force_copy(m_flat_tree.insert_equal(container_detail::force(position), container_detail::force(x))); }
 
    //! Effects: Inserts a value move constructed from x in the container.
    //!   p is a hint pointing to where the insert should start to search.
@@ -1147,8 +1168,8 @@ class flat_multimap
    //! Note: If an element it's inserted it might invalidate elements.
    iterator insert(const_iterator position, BOOST_RV_REF(value_type) x) 
    {
-      return force_copy
-         (m_flat_tree.insert_equal(force(position)
+      return container_detail::force_copy
+         (m_flat_tree.insert_equal(container_detail::force(position)
                                   , boost::move(x)));
    }
 
@@ -1165,8 +1186,8 @@ class flat_multimap
    //! Note: If an element it's inserted it might invalidate elements.
    iterator insert(const_iterator position, BOOST_RV_REF(impl_value_type) x) 
    {
-      return force_copy(
-         m_flat_tree.insert_equal(force(position), boost::move(x)));
+      return container_detail::force_copy(
+         m_flat_tree.insert_equal(container_detail::force(position), boost::move(x)));
    }
 
    //! Requires: first, last are not iterators into *this.
@@ -1181,7 +1202,7 @@ class flat_multimap
    void insert(InputIterator first, InputIterator last) 
       {  m_flat_tree.insert_equal(first, last); }
 
-   #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... and returns the iterator pointing to the
@@ -1193,7 +1214,7 @@ class flat_multimap
    //! Note: If an element it's inserted it might invalidate elements.
    template 
    iterator emplace(Args&&... args)
-   {  return force_copy(m_flat_tree.emplace_equal(boost::forward(args)...)); }
+   {  return container_detail::force_copy(m_flat_tree.emplace_equal(boost::forward(args)...)); }
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... in the container.
@@ -1210,38 +1231,29 @@ class flat_multimap
    template 
    iterator emplace_hint(const_iterator hint, Args&&... args)
    {
-      return force_copy(m_flat_tree.emplace_hint_equal
-         (force(hint), boost::forward(args)...));
+      return container_detail::force_copy(m_flat_tree.emplace_hint_equal
+         (container_detail::force(hint), boost::forward(args)...));
    }
 
-   #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
-   iterator emplace()
-   {  return force_copy(m_flat_tree.emplace_equal()); }
-
-   iterator emplace_hint(const_iterator hint)
-   {  return force_copy(m_flat_tree.emplace_hint_equal(force(hint))); }
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                                    \
-   template                                                         \
-   iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                            \
-   {                                                                                                  \
-      return force_copy(m_flat_tree.emplace_equal                                                \
-         (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)));                                 \
-   }                                                                                                  \
-                                                                                                      \
-   template                                                         \
-   iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))  \
-   {                                                                                                  \
-      return force_copy(m_flat_tree.emplace_hint_equal                                           \
-         (force(hint),                                                           \
-            BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)));                               \
-   }                                                                                                  \
+   #define BOOST_PP_LOCAL_MACRO(n)                                                                 \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)          \
+   iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                           \
+   {  return container_detail::force_copy(m_flat_tree.emplace_equal                                        \
+               (BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); }                        \
+                                                                                                   \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)          \
+   iterator emplace_hint(const_iterator hint                                                       \
+                         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))             \
+   {  return container_detail::force_copy(m_flat_tree.emplace_hint_equal                                   \
+            (container_detail::force(hint)                                                      \
+               BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); }                \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif   //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! Effects: Erases the element pointed to by position.
    //!
@@ -1254,7 +1266,7 @@ class flat_multimap
    //! Note: Invalidates elements with keys
    //!   not less than the erased element.
    iterator erase(const_iterator position) 
-      { return force_copy(m_flat_tree.erase(force(position))); }
+      { return container_detail::force_copy(m_flat_tree.erase(container_detail::force(position))); }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
    //!
@@ -1274,7 +1286,7 @@ class flat_multimap
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
    iterator erase(const_iterator first, const_iterator last)
-      { return force_copy(m_flat_tree.erase(force(first), force(last))); }
+      { return container_detail::force_copy(m_flat_tree.erase(container_detail::force(first), container_detail::force(last))); }
 
    //! Effects: erase(a.begin(),a.end()).
    //!
@@ -1298,14 +1310,14 @@ class flat_multimap
    //!
    //! Complexity: Logarithmic.
    iterator find(const key_type& x)
-      { return force_copy(m_flat_tree.find(x)); }
+      { return container_detail::force_copy(m_flat_tree.find(x)); }
 
    //! Returns: An const_iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
    const_iterator find(const key_type& x) const 
-      { return force(m_flat_tree.find(x)); }
+      { return container_detail::force(m_flat_tree.find(x)); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
@@ -1318,41 +1330,41 @@ class flat_multimap
    //!
    //! Complexity: Logarithmic
    iterator lower_bound(const key_type& x) 
-      {return force_copy(m_flat_tree.lower_bound(x)); }
+      {return container_detail::force_copy(m_flat_tree.lower_bound(x)); }
 
    //! Returns: A const iterator pointing to the first element with key
    //!   not less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
    const_iterator lower_bound(const key_type& x) const 
-      {  return force(m_flat_tree.lower_bound(x));  }
+      {  return container_detail::force(m_flat_tree.lower_bound(x));  }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
    iterator upper_bound(const key_type& x) 
-      {return force_copy(m_flat_tree.upper_bound(x)); }
+      {return container_detail::force_copy(m_flat_tree.upper_bound(x)); }
 
    //! Returns: A const iterator pointing to the first element with key
    //!   not less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
    const_iterator upper_bound(const key_type& x) const 
-      {  return force(m_flat_tree.upper_bound(x)); }
+      {  return container_detail::force(m_flat_tree.upper_bound(x)); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
    std::pair equal_range(const key_type& x) 
-      {  return force_copy >(m_flat_tree.equal_range(x));   }
+      {  return container_detail::force_copy >(m_flat_tree.equal_range(x));   }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
    std::pair 
       equal_range(const key_type& x) const 
-      {  return force_copy >(m_flat_tree.equal_range(x));   }
+      {  return container_detail::force_copy >(m_flat_tree.equal_range(x));   }
 
    //! Effects: Number of elements for which memory has been allocated.
    //!   capacity() is always greater than or equal to size().
@@ -1440,4 +1452,4 @@ struct has_trivial_destructor_after_move< boost::container::flat_multimap
 
-#endif /* BOOST_CONTAINERS_FLAT_MAP_HPP */
+#endif /* BOOST_CONTAINER_FLAT_MAP_HPP */
diff --git a/include/boost/container/flat_set.hpp b/include/boost/container/flat_set.hpp
index 694a072..07e1f1f 100644
--- a/include/boost/container/flat_set.hpp
+++ b/include/boost/container/flat_set.hpp
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_FLAT_SET_HPP
-#define BOOST_CONTAINERS_FLAT_SET_HPP
+#ifndef BOOST_CONTAINER_FLAT_SET_HPP
+#define BOOST_CONTAINER_FLAT_SET_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -74,9 +74,9 @@ class flat_set
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(flat_set)
-   typedef containers_detail::flat_tree, Pred, A> tree_t;
+   typedef container_detail::flat_tree, Pred, A> tree_t;
    tree_t m_flat_tree;  // flat tree representing flat_set
-   typedef typename containers_detail::
+   typedef typename container_detail::
       move_const_ref_type::type insert_const_ref_type;
    /// @endcond
 
@@ -100,11 +100,18 @@ class flat_set
    typedef typename tree_t::allocator_type         allocator_type;
    typedef typename tree_t::stored_allocator_type  stored_allocator_type;
 
+   //! Effects: Defatuls constructs an empty flat_map.
+   //! 
+   //! Complexity: Constant.
+   explicit flat_set()
+      : m_flat_tree()
+   {}
+
    //! Effects: Constructs an empty flat_map using the specified
    //! comparison object and allocator.
    //! 
    //! Complexity: Constant.
-   explicit flat_set(const Pred& comp = Pred(),
+   explicit flat_set(const Pred& comp,
                      const allocator_type& a = allocator_type())
       : m_flat_tree(comp, a)
    {}
@@ -344,7 +351,7 @@ class flat_set
    { return this->insert(const_cast(x)); }
 
    template
-   std::pair insert(const U &u, typename containers_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
+   std::pair insert(const U &u, typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
    {  return priv_insert(u); }
    #endif
 
@@ -381,7 +388,7 @@ class flat_set
    { return this->insert(position, const_cast(x)); }
 
    template
-   iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
+   iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
    {  return priv_insert(position, u); }
    #endif
 
@@ -410,7 +417,7 @@ class flat_set
    void insert(InputIterator first, InputIterator last) 
       {  m_flat_tree.insert_unique(first, last);  }
 
-   #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... if and only if there is no element in the container 
@@ -444,27 +451,23 @@ class flat_set
    iterator emplace_hint(const_iterator hint, Args&&... args)
    {  return m_flat_tree.emplace_hint_unique(hint, boost::forward(args)...); }
 
-   #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
-   iterator emplace()
-   {  return m_flat_tree.emplace_unique(); }
-
-   iterator emplace_hint(const_iterator hint)
-   {  return m_flat_tree.emplace_hint_unique(hint); }
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                                             \
-   template                                                                  \
-   iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                                     \
-   {  return m_flat_tree.emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); }           \
-                                                                                                               \
-   template                                                                  \
-   iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))           \
-   {  return m_flat_tree.emplace_hint_unique(hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); }\
+   #define BOOST_PP_LOCAL_MACRO(n)                                                                 \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)          \
+   iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                           \
+   {  return m_flat_tree.emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \
+                                                                                                   \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)          \
+   iterator emplace_hint(const_iterator hint                                                       \
+                         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))             \
+   {  return m_flat_tree.emplace_hint_unique                                                       \
+            (hint BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); }              \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif   //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! Effects: Erases the element pointed to by position.
    //!
@@ -702,9 +705,9 @@ class flat_multiset
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(flat_multiset)
-   typedef containers_detail::flat_tree, Pred, A> tree_t;
+   typedef container_detail::flat_tree, Pred, A> tree_t;
    tree_t m_flat_tree;  // flat tree representing flat_multiset
-   typedef typename containers_detail::
+   typedef typename container_detail::
       move_const_ref_type::type insert_const_ref_type;
    /// @endcond
 
@@ -727,8 +730,14 @@ class flat_multiset
    typedef typename tree_t::allocator_type         allocator_type;
    typedef typename tree_t::stored_allocator_type  stored_allocator_type;
 
-   // allocation/deallocation
-   explicit flat_multiset(const Pred& comp = Pred(),
+   //! Effects: Defatuls constructs an empty flat_map.
+   //! 
+   //! Complexity: Constant.
+   explicit flat_multiset()
+      : m_flat_tree()
+   {}
+
+   explicit flat_multiset(const Pred& comp,
                           const allocator_type& a = allocator_type())
       : m_flat_tree(comp, a) {}
 
@@ -943,7 +952,7 @@ class flat_multiset
    { return this->insert(const_cast(x)); }
 
    template
-   iterator insert(const U &u, typename containers_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
+   iterator insert(const U &u, typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
    {  return priv_insert(u); }
    #endif
 
@@ -975,7 +984,7 @@ class flat_multiset
    { return this->insert(position, const_cast(x)); }
 
    template
-   iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
+   iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
    {  return priv_insert(position, u); }
    #endif
 
@@ -1004,7 +1013,7 @@ class flat_multiset
    void insert(InputIterator first, InputIterator last) 
       {  m_flat_tree.insert_equal(first, last);  }
 
-   #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... and returns the iterator pointing to the
@@ -1033,27 +1042,23 @@ class flat_multiset
    iterator emplace_hint(const_iterator hint, Args&&... args)
    {  return m_flat_tree.emplace_hint_equal(hint, boost::forward(args)...); }
 
-   #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
-   iterator emplace()
-   {  return m_flat_tree.emplace_equal(); }
-
-   iterator emplace_hint(const_iterator hint)
-   {  return m_flat_tree.emplace_hint_equal(hint); }
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                                             \
-   template                                                                  \
-   iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                                     \
-   {  return m_flat_tree.emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); }            \
-                                                                                                               \
-   template                                                                  \
-   iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))           \
-   {  return m_flat_tree.emplace_hint_equal(hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); } \
+   #define BOOST_PP_LOCAL_MACRO(n)                                                                 \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)          \
+   iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                           \
+   {  return m_flat_tree.emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); }  \
+                                                                                                   \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)          \
+   iterator emplace_hint(const_iterator hint                                                       \
+                         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))             \
+   {  return m_flat_tree.emplace_hint_equal                                                        \
+            (hint BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); }              \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif   //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! Effects: Erases the element pointed to by position.
    //!
@@ -1258,4 +1263,4 @@ namespace container {
 
 #include 
 
-#endif /* BOOST_CONTAINERS_FLAT_SET_HPP */
+#endif /* BOOST_CONTAINER_FLAT_SET_HPP */
diff --git a/include/boost/container/list.hpp b/include/boost/container/list.hpp
index ad4aecf..03ba7f1 100644
--- a/include/boost/container/list.hpp
+++ b/include/boost/container/list.hpp
@@ -7,8 +7,8 @@
 // See http://www.boost.org/libs/container for documentation.
 //
 
-#ifndef BOOST_CONTAINERS_LIST_HPP_
-#define BOOST_CONTAINERS_LIST_HPP_
+#ifndef BOOST_CONTAINER_LIST_HPP_
+#define BOOST_CONTAINER_LIST_HPP_
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -20,15 +20,16 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
-#if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 #else
 //Preprocessor library to emulate perfect forwarding
 #include  
@@ -51,13 +52,13 @@ namespace container {
 #endif
 
 /// @cond
-namespace containers_detail {
+namespace container_detail {
 
 template
 struct list_hook
 {
-   typedef typename containers_detail::bi::make_list_base_hook
-      , containers_detail::bi::link_mode >::type type;
+   typedef typename container_detail::bi::make_list_base_hook
+      , container_detail::bi::link_mode >::type type;
 };
 
 template 
@@ -65,33 +66,28 @@ struct list_node
    :  public list_hook::type
 {
 
-   #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
    list_node()
       : m_data()
    {}
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    template
    list_node(Args &&...args)
       : m_data(boost::forward(args)...)
    {}
 
-   #else //#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
-
-   list_node()
-      : m_data()
-   {}
+   #else //#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 
    #define BOOST_PP_LOCAL_MACRO(n)                                                           \
    template                                                \
-   list_node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                          \
-      : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _))                     \
+   list_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                          \
+      : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))                     \
    {}                                                                                        \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif//#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif//#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 
    T m_data;
 };
@@ -99,21 +95,25 @@ struct list_node
 template
 struct intrusive_list_type
 {
-   typedef typename A::value_type               value_type;
-   typedef typename boost::pointer_to_other
-      ::type         void_pointer;
-   typedef typename containers_detail::list_node
+   typedef boost::container::allocator_traits   allocator_traits_type;
+   typedef typename allocator_traits_type::value_type value_type;
+   typedef typename boost::intrusive::pointer_traits
+      ::template
+         rebind_pointer::type
+            void_pointer;
+   typedef typename container_detail::list_node
                       node_type;
-   typedef typename containers_detail::bi::make_list
+   typedef typename container_detail::bi::make_list
       < node_type
-      , containers_detail::bi::base_hook::type>
-      , containers_detail::bi::constant_time_size
-      , containers_detail::bi::size_type
+      , container_detail::bi::base_hook::type>
+      , container_detail::bi::constant_time_size
+      , container_detail::bi::size_type
+         
       >::type                                   container_type;
    typedef container_type                       type ;
 };
 
-}  //namespace containers_detail {
+}  //namespace container_detail {
 /// @endcond
 
 //! A list is a doubly linked list. That is, it is a Sequence that supports both
@@ -132,22 +132,23 @@ template  >
 template 
 #endif
 class list 
-   : protected containers_detail::node_alloc_holder
-      ::type>
+   : protected container_detail::node_alloc_holder
+      ::type>
 {
    /// @cond
    typedef typename 
-      containers_detail::intrusive_list_type::type Icont;
+      container_detail::intrusive_list_type::type Icont;
    typedef list                                 ThisType;
-   typedef containers_detail::node_alloc_holder        AllocHolder;
+   typedef container_detail::node_alloc_holder        AllocHolder;
    typedef typename AllocHolder::NodePtr              NodePtr;
    typedef typename AllocHolder::NodeAlloc            NodeAlloc;
    typedef typename AllocHolder::ValAlloc             ValAlloc;
    typedef typename AllocHolder::Node                 Node;
-   typedef containers_detail::allocator_destroyer     Destroyer;
+   typedef container_detail::allocator_destroyer     Destroyer;
    typedef typename AllocHolder::allocator_v1         allocator_v1;
    typedef typename AllocHolder::allocator_v2         allocator_v2;
    typedef typename AllocHolder::alloc_version        alloc_version;
+   typedef boost::container::allocator_traits      allocator_traits_type;
 
    class equal_to_value
    {
@@ -181,23 +182,23 @@ class list
 
    public:
    //! The type of object, T, stored in the list
-   typedef T                                       value_type;
+   typedef T                                                value_type;
    //! Pointer to T
-   typedef typename A::pointer                     pointer;
+   typedef typename allocator_traits_type::pointer          pointer;
    //! Const pointer to T
-   typedef typename A::const_pointer               const_pointer;
+   typedef typename allocator_traits_type::const_pointer    const_pointer;
    //! Reference to T
-   typedef typename A::reference                   reference;
+   typedef typename allocator_traits_type::reference        reference;
    //! Const reference to T
-   typedef typename A::const_reference             const_reference;
+   typedef typename allocator_traits_type::const_reference  const_reference;
    //! An unsigned integral type
-   typedef typename A::size_type                   size_type;
+   typedef typename allocator_traits_type::size_type        size_type;
    //! A signed integral type
-   typedef typename A::difference_type             difference_type;
+   typedef typename allocator_traits_type::difference_type  difference_type;
    //! The allocator type
-   typedef A                                       allocator_type;
-   //! The stored allocator type
-   typedef NodeAlloc                               stored_allocator_type;
+   typedef A                                                allocator_type;
+   //! Non-standard extension: the stored allocator type
+   typedef NodeAlloc                                        stored_allocator_type;
 
    /// @cond
    private:
@@ -313,12 +314,21 @@ class list
    //! Const iterator used to iterate backwards through a list. 
    typedef std::reverse_iterator  const_reverse_iterator;
 
+   //! Effects: Default constructs a list.
+   //! 
+   //! Throws: If allocator_type's default constructor throws.
+   //! 
+   //! Complexity: Constant.
+   list() 
+      : AllocHolder()
+   {}
+
    //! Effects: Constructs a list taking the allocator as parameter.
    //! 
    //! Throws: If allocator_type's copy constructor throws.
    //! 
    //! Complexity: Constant.
-   explicit list(const allocator_type &a = A()) 
+   explicit list(const allocator_type &a)
       : AllocHolder(a)
    {}
 
@@ -329,7 +339,7 @@ class list
    //!   throws or T's default or copy constructor throws.
    //! 
    //! Complexity: Linear to n.
-   list(size_type n)
+   explicit list(size_type n)
       : AllocHolder(A())
    {  this->resize(n);  }
 
@@ -533,7 +543,6 @@ class list
    size_type max_size() const 
    {  return AllocHolder::max_size();  }
 
-
    #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
    //! Effects: Inserts a copy of x at the beginning of the list.
    //!
@@ -711,7 +720,15 @@ class list
    //! Complexity: Linear to the number of elements in x.
    ThisType& operator=(BOOST_COPY_ASSIGN_REF(ThisType) x)
    {
-      if (this != &x) {
+      if (&x != this){
+         NodeAlloc &this_alloc     = this->node_alloc();
+         const NodeAlloc &x_alloc  = x.node_alloc();
+         container_detail::bool_ flag;
+         if(flag && this_alloc != x_alloc){
+            this->clear();
+         }
+         this->AllocHolder::copy_assign_alloc(x);
          this->assign(x.begin(), x.end());
       }
       return *this;
@@ -725,10 +742,26 @@ class list
    //! Throws: If allocator_type's copy constructor throws.
    //!
    //! Complexity: Constant.
-   ThisType& operator=(BOOST_RV_REF(ThisType) mx)
+   ThisType& operator=(BOOST_RV_REF(ThisType) x)
    {
-      this->clear();
-      this->swap(mx);
+      if (&x != this){
+         NodeAlloc &this_alloc = this->node_alloc();
+         NodeAlloc &x_alloc    = x.node_alloc();
+         //If allocators are equal we can just swap pointers
+         if(this_alloc == x_alloc){
+            //Destroy and swap pointers
+            this->clear();
+            this->icont() = boost::move(x.icont());
+            //Move allocator if needed
+            this->AllocHolder::move_assign_alloc(x);
+         }
+         //If unequal allocators, then do a one by one move
+         else{
+            typedef typename std::iterator_traits::iterator_category ItCat;
+            this->assign( boost::make_move_iterator(x.begin())
+                        , boost::make_move_iterator(x.end()));
+         }
+      }
       return *this;
    }
 
@@ -753,8 +786,8 @@ class list
    template 
    void insert(const_iterator p, InpIt first, InpIt last) 
    {
-      const bool aux_boolean = containers_detail::is_convertible::value;
-      typedef containers_detail::bool_ Result;
+      const bool aux_boolean = container_detail::is_convertible::value;
+      typedef container_detail::bool_ Result;
       this->priv_insert_dispatch(p, first, last, Result());
    }
 
@@ -780,7 +813,7 @@ class list
    BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
    #endif
 
-   #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... in the end of the list.
@@ -818,57 +851,40 @@ class list
    template 
    iterator emplace(const_iterator p, Args&&... args)
    {
-      typename AllocHolder::Deallocator d(AllocHolder::create_node_and_deallocator());
-      new ((void*)containers_detail::get_pointer(d.get())) Node(boost::forward(args)...);
-      NodePtr node = d.get();
-      d.release();
-      return iterator(this->icont().insert(p.get(), *node));
+      NodePtr pnode(AllocHolder::create_node(boost::forward(args)...));
+      return iterator(this->icont().insert(p.get(), *pnode));
    }
 
-   #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
-   //0 args
-   void emplace_back()
-   {  this->emplace(this->cend());  }
-
-   void emplace_front()
-   {  this->emplace(this->cbegin());   }
-
-   iterator emplace(const_iterator p)
-   {
-      typename AllocHolder::Deallocator d(AllocHolder::create_node_and_deallocator());
-      new ((void*)containers_detail::get_pointer(d.get())) Node();
-      NodePtr node = d.get();
-      d.release();
-      return iterator(this->icont().insert(p.get(), *node));
-   }
+   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    #define BOOST_PP_LOCAL_MACRO(n)                                                              \
-   template                                                   \
-   void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                     \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)       \
+   void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                        \
    {                                                                                            \
-      this->emplace(this->cend(), BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));    \
+      this->emplace(this->cend()                                                                \
+                    BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));            \
    }                                                                                            \
                                                                                                 \
-   template                                                   \
-   void emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                    \
-   {  this->emplace(this->cbegin(), BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));} \
-                                                                                                \
-   template                                                   \
-   iterator emplace(const_iterator p, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))    \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)       \
+   void emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                       \
    {                                                                                            \
-      typename AllocHolder::Deallocator d(AllocHolder::create_node_and_deallocator());          \
-      new ((void*)containers_detail::get_pointer(d.get()))                                                 \
-         Node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));                        \
-      NodePtr node = d.get();                                                                   \
-      d.release();                                                                              \
-      return iterator(this->icont().insert(p.get(), *node));                                    \
+      this->emplace(this->cbegin()                                                              \
+                    BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));            \
+   }                                                                                            \
+                                                                                                \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)       \
+   iterator emplace(const_iterator p                                                            \
+                    BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                \
+   {                                                                                            \
+      NodePtr pnode (AllocHolder::create_node                                                   \
+         (BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)));                              \
+      return iterator(this->icont().insert(p.get(), *pnode));                                   \
    }                                                                                            \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif   //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! Requires: p must be a valid iterator of *this.
    //!
@@ -907,8 +923,8 @@ class list
    template 
    void assign(InpIt first, InpIt last) 
    {
-      const bool aux_boolean = containers_detail::is_convertible::value;
-      typedef containers_detail::bool_ Result;
+      const bool aux_boolean = container_detail::is_convertible::value;
+      typedef container_detail::bool_ Result;
       this->priv_assign_dispatch(first, last, Result());
    }
 
@@ -925,14 +941,10 @@ class list
    //! 
    //! Note: Iterators of values obtained from list x now point to elements of
    //!    this list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, ThisType& x) 
+   void splice(const_iterator p, ThisType& x) BOOST_CONTAINER_NOEXCEPT
    {
-      if((NodeAlloc&)*this == (NodeAlloc&)x){
-         this->icont().splice(p.get(), x.icont());
-      }
-      else{
-         throw std::runtime_error("list::splice called with unequal allocators");
-      }
+      BOOST_ASSERT((NodeAlloc&)*this == (NodeAlloc&)x);
+      this->icont().splice(p.get(), x.icont());
    }
 
    //! Requires: p must point to an element contained
@@ -949,14 +961,10 @@ class list
    //! 
    //! Note: Iterators of values obtained from list x now point to elements of this
    //!   list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, ThisType &x, const_iterator i) 
+   void splice(const_iterator p, ThisType &x, const_iterator i) BOOST_CONTAINER_NOEXCEPT
    {
-      if((NodeAlloc&)*this == (NodeAlloc&)x){
-         this->icont().splice(p.get(), x.icont(), i.get());
-      }
-      else{
-         throw std::runtime_error("list::splice called with unequal allocators");
-      }
+      BOOST_ASSERT((NodeAlloc&)*this == (NodeAlloc&)x);
+      this->icont().splice(p.get(), x.icont(), i.get());
    }
 
    //! Requires: p must point to an element contained
@@ -972,14 +980,10 @@ class list
    //! 
    //! Note: Iterators of values obtained from list x now point to elements of this
    //!   list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, ThisType &x, const_iterator first, const_iterator last) 
+   void splice(const_iterator p, ThisType &x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
    {
-      if((NodeAlloc&)*this == (NodeAlloc&)x){
-         this->icont().splice(p.get(), x.icont(), first.get(), last.get());
-      }
-      else{
-         throw std::runtime_error("list::splice called with unequal allocators");
-      }
+      BOOST_ASSERT((NodeAlloc&)*this == (NodeAlloc&)x);
+      this->icont().splice(p.get(), x.icont(), first.get(), last.get());
    }
 
    //! Requires: p must point to an element contained
@@ -996,14 +1000,10 @@ class list
    //! 
    //! Note: Iterators of values obtained from list x now point to elements of this
    //!   list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, ThisType &x, const_iterator first, const_iterator last, size_type n) 
+   void splice(const_iterator p, ThisType &x, const_iterator first, const_iterator last, size_type n) BOOST_CONTAINER_NOEXCEPT
    {
-      if((NodeAlloc&)*this == (NodeAlloc&)x){
-         this->icont().splice(p.get(), x.icont(), first.get(), last.get(), n);
-      }
-      else{
-         throw std::runtime_error("list::splice called with unequal allocators");
-      }
+      BOOST_ASSERT((NodeAlloc&)*this == (NodeAlloc&)x);
+      this->icont().splice(p.get(), x.icont(), first.get(), last.get(), n);
    }
 
    //! Effects: Reverses the order of elements in the list. 
@@ -1240,11 +1240,11 @@ class list
    template 
    void priv_insert_dispatch(const_iterator p,
                              InputIter first, InputIter last,
-                             containers_detail::false_)
+                             container_detail::false_)
    {  this->priv_create_and_insert_nodes(p, first, last);   }
 
    template
-   void priv_insert_dispatch(const_iterator p, Integer n, Integer x, containers_detail::true_) 
+   void priv_insert_dispatch(const_iterator p, Integer n, Integer x, container_detail::true_) 
    {  this->insert(p, (size_type)n, x);  }
 
    void priv_fill_assign(size_type n, const T& val) 
@@ -1262,11 +1262,11 @@ class list
    }
 
    template 
-   void priv_assign_dispatch(Integer n, Integer val, containers_detail::true_)
+   void priv_assign_dispatch(Integer n, Integer val, container_detail::true_)
    {  this->priv_fill_assign((size_type) n, (T) val); }
 
    template 
-   void priv_assign_dispatch(InputIter first2, InputIter last2, containers_detail::false_)
+   void priv_assign_dispatch(InputIter first2, InputIter last2, container_detail::false_)
    {
       iterator first1   = this->begin();
       iterator last1    = this->end();
@@ -1370,4 +1370,4 @@ namespace container {
 
 #include 
 
-#endif // BOOST_CONTAINERS_LIST_HPP_
+#endif // BOOST_CONTAINER_LIST_HPP_
diff --git a/include/boost/container/map.hpp b/include/boost/container/map.hpp
index 9eac512..63717d9 100644
--- a/include/boost/container/map.hpp
+++ b/include/boost/container/map.hpp
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_MAP_HPP
-#define BOOST_CONTAINERS_MAP_HPP
+#ifndef BOOST_CONTAINER_MAP_HPP
+#define BOOST_CONTAINER_MAP_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -31,7 +31,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
+
 
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
@@ -74,9 +77,9 @@ class map
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(map)
-   typedef containers_detail::rbtree, 
-                           containers_detail::select1st< std::pair >, 
+                           container_detail::select1st< std::pair >, 
                            Pred, 
                            A> tree_t;
    tree_t m_tree;  // red-black tree representing map
@@ -103,7 +106,7 @@ class map
    typedef typename tree_t::allocator_type         allocator_type;
    typedef typename tree_t::stored_allocator_type  stored_allocator_type;
    typedef std::pair        nonconst_value_type;
-   typedef containers_detail::pair
+   typedef container_detail::pair
                             nonconst_impl_value_type;
 
    /// @cond
@@ -122,16 +125,26 @@ class map
    /// @endcond
    typedef value_compare_impl             value_compare;
 
+   //! Effects: Default constructs an empty map.
+   //! 
+   //! Complexity: Constant.
+   map()
+      : m_tree()
+   {
+      //Allocator type must be std::pair
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value));
+   }
+
    //! Effects: Constructs an empty map using the specified comparison object 
    //! and allocator.
    //! 
    //! Complexity: Constant.
-   explicit map(const Pred& comp = Pred(),
+   explicit map(const Pred& comp,
                 const allocator_type& a = allocator_type())
       : m_tree(comp, a)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((containers_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value));
    }
 
    //! Effects: Constructs an empty map using the specified comparison object and 
@@ -145,7 +158,7 @@ class map
       : m_tree(first, last, comp, a, true) 
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((containers_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
    }
 
    //! Effects: Constructs an empty map using the specified comparison object and 
@@ -162,7 +175,7 @@ class map
       : m_tree(ordered_range, first, last, comp, a) 
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((containers_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
    }
 
    //! Effects: Copy constructs a map.
@@ -172,7 +185,7 @@ class map
       : m_tree(x.m_tree)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((containers_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
    }
 
    //! Effects: Move constructs a map. Constructs *this using x's resources.
@@ -184,7 +197,7 @@ class map
       : m_tree(boost::move(x.m_tree))
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((containers_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
    }
 
    //! Effects: Makes *this a copy of x.
@@ -318,24 +331,14 @@ class map
    size_type max_size() const 
    { return m_tree.max_size(); }
 
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
    //! Effects: If there is no key equivalent to x in the map, inserts 
    //! value_type(x, T()) into the map.
    //! 
    //! Returns: A reference to the mapped_type corresponding to x in *this.
    //! 
    //! Complexity: Logarithmic.
-   T& operator[](const key_type& k) 
-   {
-      //we can optimize this
-      iterator i = lower_bound(k);
-      // i->first is greater than or equivalent to k.
-      if (i == end() || key_comp()(k, (*i).first)){
-         containers_detail::value_init v;
-         value_type val(k, boost::move(v.m_t));
-         i = insert(i, boost::move(val));
-      }
-      return (*i).second;
-   }
+   mapped_type& operator[](const key_type &k);
 
    //! Effects: If there is no key equivalent to x in the map, inserts 
    //! value_type(boost::move(x), T()) into the map (the key is move-constructed)
@@ -343,18 +346,10 @@ class map
    //! Returns: A reference to the mapped_type corresponding to x in *this.
    //! 
    //! Complexity: Logarithmic.
-   T& operator[](BOOST_RV_REF(key_type) mk) 
-   {
-      key_type &k = mk;
-      //we can optimize this
-      iterator i = lower_bound(k);
-      // i->first is greater than or equivalent to k.
-      if (i == end() || key_comp()(k, (*i).first)){
-         value_type val(boost::move(k), boost::move(T()));
-         i = insert(i, boost::move(val));
-      }
-      return (*i).second;
-   }
+   mapped_type& operator[](key_type &&k);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, priv_subscript)
+   #endif
 
    //! Returns: A reference to the element whose key is equivalent to x.
    //! Throws: An exception object of type out_of_range if no such element is present.
@@ -508,7 +503,7 @@ class map
    void insert(InputIterator first, InputIterator last) 
    {  m_tree.insert_unique(first, last);  }
 
-   #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... in the container if and only if there is 
@@ -538,27 +533,23 @@ class map
    iterator emplace_hint(const_iterator hint, Args&&... args)
    {  return m_tree.emplace_hint_unique(hint, boost::forward(args)...); }
 
-   #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
-   iterator emplace()
-   {  return m_tree.emplace_unique(); }
-
-   iterator emplace_hint(const_iterator hint)
-   {  return m_tree.emplace_hint_unique(hint); }
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                                       \
-   template                                                            \
-   iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                               \
-   {  return m_tree.emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); }          \
-                                                                                                         \
-   template                                                            \
-   iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))     \
-   {  return m_tree.emplace_hint_unique(hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));}\
+   #define BOOST_PP_LOCAL_MACRO(n)                                                                 \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)          \
+   iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                           \
+   {  return m_tree.emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); }      \
+                                                                                                   \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)          \
+   iterator emplace_hint(const_iterator hint                                                       \
+                         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))             \
+   {  return m_tree.emplace_hint_unique(hint                                                       \
+                               BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));}  \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif   //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! Effects: Erases the element pointed to by position.
    //!
@@ -660,7 +651,35 @@ class map
                            const map&);
    template 
    friend bool operator< (const map&,
-                           const map&);
+                          const map&);
+   private:
+   mapped_type& priv_subscript(const key_type &k)
+   {
+      //we can optimize this
+      iterator i = lower_bound(k);
+      // i->first is greater than or equivalent to k.
+      if (i == end() || key_comp()(k, (*i).first)){
+         container_detail::value_init m;
+         nonconst_impl_value_type val(k, boost::move(m.m_t));
+         i = insert(i, boost::move(val));
+      }
+      return (*i).second;
+   }
+
+   mapped_type& priv_subscript(BOOST_RV_REF(key_type) mk) 
+   {
+      key_type &k = mk;
+      //we can optimize this
+      iterator i = lower_bound(k);
+      // i->first is greater than or equivalent to k.
+      if (i == end() || key_comp()(k, (*i).first)){
+         container_detail::value_init m;
+         nonconst_impl_value_type val(boost::move(k), boost::move(m.m_t));
+         i = insert(i, boost::move(val));
+      }
+      return (*i).second;
+   }
+
    /// @endcond
 };
 
@@ -747,12 +766,14 @@ class multimap
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(multimap)
-   typedef containers_detail::rbtree, 
-                           containers_detail::select1st< std::pair >, 
+                           container_detail::select1st< std::pair >, 
                            Pred, 
                            A> tree_t;
    tree_t m_tree;  // red-black tree representing map
+   typedef typename container_detail::
+      move_const_ref_type::type insert_key_const_ref_type;
    /// @endcond
 
    public:
@@ -775,7 +796,7 @@ class multimap
    typedef typename tree_t::allocator_type         allocator_type;
    typedef typename tree_t::stored_allocator_type  stored_allocator_type;
    typedef std::pair        nonconst_value_type;
-   typedef containers_detail::pair
+   typedef container_detail::pair
                             nonconst_impl_value_type;
 
    /// @cond
@@ -794,16 +815,25 @@ class multimap
    /// @endcond
    typedef value_compare_impl                      value_compare;
 
+   //! Effects: Default constructs an empty multimap.
+   //! 
+   //! Complexity: Constant.
+   multimap()
+      : m_tree()
+   {
+      //Allocator type must be std::pair
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value));
+   }
+
    //! Effects: Constructs an empty multimap using the specified comparison
    //!   object and allocator.
    //! 
    //! Complexity: Constant.
-   explicit multimap(const Pred& comp = Pred(),
-                     const allocator_type& a = allocator_type())
+   explicit multimap(const Pred& comp, const allocator_type& a = allocator_type())
       : m_tree(comp, a)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((containers_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
    }
 
    //! Effects: Constructs an empty multimap using the specified comparison object
@@ -818,7 +848,7 @@ class multimap
       : m_tree(first, last, comp, a, false) 
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((containers_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
    }
 
    //! Effects: Constructs an empty multimap using the specified comparison object and 
@@ -842,7 +872,7 @@ class multimap
       : m_tree(x.m_tree)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((containers_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
    }
 
    //! Effects: Move constructs a multimap. Constructs *this using x's resources.
@@ -854,7 +884,7 @@ class multimap
       : m_tree(boost::move(x.m_tree))
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((containers_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
    }
 
    //! Effects: Makes *this a copy of x.
@@ -1078,7 +1108,7 @@ class multimap
    void insert(InputIterator first, InputIterator last) 
    {  m_tree.insert_equal(first, last); }
 
-   #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... in the container.
@@ -1106,27 +1136,23 @@ class multimap
    iterator emplace_hint(const_iterator hint, Args&&... args)
    {  return m_tree.emplace_hint_equal(hint, boost::forward(args)...); }
 
-   #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
-   iterator emplace()
-   {  return m_tree.emplace_equal(); }
-
-   iterator emplace_hint(const_iterator hint)
-   {  return m_tree.emplace_hint_equal(hint); }
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                                       \
-   template                                                            \
-   iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                               \
-   {  return m_tree.emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); }           \
-                                                                                                         \
-   template                                                            \
-   iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))     \
-   {  return m_tree.emplace_hint_equal(hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); }\
+   #define BOOST_PP_LOCAL_MACRO(n)                                                                 \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)          \
+   iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                           \
+   {  return m_tree.emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); }       \
+                                                                                                   \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)          \
+   iterator emplace_hint(const_iterator hint                                                       \
+                         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))             \
+   {  return m_tree.emplace_hint_equal(hint                                                        \
+                               BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));}  \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif   //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! Effects: Erases the element pointed to by position.
    //!
@@ -1288,5 +1314,5 @@ namespace container {
 
 #include 
 
-#endif /* BOOST_CONTAINERS_MAP_HPP */
+#endif /* BOOST_CONTAINER_MAP_HPP */
 
diff --git a/include/boost/container/set.hpp b/include/boost/container/set.hpp
index 8ea4e76..485f64d 100644
--- a/include/boost/container/set.hpp
+++ b/include/boost/container/set.hpp
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_SET_HPP
-#define BOOST_CONTAINERS_SET_HPP
+#ifndef BOOST_CONTAINER_SET_HPP
+#define BOOST_CONTAINER_SET_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -27,7 +27,7 @@
 #include 
 #include 
 #include 
-#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
+#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 #include 
 #endif
 
@@ -67,10 +67,10 @@ class set
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(set)
-   typedef containers_detail::rbtree, Pred, A> tree_t;
+   typedef container_detail::rbtree, Pred, A> tree_t;
    tree_t m_tree;  // red-black tree representing set
-   typedef typename containers_detail::
+   typedef typename container_detail::
       move_const_ref_type::type insert_const_ref_type;
    /// @endcond
 
@@ -94,11 +94,18 @@ class set
    typedef typename tree_t::allocator_type         allocator_type;
    typedef typename tree_t::stored_allocator_type  stored_allocator_type;
 
+   //! Effects: Default constructs an empty set.
+   //! 
+   //! Complexity: Constant.
+   set()
+      : m_tree()
+   {}
+
    //! Effects: Constructs an empty set using the specified comparison object 
    //! and allocator.
    //! 
    //! Complexity: Constant.
-   explicit set(const Pred& comp = Pred(),
+   explicit set(const Pred& comp,
                 const allocator_type& a = allocator_type())
       : m_tree(comp, a)
    {}
@@ -334,7 +341,7 @@ class set
    { return this->insert(const_cast(x)); }
 
    template
-   std::pair insert(const U &u, typename containers_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
+   std::pair insert(const U &u, typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
    {  return priv_insert(u); }
    #endif
 
@@ -366,7 +373,7 @@ class set
    { return this->insert(position, const_cast(x)); }
 
    template
-   iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
+   iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
    {  return priv_insert(position, u); }
    #endif
 
@@ -389,7 +396,7 @@ class set
    void insert(InputIterator first, InputIterator last) 
    {  m_tree.insert_unique(first, last);  }
 
-   #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects:  Inserts an object of type T constructed with
    //!   std::forward(args)... if and only if there is 
@@ -418,27 +425,23 @@ class set
    iterator emplace_hint(const_iterator hint, Args&&... args)
    {  return m_tree.emplace_hint_unique(hint, boost::forward(args)...); }
 
-   #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
-   iterator emplace()
-   {  return m_tree.emplace_unique(); }
-
-   iterator emplace_hint(const_iterator hint)
-   {  return m_tree.emplace_hint_unique(hint); }
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                                       \
-   template                                                            \
-   iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                               \
-   {  return m_tree.emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); }          \
-                                                                                                         \
-   template                                                            \
-   iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))     \
-   {  return m_tree.emplace_hint_unique(hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));}\
+   #define BOOST_PP_LOCAL_MACRO(n)                                                                 \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)          \
+   iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                           \
+   {  return m_tree.emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); }      \
+                                                                                                   \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)          \
+   iterator emplace_hint(const_iterator hint                                                       \
+                         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))             \
+   {  return m_tree.emplace_hint_unique(hint                                                       \
+                               BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));}  \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif   //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! Effects: Erases the element pointed to by p.
    //!
@@ -629,10 +632,10 @@ class multiset
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(multiset)
-   typedef containers_detail::rbtree, Pred, A> tree_t;
+   typedef container_detail::rbtree, Pred, A> tree_t;
    tree_t m_tree;  // red-black tree representing multiset
-   typedef typename containers_detail::
+   typedef typename container_detail::
       move_const_ref_type::type insert_const_ref_type;
    /// @endcond
 
@@ -660,7 +663,15 @@ class multiset
    //!   object and allocator.
    //! 
    //! Complexity: Constant.
-   explicit multiset(const Pred& comp = Pred(),
+   multiset()
+      : m_tree()
+   {}
+
+   //! Effects: Constructs an empty multiset using the specified comparison
+   //!   object and allocator.
+   //! 
+   //! Complexity: Constant.
+   explicit multiset(const Pred& comp,
                      const allocator_type& a = allocator_type())
       : m_tree(comp, a)
    {}
@@ -893,7 +904,7 @@ class multiset
    { return this->insert(const_cast(x)); }
 
    template
-   iterator insert(const U &u, typename containers_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
+   iterator insert(const U &u, typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
    {  return priv_insert(u); }
    #endif
 
@@ -923,7 +934,7 @@ class multiset
    { return this->insert(position, const_cast(x)); }
 
    template
-   iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
+   iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
    {  return priv_insert(position, u); }
    #endif
 
@@ -947,7 +958,7 @@ class multiset
    void insert(InputIterator first, InputIterator last) 
    {  m_tree.insert_equal(first, last);  }
 
-   #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... and returns the iterator pointing to the
@@ -970,27 +981,23 @@ class multiset
    iterator emplace_hint(const_iterator hint, Args&&... args)
    {  return m_tree.emplace_hint_equal(hint, boost::forward(args)...); }
 
-   #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
-   iterator emplace()
-   {  return m_tree.emplace_equal(); }
-
-   iterator emplace_hint(const_iterator hint)
-   {  return m_tree.emplace_hint_equal(hint); }
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                                       \
-   template                                                            \
-   iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                               \
-   {  return m_tree.emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); }           \
-                                                                                                         \
-   template                                                            \
-   iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))     \
-   {  return m_tree.emplace_hint_equal(hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); }\
+   #define BOOST_PP_LOCAL_MACRO(n)                                                                 \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)          \
+   iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                           \
+   {  return m_tree.emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); }       \
+                                                                                                   \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)          \
+   iterator emplace_hint(const_iterator hint                                                       \
+                         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))             \
+   {  return m_tree.emplace_hint_equal(hint                                                        \
+                               BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));}  \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif   //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! Effects: Erases the element pointed to by p.
    //!
@@ -1159,5 +1166,5 @@ namespace container {
 
 #include 
 
-#endif /* BOOST_CONTAINERS_SET_HPP */
+#endif /* BOOST_CONTAINER_SET_HPP */
 
diff --git a/include/boost/container/slist.hpp b/include/boost/container/slist.hpp
index d5121a0..ffa538e 100644
--- a/include/boost/container/slist.hpp
+++ b/include/boost/container/slist.hpp
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_SLIST_HPP
-#define BOOST_CONTAINERS_SLIST_HPP
+#ifndef BOOST_CONTAINER_SLIST_HPP
+#define BOOST_CONTAINER_SLIST_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -20,7 +20,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -29,7 +29,7 @@
 #include 
 
 
-#if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 //Preprocessor library to emulate perfect forwarding
 #else
 #include  
@@ -52,46 +52,43 @@ namespace container {
 
 /// @cond
 
-namespace containers_detail {
+namespace container_detail {
 
 template
 struct slist_hook
 {
-   typedef typename containers_detail::bi::make_slist_base_hook
-      , containers_detail::bi::link_mode >::type type;
+   typedef typename container_detail::bi::make_slist_base_hook
+      , container_detail::bi::link_mode >::type type;
 };
 
 template 
 struct slist_node
    :  public slist_hook::type
 {
-   #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    slist_node()
       : m_data()
    {}
 
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
    template
    slist_node(Args &&...args)
       : m_data(boost::forward(args)...)
    {}
 
-   #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
-   slist_node()
-      : m_data()
-   {}
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                           \
-   template                                                \
-   slist_node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                         \
-      : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _))                     \
-   {}                                                                                        \
+   #define BOOST_PP_LOCAL_MACRO(n)                                      \
+   template                           \
+   slist_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))       \
+      : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))   \
+   {}                                                                   \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif//#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif//#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    T m_data;
 };
@@ -99,22 +96,26 @@ struct slist_node
 template
 struct intrusive_slist_type
 {
-   typedef typename A::value_type               value_type;
-   typedef typename boost::pointer_to_other
-      ::type         void_pointer;
-   typedef typename containers_detail::slist_node
+   typedef boost::container::allocator_traits      allocator_traits_type;
+   typedef typename allocator_traits_type::value_type value_type;
+   typedef typename boost::intrusive::pointer_traits
+      ::template
+         rebind_pointer::type
+            void_pointer;
+   typedef typename container_detail::slist_node
                       node_type;
 
-   typedef typename containers_detail::bi::make_slist
+   typedef typename container_detail::bi::make_slist
       ::type>
-      ,containers_detail::bi::constant_time_size
-      ,containers_detail::bi::size_type
+      ,container_detail::bi::base_hook::type>
+      ,container_detail::bi::constant_time_size
+      , container_detail::bi::size_type
+         
       >::type                                   container_type;
    typedef container_type                       type ;
 };
 
-}  //namespace containers_detail {
+}  //namespace container_detail {
 
 /// @endcond
 
@@ -156,24 +157,25 @@ template  >
 template 
 #endif
 class slist 
-   : protected containers_detail::node_alloc_holder
-      ::type>
+   : protected container_detail::node_alloc_holder
+      ::type>
 {
    /// @cond
-   typedef typename containers_detail::
+   typedef typename container_detail::
       move_const_ref_type::type                    insert_const_ref_type;
    typedef typename 
-      containers_detail::intrusive_slist_type::type           Icont;
-   typedef containers_detail::node_alloc_holder        AllocHolder;
+      container_detail::intrusive_slist_type::type           Icont;
+   typedef container_detail::node_alloc_holder        AllocHolder;
    typedef typename AllocHolder::NodePtr              NodePtr;
    typedef slist                                ThisType;
    typedef typename AllocHolder::NodeAlloc            NodeAlloc;
    typedef typename AllocHolder::ValAlloc             ValAlloc;
    typedef typename AllocHolder::Node                 Node;
-   typedef containers_detail::allocator_destroyer     Destroyer;
+   typedef container_detail::allocator_destroyer     Destroyer;
    typedef typename AllocHolder::allocator_v1         allocator_v1;
    typedef typename AllocHolder::allocator_v2         allocator_v2;
    typedef typename AllocHolder::alloc_version        alloc_version;
+   typedef boost::container::allocator_traits      allocator_traits_type;
 
    class equal_to_value
    {
@@ -206,23 +208,23 @@ class slist
    /// @endcond
    public:
    //! The type of object, T, stored in the list
-   typedef T                                       value_type;
+   typedef T                                                value_type;
    //! Pointer to T
-   typedef typename A::pointer                     pointer;
+   typedef typename allocator_traits_type::pointer          pointer;
    //! Const pointer to T
-   typedef typename A::const_pointer               const_pointer;
+   typedef typename allocator_traits_type::const_pointer    const_pointer;
    //! Reference to T
-   typedef typename A::reference                   reference;
+   typedef typename allocator_traits_type::reference        reference;
    //! Const reference to T
-   typedef typename A::const_reference             const_reference;
+   typedef typename allocator_traits_type::const_reference  const_reference;
    //! An unsigned integral type
-   typedef typename A::size_type                   size_type;
+   typedef typename allocator_traits_type::size_type        size_type;
    //! A signed integral type
-   typedef typename A::difference_type             difference_type;
+   typedef typename allocator_traits_type::difference_type  difference_type;
    //! The allocator type
-   typedef A                                       allocator_type;
-   //! The stored allocator type
-   typedef NodeAlloc                               stored_allocator_type;
+   typedef A                                                allocator_type;
+   //! Non-standard extension: the stored allocator type
+   typedef NodeAlloc                                        stored_allocator_type;
 
    /// @cond
    private:
@@ -328,7 +330,16 @@ class slist
    //! Throws: If allocator_type's copy constructor throws.
    //! 
    //! Complexity: Constant.
-   explicit slist(const allocator_type& a = allocator_type())
+   slist()
+      :  AllocHolder()
+   {}
+
+   //! Effects: Constructs a list taking the allocator as parameter.
+   //! 
+   //! Throws: If allocator_type's copy constructor throws.
+   //! 
+   //! Complexity: Constant.
+   explicit slist(const allocator_type& a)
       :  AllocHolder(a)
    {}
 
@@ -377,7 +388,7 @@ class slist
    //! 
    //! Complexity: Constant.
    slist(BOOST_RV_REF(slist) x)
-      : AllocHolder(boost::move((AllocHolder&)x))
+      : AllocHolder(boost::move(static_cast(x)))
    {}
 
    //! Effects: Makes *this contain the same elements as x.
@@ -391,6 +402,14 @@ class slist
    slist& operator= (BOOST_COPY_ASSIGN_REF(slist) x)
    {
       if (&x != this){
+         NodeAlloc &this_alloc     = this->node_alloc();
+         const NodeAlloc &x_alloc  = x.node_alloc();
+         container_detail::bool_ flag;
+         if(flag && this_alloc != x_alloc){
+            this->clear();
+         }
+         this->AllocHolder::copy_assign_alloc(x);
          this->assign(x.begin(), x.end());
       }
       return *this;
@@ -404,11 +423,25 @@ class slist
    //! Throws: If memory allocation throws or T's copy constructor throws.
    //!
    //! Complexity: Linear to the number of elements in x.
-   slist& operator= (BOOST_RV_REF(slist) mx)
+   slist& operator= (BOOST_RV_REF(slist) x)
    {
-      if (&mx != this){
-         this->clear();
-         this->swap(mx);
+      if (&x != this){
+         NodeAlloc &this_alloc = this->node_alloc();
+         NodeAlloc &x_alloc    = x.node_alloc();
+         //If allocators a re equal we can just swap pointers
+         if(this_alloc == x_alloc){
+            //Destroy and swap pointers
+            this->clear();
+            this->icont() = boost::move(x.icont());
+            //Move allocator if needed
+            this->AllocHolder::move_assign_alloc(x);
+         }
+         //If unequal allocators, then do a one by one move
+         else{
+            typedef typename std::iterator_traits::iterator_category ItCat;
+            this->assign( boost::make_move_iterator(x.begin())
+                        , boost::make_move_iterator(x.end()));
+         }
       }
       return *this;
    }
@@ -455,8 +488,8 @@ class slist
    template 
    void assign(InpIt first, InpIt last) 
    {
-      const bool aux_boolean = containers_detail::is_convertible::value;
-      typedef containers_detail::bool_ Result;
+      const bool aux_boolean = container_detail::is_convertible::value;
+      typedef container_detail::bool_ Result;
       this->priv_assign_dispatch(first, last, Result());
    }
 
@@ -607,7 +640,7 @@ class slist
    void push_front(T &x) { push_front(const_cast(x)); }
 
    template
-   void push_front(const U &u, typename containers_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
+   void push_front(const U &u, typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
    {  return priv_push_front(u); }
    #endif
 
@@ -669,7 +702,7 @@ class slist
    { return this->insert_after(position, const_cast(x)); }
 
    template
-   iterator insert_after(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
+   iterator insert_after(const_iterator position, const U &u, typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
    {  return this->priv_insert_after(position, u); }
    #endif
 
@@ -717,8 +750,8 @@ class slist
    template 
    void insert_after(const_iterator prev_pos, InIter first, InIter last) 
    {
-      const bool aux_boolean = containers_detail::is_convertible::value;
-      typedef containers_detail::bool_ Result;
+      const bool aux_boolean = container_detail::is_convertible::value;
+      typedef container_detail::bool_ Result;
       this->priv_insert_after_range_dispatch(prev_pos, first, last, Result());
    }
 
@@ -737,7 +770,7 @@ class slist
    { return this->insert(position, const_cast(x)); }
 
    template
-   iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
+   iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
    {  return this->priv_insert(position, u); }
    #endif
 
@@ -774,7 +807,7 @@ class slist
    void insert(const_iterator p, InIter first, InIter last) 
    {  return this->insert_after(previous(p), first, last); }
 
-   #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... in the front of the list
@@ -808,63 +841,42 @@ class slist
    template 
    iterator emplace_after(const_iterator prev, Args&&... args)
    {
-      typename AllocHolder::Deallocator d(AllocHolder::create_node_and_deallocator());
-      new ((void*)containers_detail::get_pointer(d.get())) Node(boost::forward(args)...);
-      NodePtr node = d.get();
-      d.release();
-      return iterator(this->icont().insert_after(prev.get(), *node));
+      NodePtr pnode(AllocHolder::create_node(boost::forward(args)...));
+      return iterator(this->icont().insert_after(prev.get(), *pnode));
    }
 
-   #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
-   //0 args
-   void emplace_front()
-   {  this->emplace_after(this->cbefore_begin());   }
-
-   iterator emplace(const_iterator p)
-   {  return this->emplace_after(this->previous(p));  }
-
-   iterator emplace_after(const_iterator prev)
-   {
-      typename AllocHolder::Deallocator d(AllocHolder::create_node_and_deallocator());
-      new ((void*)containers_detail::get_pointer(d.get())) Node();
-      NodePtr node = d.get();
-      d.release();
-      return iterator(this->icont().insert_after(prev.get(), *node));
-   }
+   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    #define BOOST_PP_LOCAL_MACRO(n)                                                           \
-   template                                                \
-   void emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                 \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
+   void emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                    \
    {                                                                                         \
-      this->emplace                                                                          \
-         (this->cbegin(), BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));         \
+      this->emplace(this->cbegin()                                                           \
+          BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));                   \
    }                                                                                         \
                                                                                              \
-   template                                                \
-   iterator emplace                                                                          \
-      (const_iterator p, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))              \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
+   iterator emplace (const_iterator p                                                        \
+                 BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                \
    {                                                                                         \
       return this->emplace_after                                                             \
-         (this->previous(p), BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));      \
+         (this->previous(p)                                                                  \
+          BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));                   \
    }                                                                                         \
                                                                                              \
-   template                                                \
-   iterator emplace_after                                                                    \
-      (const_iterator prev, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))           \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
+   iterator emplace_after(const_iterator prev                                                \
+                 BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                \
    {                                                                                         \
-      typename AllocHolder::Deallocator d(AllocHolder::create_node_and_deallocator());       \
-      new ((void*)containers_detail::get_pointer(d.get()))                                              \
-         Node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));                     \
-      NodePtr node = d.get();                                                                \
-      d.release();                                                                           \
-      return iterator(this->icont().insert_after(prev.get(), *node));                        \
+      NodePtr pnode (AllocHolder::create_node                                                \
+         (BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)));                           \
+      return iterator(this->icont().insert_after(prev.get(), *pnode));                       \
    }                                                                                         \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif   //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! Effects: Erases the element after the element pointed by prev_pos
    //!    of the list.
@@ -1337,11 +1349,11 @@ class slist
    template 
    void priv_insert_dispatch(const_iterator prev,
                              InputIter first, InputIter last,
-                             containers_detail::false_)
+                             container_detail::false_)
    {  this->priv_create_and_insert_nodes(prev, first, last);   }
 
    template
-   void priv_insert_dispatch(const_iterator prev, Integer n, Integer x, containers_detail::true_) 
+   void priv_insert_dispatch(const_iterator prev, Integer n, Integer x, container_detail::true_) 
    {  this->priv_create_and_insert_nodes(prev, (size_type)n, x);  }
 
    void priv_fill_assign(size_type n, const T& val) 
@@ -1361,11 +1373,11 @@ class slist
    }
 
    template 
-   void priv_assign_dispatch(Int n, Int val, containers_detail::true_)
+   void priv_assign_dispatch(Int n, Int val, container_detail::true_)
    {  this->priv_fill_assign((size_type) n, (T)val); }
 
    template 
-   void priv_assign_dispatch(InpIt first, InpIt last, containers_detail::false_)
+   void priv_assign_dispatch(InpIt first, InpIt last, container_detail::false_)
    {
       iterator end_n(this->end());
       iterator prev(this->before_begin());
@@ -1383,11 +1395,11 @@ class slist
    }
 
    template 
-   void priv_insert_after_range_dispatch(const_iterator prev_pos, Int n, Int x, containers_detail::true_) 
+   void priv_insert_after_range_dispatch(const_iterator prev_pos, Int n, Int x, container_detail::true_) 
    {  this->priv_create_and_insert_nodes(prev_pos, (size_type)n, x);  }
 
    template 
-   void priv_insert_after_range_dispatch(const_iterator prev_pos, InIter first, InIter last, containers_detail::false_) 
+   void priv_insert_after_range_dispatch(const_iterator prev_pos, InIter first, InIter last, container_detail::false_) 
    {  this->priv_create_and_insert_nodes(prev_pos, first, last); }
 
    //Functors for member algorithm defaults
@@ -1533,4 +1545,4 @@ class insert_iterator >
 
 #include 
 
-#endif /* BOOST_CONTAINERS_SLIST_HPP */
+#endif /* BOOST_CONTAINER_SLIST_HPP */
diff --git a/include/boost/container/stable_vector.hpp b/include/boost/container/stable_vector.hpp
index 1886e29..2d25fbe 100644
--- a/include/boost/container/stable_vector.hpp
+++ b/include/boost/container/stable_vector.hpp
@@ -27,15 +27,14 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -79,7 +78,7 @@ struct smart_ptr_type
 };
 
 template
-inline typename smart_ptr_type::pointer get_pointer(const Ptr &ptr)
+inline typename smart_ptr_type::pointer to_raw_pointer(const Ptr &ptr)
 {  return smart_ptr_type::get(ptr);   }
 
 template 
@@ -126,33 +125,29 @@ template
 struct node_type
    : public node_type_base
 {
-   #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
    node_type()
       : value()
    {}
 
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
    template
    node_type(Args &&...args)
       : value(boost::forward(args)...)
    {}
 
-   #else //BOOST_CONTAINERS_PERFECT_FORWARDING
+   #else //BOOST_CONTAINER_PERFECT_FORWARDING
 
-   node_type()
-      : value()
-   {}
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                      \
-   template                           \
-   node_type(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))       \
-      : value(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _))   \
-   {}                                                                   \
+   #define BOOST_PP_LOCAL_MACRO(n)                                                           \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
+   node_type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                            \
+      : value(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))                        \
+   {}                                                                                        \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif//BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif//BOOST_CONTAINER_PERFECT_FORWARDING
    
    void set_pointer(VoidPointer p)
    {  node_type_base::set_pointer(p); }
@@ -163,33 +158,38 @@ struct node_type
 template
 class iterator
    : public std::iterator< std::random_access_iterator_tag
-                         , typename std::iterator_traits::value_type
-                         , typename std::iterator_traits::difference_type
+                         , T
+                         , typename boost::intrusive::
+                              pointer_traits::difference_type
                          , Pointer
                          , Reference>
 {
+   typedef typename boost::intrusive::
+      pointer_traits::template
+         rebind_pointer::type                void_ptr;
+   typedef typename boost::intrusive::
+      pointer_traits::template
+         rebind_pointer::type          const_void_ptr;
+   typedef node_type                  node_type_t;
+   typedef typename boost::intrusive::
+      pointer_traits::template
+         rebind_pointer::type         node_type_ptr_t;
+   typedef typename boost::intrusive::
+      pointer_traits::template
+         rebind_pointer::type   const_node_type_ptr_t;
+   typedef typename boost::intrusive::
+      pointer_traits::template
+         rebind_pointer::type            void_ptr_ptr;
 
-   typedef typename boost::pointer_to_other
-      ::type                  void_ptr;
-   typedef typename boost::pointer_to_other
-      ::type            const_void_ptr;
-   typedef node_type            node_type_t;
-   typedef typename boost::pointer_to_other
-      ::type          node_type_ptr_t;
-   typedef typename boost::pointer_to_other
-      ::type    const_node_type_ptr_t;
-   typedef typename boost::pointer_to_other
-      ::type             void_ptr_ptr;
-
-   friend class iterator::type>;
+   friend class iterator::template rebind_pointer::type>;
 
    public:
-   typedef std::random_access_iterator_tag   iterator_category;
-   typedef T                                 value_type;
-   typedef typename std::iterator_traits
-      ::difference_type             difference_type;
-   typedef Pointer                           pointer;
-   typedef Reference                         reference;
+   typedef std::random_access_iterator_tag      iterator_category;
+   typedef T                                    value_type;
+   typedef typename boost::intrusive::
+      pointer_traits::difference_type  difference_type;
+   typedef Pointer                              pointer;
+   typedef Reference                            reference;
 
    iterator()
    {}
@@ -198,27 +198,24 @@ class iterator
       : pn(pn)
    {}
 
-   iterator(const iterator::type >& x)
+   iterator(const iterator::template rebind_pointer::type>& x)
       : pn(x.pn)
    {}
    
    private:
    static node_type_ptr_t node_ptr_cast(const void_ptr &p)
    {
-      using boost::get_pointer;
-      return node_type_ptr_t(static_cast(stable_vector_detail::get_pointer(p)));
+      return node_type_ptr_t(static_cast(stable_vector_detail::to_raw_pointer(p)));
    }
 
    static const_node_type_ptr_t node_ptr_cast(const const_void_ptr &p)
    {
-      using boost::get_pointer;
-      return const_node_type_ptr_t(static_cast(stable_vector_detail::get_pointer(p)));
+      return const_node_type_ptr_t(static_cast(stable_vector_detail::to_raw_pointer(p)));
    }
 
    static void_ptr_ptr void_ptr_ptr_cast(const void_ptr &p)
    {
-      using boost::get_pointer;
-      return void_ptr_ptr(static_cast(stable_vector_detail::get_pointer(p)));
+      return void_ptr_ptr(static_cast(stable_vector_detail::to_raw_pointer(p)));
    }
 
    reference dereference() const
@@ -325,12 +322,15 @@ struct select_multiallocation_chain
 template
 struct select_multiallocation_chain
 {
-   typedef typename A::template
-      rebind::other::pointer                          void_ptr;
-   typedef containers_detail::basic_multiallocation_chain
+   typedef typename boost::intrusive::pointer_traits
+      ::pointer>::
+         template rebind_pointer::type                void_ptr;
+   typedef container_detail::basic_multiallocation_chain
                                                   multialloc_cached_counted;
-   typedef boost::container::containers_detail::transform_multiallocation_chain
-         type;
+   typedef boost::container::container_detail::
+      transform_multiallocation_chain
+         < multialloc_cached_counted
+         , typename allocator_traits::value_type>        type;
 };
 
 } //namespace stable_vector_detail
@@ -389,59 +389,82 @@ template 
 class stable_vector
 {
    ///@cond
-   typedef typename containers_detail::
-      move_const_ref_type::type insert_const_ref_type;
-   typedef typename A::template
-      rebind::other::pointer                    void_ptr;
-   typedef typename boost::pointer_to_other
-      ::type                    const_void_ptr;
-   typedef typename A::template
-      rebind::other::pointer                void_ptr_ptr;
-   typedef typename boost::pointer_to_other
-      ::type                const_void_ptr_ptr;
+   typedef allocator_traits                        allocator_traits_type;
+   typedef typename container_detail::
+      move_const_ref_type::type                    insert_const_ref_type;
+   typedef typename boost::intrusive::pointer_traits
+      ::
+         template rebind_pointer::type          void_ptr;
+   typedef typename boost::intrusive::pointer_traits
+      ::template
+         rebind_pointer::type             const_void_ptr;
+   typedef typename boost::intrusive::pointer_traits
+      ::template
+         rebind_pointer::type               void_ptr_ptr;
+   typedef typename boost::intrusive::pointer_traits
+      ::template
+         rebind_pointer::type         const_void_ptr_ptr;
    typedef stable_vector_detail::node_type
                                          node_type_t;
-   typedef typename A::template
-      rebind::other::pointer             node_type_ptr_t;
+   typedef typename boost::intrusive::pointer_traits
+      ::template
+         rebind_pointer::type            node_type_ptr_t;
    typedef stable_vector_detail::node_type_base
                                             node_type_base_t;
-   typedef typename A::template
-      rebind::other::pointer        node_type_base_ptr_t;
-   typedef 
-   ::boost::container::vector::other
-   >                                                  impl_type;
+   typedef typename boost::intrusive::pointer_traits
+      ::template
+         rebind_pointer::type       node_type_base_ptr_t;
+   typedef ::boost::container::vector::type>                         impl_type;
    typedef typename impl_type::iterator               impl_iterator;
    typedef typename impl_type::const_iterator         const_impl_iterator;
 
-   typedef ::boost::container::containers_detail::
+   typedef ::boost::container::container_detail::
       integral_constant                  allocator_v1;
-   typedef ::boost::container::containers_detail::
+   typedef ::boost::container::container_detail::
       integral_constant                  allocator_v2;
-   typedef ::boost::container::containers_detail::integral_constant 
-      ::value>                      alloc_version;
-   typedef typename A::
-      template rebind::other             node_allocator_type;
+   typedef ::boost::container::container_detail::integral_constant 
+      ::value>                              alloc_version;
+   typedef typename allocator_traits_type::
+      template portable_rebind_alloc
+         ::type                          node_allocator_type;
 
    node_type_ptr_t allocate_one()
    {  return this->allocate_one(alloc_version());   }
 
-   node_type_ptr_t allocate_one(allocator_v1)
-   {  return get_al().allocate(1);   }
+   template
+   node_type_ptr_t allocate_one(AllocatorVersion,
+      typename boost::container::container_detail::enable_if_c
+         
+            ::value>::type * = 0)
+   {  return node_alloc().allocate(1);   }
 
-   node_type_ptr_t allocate_one(allocator_v2)
-   {  return get_al().allocate_one();   }
+   template
+   node_type_ptr_t allocate_one(AllocatorVersion,
+      typename boost::container::container_detail::enable_if_c
+         
+            ::value>::type * = 0)
+   {  return node_alloc().allocate_one();   }
 
    void deallocate_one(node_type_ptr_t p)
    {  return this->deallocate_one(p, alloc_version());   }
 
-   void deallocate_one(node_type_ptr_t p, allocator_v1)
-   {  get_al().deallocate(p, 1);   }
+   template
+   void deallocate_one(node_type_ptr_t p, AllocatorVersion,
+      typename boost::container::container_detail::enable_if_c
+         
+            ::value>::type * = 0)
+   {  node_alloc().deallocate(p, 1);   }
 
-   void deallocate_one(node_type_ptr_t p, allocator_v2)
-   {  get_al().deallocate_one(p);   }
+   template
+   void deallocate_one(node_type_ptr_t p, AllocatorVersion,
+      typename boost::container::container_detail::enable_if_c
+         
+            ::value>::type * = 0)
+   {  node_alloc().deallocate_one(p);   }
 
    friend class stable_vector_detail::clear_on_destroy;
    ///@endcond
@@ -450,10 +473,10 @@ class stable_vector
 
    // types:
 
-   typedef typename A::reference              reference;
-   typedef typename A::const_reference        const_reference;
-   typedef typename A::pointer                pointer;
-   typedef typename A::const_pointer          const_pointer;
+   typedef typename allocator_traits_type::reference              reference;
+   typedef typename allocator_traits_type::const_reference        const_reference;
+   typedef typename allocator_traits_type::pointer                pointer;
+   typedef typename allocator_traits_type::const_pointer          const_pointer;
    typedef stable_vector_detail::iterator
                                        iterator;
    typedef stable_vector_detail::iterator
@@ -461,9 +484,10 @@ class stable_vector
    typedef typename impl_type::size_type              size_type;
    typedef typename iterator::difference_type         difference_type;
    typedef T                                          value_type;
-   typedef A                                  allocator_type;
+   typedef A                                          allocator_type;
    typedef std::reverse_iterator            reverse_iterator;
    typedef std::reverse_iterator      const_reverse_iterator;
+   typedef node_allocator_type                        stored_allocator_type;
 
    ///@cond
    private:
@@ -483,13 +507,24 @@ class stable_vector
    ///@endcond
    public:
 
+   //! Effects: Default constructs a stable_vector.
+   //! 
+   //! Throws: If allocator_type's default constructor throws.
+   //! 
+   //! Complexity: Constant.
+   stable_vector()
+      : internal_data(), impl()
+   {
+      STABLE_VECTOR_CHECK_INVARIANT;
+   }
+
    //! Effects: Constructs a stable_vector taking the allocator as parameter.
    //! 
    //! Throws: If allocator_type's copy constructor throws.
    //! 
    //! Complexity: Constant.
-   explicit stable_vector(const A& al=A())
-   : internal_data(al),impl(al)
+   explicit stable_vector(const A& al)
+      : internal_data(al),impl(al)
    {
       STABLE_VECTOR_CHECK_INVARIANT;
    }
@@ -502,7 +537,7 @@ class stable_vector
    //! 
    //! Complexity: Linear to n.
    explicit stable_vector(size_type n)
-   : internal_data(A()),impl(A())
+      : internal_data(A()),impl(A())
    {
       stable_vector_detail::clear_on_destroy cod(*this);
       this->resize(n);
@@ -518,7 +553,7 @@ class stable_vector
    //! 
    //! Complexity: Linear to n.
    stable_vector(size_type n, const T& t, const A& al=A())
-   : internal_data(al),impl(al)
+      : internal_data(al),impl(al)
    {
       stable_vector_detail::clear_on_destroy cod(*this);
       this->insert(this->cbegin(), n, t);
@@ -549,7 +584,10 @@ class stable_vector
    //! 
    //! Complexity: Linear to the elements x contains.
    stable_vector(const stable_vector& x)
-      : internal_data(x.get_al()),impl(x.get_al())
+      : internal_data(allocator_traits::
+         select_on_container_copy_construction(x.node_alloc()))
+      , impl(allocator_traits::
+         select_on_container_copy_construction(x.impl.get_stored_allocator()))
    {
       stable_vector_detail::clear_on_destroy cod(*this);
       this->insert(this->cbegin(), x.begin(), x.end());
@@ -562,9 +600,11 @@ class stable_vector
    //! Throws: If allocator_type's copy constructor throws.
    //! 
    //! Complexity: Constant.
-   stable_vector(BOOST_RV_REF(stable_vector) x) 
-      : internal_data(x.get_al()),impl(x.get_al())
-   {  this->swap(x);   }
+   stable_vector(BOOST_RV_REF(stable_vector) x)
+      : internal_data(boost::move(x.node_alloc())), impl(boost::move(x.impl))
+   {
+      this->priv_swap_members(x);
+   }
 
    //! Effects: Destroys the stable_vector. All stored values are destroyed
    //!   and used memory is deallocated.
@@ -589,7 +629,17 @@ class stable_vector
    stable_vector& operator=(BOOST_COPY_ASSIGN_REF(stable_vector) x)
    {
       STABLE_VECTOR_CHECK_INVARIANT;
-      if (this != &x) {
+      if (&x != this){
+         node_allocator_type &this_alloc     = this->node_alloc();
+         const node_allocator_type &x_alloc  = x.node_alloc();
+         container_detail::bool_ flag;
+         if(flag && this_alloc != x_alloc){
+            this->clear();
+            this->shrink_to_fit();
+         }
+         container_detail::assign_alloc(this->node_alloc(), x.node_alloc(), flag);
+         container_detail::assign_alloc(this->impl.get_stored_allocator(), x.impl.get_stored_allocator(), flag);
          this->assign(x.begin(), x.end());
       }
       return *this;
@@ -606,8 +656,25 @@ class stable_vector
    stable_vector& operator=(BOOST_RV_REF(stable_vector) x)
    {
       if (&x != this){
-         this->swap(x);
-         x.clear();
+         node_allocator_type &this_alloc = this->node_alloc();
+         node_allocator_type &x_alloc    = x.node_alloc();
+         //If allocators are equal we can just swap pointers
+         if(this_alloc == x_alloc){
+            //Destroy objects but retain memory
+            this->clear();
+            this->impl = boost::move(x.impl);
+            this->priv_swap_members(x);
+            //Move allocator if needed
+            container_detail::bool_ flag;
+            container_detail::move_alloc(this->node_alloc(), x.node_alloc(), flag);
+         }
+         //If unequal allocators, then do a one by one move
+         else{
+            typedef typename std::iterator_traits::iterator_category ItCat;
+            this->assign( boost::make_move_iterator(x.begin())
+                        , boost::make_move_iterator(x.end()));
+         }
       }
       return *this;
    }
@@ -641,7 +708,27 @@ class stable_vector
    //! Throws: If allocator's copy constructor throws.
    //! 
    //! Complexity: Constant.
-   allocator_type get_allocator()const  {return get_al();}
+   allocator_type get_allocator()const  {return node_alloc();}
+
+   //! Effects: Returns a reference to the internal allocator.
+   //! 
+   //! Throws: Nothing
+   //! 
+   //! Complexity: Constant.
+   //! 
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+   {  return node_alloc(); }
+
+   //! Effects: Returns a reference to the internal allocator.
+   //! 
+   //! Throws: Nothing
+   //! 
+   //! Complexity: Constant.
+   //! 
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
+   {  return node_alloc(); }
 
 
    //! Effects: Returns an iterator to the first element contained in the stable_vector.
@@ -946,7 +1033,8 @@ class stable_vector
    void push_back(T &x) { push_back(const_cast(x)); }
 
    template
-   void push_back(const U &u, typename containers_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
+   void push_back(const U &u, typename container_detail::enable_if_c
+                  ::value && !::boost::has_move_emulation_enabled::value >::type* =0)
    { return priv_push_back(u); }
    #endif
 
@@ -982,7 +1070,8 @@ class stable_vector
    iterator insert(const_iterator position, T &x) { return this->insert(position, const_cast(x)); }
 
    template
-   iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
+   iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c
+                  ::value && !::boost::has_move_emulation_enabled::value >::type* =0)
    {  return this->priv_insert(position, u); }
    #endif
 
@@ -1035,7 +1124,7 @@ class stable_vector
                         boost::mpl::not_ >());
    }
 
-   #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... in the end of the stable_vector.
@@ -1046,7 +1135,7 @@ class stable_vector
    template
    void emplace_back(Args &&...args)
    {
-      typedef emplace_functor         EmplaceFunctor;
+      typedef emplace_functor         EmplaceFunctor;
       typedef emplace_iterator EmplaceIterator;
       EmplaceFunctor &&ef = EmplaceFunctor(boost::forward(args)...);
       this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator());
@@ -1066,7 +1155,7 @@ class stable_vector
    {
       //Just call more general insert(pos, size, value) and return iterator
       size_type pos_n = position - cbegin();
-      typedef emplace_functor         EmplaceFunctor;
+      typedef emplace_functor         EmplaceFunctor;
       typedef emplace_iterator EmplaceIterator;
       EmplaceFunctor &&ef = EmplaceFunctor(boost::forward(args)...);
       this->insert(position, EmplaceIterator(ef), EmplaceIterator());
@@ -1075,51 +1164,40 @@ class stable_vector
 
    #else
 
-   void emplace_back()
-   {
-      typedef emplace_functor                   EmplaceFunctor;
-      typedef emplace_iterator  EmplaceIterator;
-      EmplaceFunctor ef;
-      this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator());
-   }
-
-   iterator emplace(const_iterator position)
-   {
-      typedef emplace_functor                   EmplaceFunctor;
-      typedef emplace_iterator  EmplaceIterator;
-      EmplaceFunctor ef;
-      size_type pos_n = position - this->cbegin();
-      this->insert(position, EmplaceIterator(ef), EmplaceIterator());
-      return iterator(this->begin() + pos_n);
-   }
-
    #define BOOST_PP_LOCAL_MACRO(n)                                                              \
-   template                                                   \
-   void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                       \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)       \
+   void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                        \
    {                                                                                            \
       typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg)                               \
-                    EmplaceFunctor;                    \
+         BOOST_PP_EXPR_IF(n, <) BOOST_PP_ENUM_PARAMS(n, P) BOOST_PP_EXPR_IF(n, >)               \
+            EmplaceFunctor;                                                                     \
       typedef emplace_iterator  EmplaceIterator;  \
-      EmplaceFunctor ef(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));                \
-      this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator());                       \
+      EmplaceFunctor ef BOOST_PP_LPAREN_IF(n)                                                   \
+                        BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)                   \
+                        BOOST_PP_RPAREN_IF(n);                                                  \
+      this->insert(this->cend() , EmplaceIterator(ef), EmplaceIterator());                      \
    }                                                                                            \
                                                                                                 \
-   template                                                   \
-   iterator emplace(const_iterator pos, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))    \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)       \
+   iterator emplace(const_iterator pos                                                          \
+           BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                         \
    {                                                                                            \
       typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg)                               \
-                    EmplaceFunctor;                    \
+         BOOST_PP_EXPR_IF(n, <) BOOST_PP_ENUM_PARAMS(n, P) BOOST_PP_EXPR_IF(n, >)               \
+            EmplaceFunctor;                                                                     \
       typedef emplace_iterator  EmplaceIterator;  \
-      EmplaceFunctor ef(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));                \
+      EmplaceFunctor ef BOOST_PP_LPAREN_IF(n)                                                   \
+                        BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)                   \
+                        BOOST_PP_RPAREN_IF(n);                                                  \
       size_type pos_n = pos - this->cbegin();                                                   \
       this->insert(pos, EmplaceIterator(ef), EmplaceIterator());                                \
       return iterator(this->begin() + pos_n);                                                   \
    }                                                                                            \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif   //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! Effects: Erases the element at position pos.
    //!
@@ -1157,7 +1235,11 @@ class stable_vector
    void swap(stable_vector & x)
    {
       STABLE_VECTOR_CHECK_INVARIANT;
-      this->swap_impl(*this,x);
+      container_detail::bool_ flag;
+      container_detail::swap_alloc(this->node_alloc(), x.node_alloc(), flag);
+      //vector's allocator is swapped here
+      this->impl.swap(x.impl);
+      this->priv_swap_members(x);
    }
 
    //! Effects: Erases all the elements of the stable_vector.
@@ -1181,7 +1263,8 @@ class stable_vector
          this->clear_pool();
          //If empty completely destroy the index, let's recover default-constructed state
          if(this->empty()){
-            impl_type().swap(this->impl);
+            this->impl.clear();
+            this->impl.shrink_to_fit();
             this->internal_data.set_end_pointer_to_default_constructed();
          }
          //Otherwise, try to shrink-to-fit the index and readjust pointers if necessary
@@ -1209,7 +1292,11 @@ class stable_vector
    void priv_push_back(const value_type &t)
    {  this->insert(end(), t);  }
 
-   void clear_pool(allocator_v1)
+   template
+   void clear_pool(AllocatorVersion,
+      typename boost::container::container_detail::enable_if_c
+         
+            ::value>::type * = 0)
    {
       if(!impl.empty() && impl.back()){
          void_ptr &pool_first_ref = impl.end()[-2];
@@ -1227,15 +1314,18 @@ class stable_vector
       }
    }
 
-   void clear_pool(allocator_v2)
+   template
+   void clear_pool(AllocatorVersion,
+      typename boost::container::container_detail::enable_if_c
+         
+            ::value>::type * = 0)
    {
-
       if(!impl.empty() && impl.back()){
          void_ptr &pool_first_ref = impl.end()[-2];
          void_ptr &pool_last_ref = impl.back();
          multiallocation_chain holder;
          holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
-         get_al().deallocate_individual(boost::move(holder));
+         node_alloc().deallocate_individual(boost::move(holder));
          pool_first_ref = pool_last_ref = 0;
          this->internal_data.pool_size = 0;
       }
@@ -1251,7 +1341,11 @@ class stable_vector
       this->add_to_pool(n, alloc_version());
    }
 
-   void add_to_pool(size_type n, allocator_v1)
+   template
+   void add_to_pool(size_type n, AllocatorVersion,
+      typename boost::container::container_detail::enable_if_c
+         
+            ::value>::type * = 0)
    {
       size_type remaining = n;
       while(remaining--){
@@ -1259,14 +1353,18 @@ class stable_vector
       }
    }
 
-   void add_to_pool(size_type n, allocator_v2)
+   template
+   void add_to_pool(size_type n, AllocatorVersion,
+      typename boost::container::container_detail::enable_if_c
+         
+            ::value>::type * = 0)
    {
       void_ptr &pool_first_ref = impl.end()[-2];
       void_ptr &pool_last_ref = impl.back();
       multiallocation_chain holder;
       holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
       //BOOST_STATIC_ASSERT((::boost::has_move_emulation_enabled::value == true));
-      multiallocation_chain m (get_al().allocate_individual(n));
+      multiallocation_chain m (node_alloc().allocate_individual(n));
       holder.splice_after(holder.before_begin(), m, m.before_begin(), m.last(), n);
       this->internal_data.pool_size += n;
       std::pair data(holder.extract_data());
@@ -1375,8 +1473,8 @@ class stable_vector
 
    template
    iterator priv_erase(const_iterator first, const_iterator last, AllocatorVersion,
-      typename boost::container::containers_detail::enable_if_c
-         
+      typename boost::container::container_detail::enable_if_c
+         
             ::value>::type * = 0)
    {
       STABLE_VECTOR_CHECK_INVARIANT;
@@ -1385,14 +1483,12 @@ class stable_vector
 
    static node_type_ptr_t node_ptr_cast(const void_ptr &p)
    {
-      using boost::get_pointer;
-      return node_type_ptr_t(static_cast(stable_vector_detail::get_pointer(p)));
+      return node_type_ptr_t(static_cast(stable_vector_detail::to_raw_pointer(p)));
    }
 
    static node_type_base_ptr_t node_base_ptr_cast(const void_ptr &p)
    {
-      using boost::get_pointer;
-      return node_type_base_ptr_t(static_cast(stable_vector_detail::get_pointer(p)));
+      return node_type_base_ptr_t(static_cast(stable_vector_detail::to_raw_pointer(p)));
    }
 
    static value_type& value(const void_ptr &p)
@@ -1434,7 +1530,7 @@ class stable_vector
    {
       node_type_ptr_t p = this->allocate_one();
       try{
-         boost::container::construct_in_place(&*p, it);
+         boost::container::construct_in_place(this->node_alloc(), &*p, it);
          p->set_pointer(up);
       }
       catch(...){
@@ -1516,7 +1612,7 @@ class stable_vector
    template 
    void insert_iter_fwd_alloc(const impl_iterator it, FwdIterator first, FwdIterator last, difference_type n, allocator_v2)
    {
-      multiallocation_chain mem(get_al().allocate_individual(n));
+      multiallocation_chain mem(node_alloc().allocate_individual(n));
 
       size_type i = 0;
       node_type_ptr_t p = 0;
@@ -1525,7 +1621,7 @@ class stable_vector
             p = mem.front();
             mem.pop_front();
             //This can throw
-            boost::container::construct_in_place(&*p, first);
+            boost::container::construct_in_place(this->node_alloc(), &*p, first);
             p->set_pointer(void_ptr_ptr(&it[i]));
             ++first;
             it[i] = p;
@@ -1533,8 +1629,8 @@ class stable_vector
          }
       }
       catch(...){
-         get_al().deallocate_one(p);
-         get_al().deallocate_many(boost::move(mem));
+         node_alloc().deallocate_one(p);
+         node_alloc().deallocate_many(boost::move(mem));
          impl_iterator e = impl.erase(it+i, it+n);
          this->align_nodes(e, get_last_align());
          throw;
@@ -1548,13 +1644,13 @@ class stable_vector
       node_type_ptr_t p = 0;
       try{
          while(first != last){
-            p = get_from_pool();
+            p = this->get_from_pool();
             if(!p){
                insert_iter_fwd_alloc(it+i, first, last, n-i, alloc_version());
                break;
             }
             //This can throw
-            boost::container::construct_in_place(&*p, first);
+            boost::container::construct_in_place(this->node_alloc(), &*p, first);
             p->set_pointer(void_ptr_ptr(&it[i]));
             ++first;
             it[i]=p;
@@ -1575,16 +1671,6 @@ class stable_vector
       this->insert_not_iter(position, first, last);
    }
 
-   static void swap_impl(stable_vector& x,stable_vector& y)
-   {
-      using std::swap;
-      swap(x.get_al(),y.get_al());
-      swap(x.impl,y.impl);
-      swap(x.internal_data.pool_size, y.internal_data.pool_size);
-      x.readjust_end_node();
-      y.readjust_end_node();
-   }
-
    #if defined(STABLE_VECTOR_ENABLE_INVARIANT_CHECKING)
    bool invariant()const
    {
@@ -1609,9 +1695,12 @@ class stable_vector
       return n >= num_pool;
    }
 
-   class invariant_checker:private boost::noncopyable
+   class invariant_checker
    {
+      invariant_checker(const invariant_checker &);
+      invariant_checker & operator=(const invariant_checker &);
       const stable_vector* p;
+
       public:
       invariant_checker(const stable_vector& v):p(&v){}
       ~invariant_checker(){BOOST_ASSERT(p->invariant());}
@@ -1619,11 +1708,32 @@ class stable_vector
    };
    #endif
 
-   struct ebo_holder
-      : node_allocator_type
+   class ebo_holder
+      : public node_allocator_type
    {
-      ebo_holder(const allocator_type &a)
-         : node_allocator_type(a), pool_size(0), end_node()
+      private:
+      BOOST_MOVABLE_BUT_NOT_COPYABLE(ebo_holder)
+      public:
+/*
+      explicit ebo_holder(BOOST_RV_REF(ebo_holder) x)
+         : node_allocator_type(boost::move(static_cast(x)))
+         , pool_size(0)
+         , end_node()
+      {}
+*/
+      template
+      explicit ebo_holder(BOOST_FWD_REF(AllocatorRLValue) a)
+         : node_allocator_type(boost::forward(a))
+         , pool_size(0)
+         , end_node()
+      {
+         this->set_end_pointer_to_default_constructed();
+      }
+
+      ebo_holder()
+         : node_allocator_type()
+         , pool_size(0)
+         , end_node()
       {
          this->set_end_pointer_to_default_constructed();
       }
@@ -1637,8 +1747,15 @@ class stable_vector
       node_type_base_t end_node;
    } internal_data;
 
-   node_allocator_type &get_al()              { return internal_data;  }
-   const node_allocator_type &get_al() const  { return internal_data;  }
+   void priv_swap_members(stable_vector &x)
+   {
+      container_detail::do_swap(this->internal_data.pool_size, x.internal_data.pool_size);
+      this->readjust_end_node();
+      x.readjust_end_node();
+   }
+
+   node_allocator_type &node_alloc()              { return internal_data;  }
+   const node_allocator_type &node_alloc() const  { return internal_data;  }
 
    impl_type                           impl;
    /// @endcond
diff --git a/include/boost/container/string.hpp b/include/boost/container/string.hpp
index 8df94ff..feb62cf 100644
--- a/include/boost/container/string.hpp
+++ b/include/boost/container/string.hpp
@@ -30,8 +30,8 @@
 // representations about the suitability of this software for any
 // purpose.  It is provided "as is" without express or implied warranty.
 
-#ifndef BOOST_CONTAINERS_STRING_HPP
-#define BOOST_CONTAINERS_STRING_HPP
+#ifndef BOOST_CONTAINER_STRING_HPP
+#define BOOST_CONTAINER_STRING_HPP
 
 #include 
 #include 
@@ -43,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -75,7 +76,7 @@ namespace container {
 #endif
 
 /// @cond
-namespace containers_detail {
+namespace container_detail {
 // ------------------------------------------------------------
 // Class basic_string_base.  
 
@@ -89,16 +90,20 @@ namespace containers_detail {
 template 
 class basic_string_base
 {
-   basic_string_base();
    BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_string_base)
 
+   typedef allocator_traits allocator_traits_type;
  public:
    typedef A allocator_type;
    //! The stored allocator type
    typedef allocator_type                          stored_allocator_type;
-   typedef typename A::pointer     pointer;
-   typedef typename A::value_type  value_type;
-   typedef typename A::size_type   size_type;
+   typedef typename allocator_traits_type::pointer     pointer;
+   typedef typename allocator_traits_type::value_type  value_type;
+   typedef typename allocator_traits_type::size_type   size_type;
+
+   basic_string_base()
+      : members_()
+   {  init(); }
 
    basic_string_base(const allocator_type& a)
       : members_(a)
@@ -112,16 +117,16 @@ class basic_string_base
    }
 
    basic_string_base(BOOST_RV_REF(basic_string_base) b)
-      :  members_(b.members_)
+      :  members_(boost::move(b.alloc()))
    {  
-      init();
-      this->swap(b); 
+      this->init();
+      this->swap_data(b); 
    }
 
    ~basic_string_base() 
    {  
-      this->deallocate_block(); 
       if(!this->is_short()){
+         this->deallocate_block(); 
          static_cast(static_cast(&this->members_.m_repr.r))->~long_t();
       }
    }
@@ -169,14 +174,14 @@ class basic_string_base
    //so, unlike long_t, it can be placed in a union
    
    typedef typename boost::aligned_storage< sizeof(long_t), 
-       containers_detail::alignment_of::value>::type   long_raw_t;
+       container_detail::alignment_of::value>::type   long_raw_t;
 
    protected:
    static const size_type  MinInternalBufferChars = 8;
    static const size_type  AlignmentOfValueType =
       alignment_of::value;
    static const size_type  ShortDataOffset =
-      containers_detail::ct_rounded_size::value;
+      container_detail::ct_rounded_size::value;
    static const size_type  ZeroCostInternalBufferChars =
       (sizeof(long_t) - ShortDataOffset)/sizeof(value_type);
    static const size_type  UnalignedFinalInternalBufferChars = 
@@ -204,8 +209,13 @@ class basic_string_base
    struct members_holder
       :  public A
    {
-      members_holder(const A &a)
-         :  A(a)
+      members_holder()
+         : A()
+      {}
+
+      template
+      explicit members_holder(BOOST_FWD_REF(AllocatorConvertible) a)
+         :  A(boost::forward(a))
       {}
 
       repr_t m_repr;
@@ -247,10 +257,10 @@ class basic_string_base
 
    protected:
 
-   typedef containers_detail::integral_constant      allocator_v1;
-   typedef containers_detail::integral_constant      allocator_v2;
-   typedef containers_detail::integral_constant::value> alloc_version;
+   typedef container_detail::integral_constant      allocator_v1;
+   typedef container_detail::integral_constant      allocator_v2;
+   typedef container_detail::integral_constant::value> alloc_version;
 
    std::pair
       allocation_command(allocation_type command,
@@ -295,7 +305,7 @@ class basic_string_base
    }
 
    size_type next_capacity(size_type additional_objects) const
-   {  return get_next_capacity(this->alloc().max_size(), this->priv_storage(), additional_objects);  }
+   {  return get_next_capacity(allocator_traits_type::max_size(this->alloc()), this->priv_storage(), additional_objects);  }
 
    void deallocate(pointer p, size_type n) 
    {  
@@ -304,16 +314,16 @@ class basic_string_base
    }
 
    void construct(pointer p, const value_type &value = value_type())
-   {  new((void*)containers_detail::get_pointer(p)) value_type(value);   }
+   {  new((void*)container_detail::to_raw_pointer(p)) value_type(value);   }
 
    void destroy(pointer p, size_type n)
    {
       for(; n--; ++p)
-         containers_detail::get_pointer(p)->~value_type();
+         container_detail::to_raw_pointer(p)->~value_type();
    }
 
    void destroy(pointer p)
-   {  containers_detail::get_pointer(p)->~value_type(); }
+   {  container_detail::to_raw_pointer(p)->~value_type(); }
 
    void allocate_initial_block(size_type n)
    {
@@ -335,7 +345,7 @@ class basic_string_base
    {  this->deallocate(this->priv_addr(), this->priv_storage());  }
       
    size_type max_size() const
-   {  return this->alloc().max_size() - 1; }
+   {  return allocator_traits_type::max_size(this->alloc()) - 1; }
 
    // Helper functions for exception handling.
    void throw_length_error() const
@@ -404,14 +414,14 @@ class basic_string_base
 
    void priv_long_size(size_type sz)
    {  
-      this->members_.m_repr.long_repr().length = static_cast(sz);
+      this->members_.m_repr.long_repr().length = static_cast(sz);
    }
 
-   void swap(basic_string_base& other)
+   void swap_data(basic_string_base& other)
    {
       if(this->is_short()){
          if(other.is_short()){
-            std::swap(this->members_.m_repr, other.members_.m_repr);
+            container_detail::do_swap(this->members_.m_repr, other.members_.m_repr);
          }
          else{
             repr_t copied(this->members_.m_repr);
@@ -426,18 +436,13 @@ class basic_string_base
             this->members_.m_repr = copied;
          }
          else{
-            std::swap(this->members_.m_repr.long_repr(), other.members_.m_repr.long_repr());
+            container_detail::do_swap(this->members_.m_repr.long_repr(), other.members_.m_repr.long_repr());
          }
       }
-
-      allocator_type & this_al = this->alloc(), &other_al = other.alloc();
-      if(this_al != other_al){
-         containers_detail::do_swap(this_al, other_al);
-      }
    }
 };
 
-}  //namespace containers_detail {
+}  //namespace container_detail {
 
 /// @endcond
 
@@ -475,12 +480,13 @@ template , class A = std::al
 template 
 #endif
 class basic_string
-   :  private containers_detail::basic_string_base 
+   :  private container_detail::basic_string_base 
 {
    /// @cond
    private:
+   typedef allocator_traits allocator_traits_type;
    BOOST_COPYABLE_AND_MOVABLE(basic_string)
-   typedef containers_detail::basic_string_base base_t;
+   typedef container_detail::basic_string_base base_t;
    static const typename base_t::size_type InternalBufferChars = base_t::InternalBufferChars;
 
    protected:
@@ -527,17 +533,17 @@ class basic_string
    //! The second template parameter Traits
    typedef Traits                                  traits_type;
    //! Pointer to CharT
-   typedef typename A::pointer                     pointer;
+   typedef typename allocator_traits_type::pointer pointer;
    //! Const pointer to CharT 
-   typedef typename A::const_pointer               const_pointer;
+   typedef typename allocator_traits_type::const_pointer               const_pointer;
    //! Reference to CharT 
-   typedef typename A::reference                   reference;
+   typedef typename allocator_traits_type::reference                   reference;
    //! Const reference to CharT 
-   typedef typename A::const_reference             const_reference;
+   typedef typename allocator_traits_type::const_reference             const_reference;
    //! An unsigned integral type
-   typedef typename A::size_type                   size_type;
+   typedef typename allocator_traits_type::size_type                   size_type;
    //! A signed integral type
-   typedef typename A::difference_type             difference_type;
+   typedef typename allocator_traits_type::difference_type             difference_type;
    //! Iterator used to iterate through a string. It's a Random Access Iterator
    typedef pointer                                 iterator;
    //! Const iterator used to iterate through a string. It's a Random Access Iterator
@@ -562,17 +568,28 @@ class basic_string
    struct reserve_t {};
 
    basic_string(reserve_t, size_type n,
-               const allocator_type& a = allocator_type())
-      : base_t(a, n + 1)
+                const allocator_type& a = allocator_type())
+      //Select allocator as in copy constructor as reserve_t-based constructors
+      //are two step copies optimized for capacity
+      : base_t( allocator_traits_type::select_on_container_copy_construction(a)
+              , n + 1)
    { this->priv_terminate_string(); }
 
    /// @endcond
 
+   //! Effects: Default constructs a basic_string.
+   //! 
+   //! Throws: If allocator_type's default constructor throws.
+   basic_string()
+      : base_t()
+   { this->priv_terminate_string(); }
+
+
    //! Effects: Constructs a basic_string taking the allocator as parameter.
    //! 
    //! Throws: If allocator_type's copy constructor throws.
-   explicit basic_string(const allocator_type& a = allocator_type())
-      : base_t(a, InternalBufferChars)
+   explicit basic_string(const allocator_type& a)
+      : base_t(a)
    { this->priv_terminate_string(); }
 
    //! Effects: Copy constructs a basic_string.
@@ -581,7 +598,7 @@ class basic_string
    //! 
    //! Throws: If allocator_type's default constructor or copy constructor throws.
    basic_string(const basic_string& s) 
-      : base_t(s.alloc()) 
+      :  base_t(allocator_traits_type::select_on_container_copy_construction(s.alloc()))
    { this->priv_range_initialize(s.begin(), s.end()); }
 
    //! Effects: Move constructor. Moves mx's resources to *this.
@@ -603,7 +620,7 @@ class basic_string
          this->throw_out_of_range();
       else
          this->priv_range_initialize
-            (s.begin() + pos, s.begin() + pos + containers_detail::min_value(n, s.size() - pos));
+            (s.begin() + pos, s.begin() + pos + container_detail::min_value(n, s.size() - pos));
    }
 
    //! Effects: Constructs a basic_string taking the allocator as parameter,
@@ -638,8 +655,8 @@ class basic_string
       : base_t(a)
    {
       //Dispatch depending on integer/iterator
-      const bool aux_boolean = containers_detail::is_convertible::value;
-      typedef containers_detail::bool_ Result;
+      const bool aux_boolean = container_detail::is_convertible::value;
+      typedef container_detail::bool_ Result;
       this->priv_initialize_dispatch(f, l, Result());
    }
 
@@ -656,10 +673,24 @@ class basic_string
    //! Postcondition: x == *this.
    //! 
    //! Complexity: Linear to the elements x contains.
-   basic_string& operator=(BOOST_COPY_ASSIGN_REF(basic_string) s)
+   basic_string& operator=(BOOST_COPY_ASSIGN_REF(basic_string) x)
    {
-      if (&s != this) 
-         this->assign(s.begin(), s.end());
+      if (&x != this){
+         allocator_type &this_alloc     = this->alloc();
+         const allocator_type &x_alloc  = x.alloc();
+         container_detail::bool_ flag;
+         if(flag && this_alloc != x_alloc){
+            if(!this->is_short()){
+               this->deallocate_block();
+               this->is_short(true);
+               Traits::assign(*this->priv_addr(), this->priv_null());
+               this->priv_size(0);
+            }
+         }
+         container_detail::assign_alloc(this->alloc(), x.alloc(), flag);
+         this->assign(x.begin(), x.end());
+      }
       return *this;
    }
 
@@ -668,11 +699,25 @@ class basic_string
    //! Throws: If allocator_type's copy constructor throws.
    //! 
    //! Complexity: Constant.
-   basic_string& operator=(BOOST_RV_REF(basic_string) ms)
+   basic_string& operator=(BOOST_RV_REF(basic_string) x)
    {
-      basic_string &s = ms;
-      if (&s != this){
-         this->swap(s);
+      if (&x != this){
+         allocator_type &this_alloc = this->alloc();
+         allocator_type &x_alloc    = x.alloc();
+         //If allocators are equal we can just swap pointers
+         if(this_alloc == x_alloc){
+            //Destroy objects but retain memory in case x reuses it in the future
+            this->clear();
+            this->swap_data(x);
+            //Move allocator if needed
+            container_detail::bool_ flag;
+            container_detail::move_alloc(this_alloc, x_alloc, flag);
+         }
+         //If unequal allocators, then do a one by one move
+         else{
+            this->assign( x.begin(), x.end());
+         }
       }
       return *this;
    }
@@ -709,7 +754,6 @@ class basic_string
    const_iterator cbegin() const
    { return this->priv_addr(); }
 
-
    //! Effects: Returns an iterator to the end of the vector.
    //! 
    //! Throws: Nothing.
@@ -796,6 +840,26 @@ class basic_string
    allocator_type get_allocator() const 
    { return this->alloc(); }
 
+   //! Effects: Returns a reference to the internal allocator.
+   //! 
+   //! Throws: Nothing
+   //! 
+   //! Complexity: Constant.
+   //! 
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->alloc(); }
+
+   //! Effects: Returns a reference to the internal allocator.
+   //! 
+   //! Throws: Nothing
+   //! 
+   //! Complexity: Constant.
+   //! 
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
+   {  return this->alloc(); }
+
    //! Effects: Returns the number of the elements contained in the vector.
    //! 
    //! Throws: Nothing.
@@ -855,7 +919,7 @@ class basic_string
          this->throw_length_error();
 
       if (this->capacity() < res_arg){
-         size_type n = containers_detail::max_value(res_arg, this->size()) + 1;
+         size_type n = container_detail::max_value(res_arg, this->size()) + 1;
          size_type new_cap = this->next_capacity(n);
          pointer new_start = this->allocation_command
             (allocate_new, n, new_cap, new_cap).first;
@@ -912,8 +976,8 @@ class basic_string
             size_type long_storage = this->priv_long_storage();
             size_type long_size    = this->priv_long_size();
             //Shrink from allocated buffer to the internal one, including trailing null
-            Traits::copy( containers_detail::get_pointer(this->priv_short_addr())
-                        , containers_detail::get_pointer(long_addr)
+            Traits::copy( container_detail::to_raw_pointer(this->priv_short_addr())
+                        , container_detail::to_raw_pointer(long_addr)
                         , long_size+1);
             this->is_short(true);
             this->alloc().deallocate(long_addr, long_storage);
@@ -1020,7 +1084,7 @@ class basic_string
       if (pos > s.size())
       this->throw_out_of_range();
       return this->append(s.begin() + pos,
-                          s.begin() + pos + containers_detail::min_value(n, s.size() - pos));
+                          s.begin() + pos + container_detail::min_value(n, s.size() - pos));
    }
 
    //! Requires: s points to an array of at least n elements of CharT.
@@ -1087,7 +1151,7 @@ class basic_string
    //!
    //! Returns: *this
    basic_string& assign(BOOST_RV_REF(basic_string) ms) 
-   {  return this->swap(ms), *this;  }
+   {  return this->swap_data(ms), *this;  }
 
    //! Requires: pos <= str.size()
    //!
@@ -1102,7 +1166,7 @@ class basic_string
       if (pos > s.size())
       this->throw_out_of_range();
       return this->assign(s.begin() + pos, 
-                          s.begin() + pos + containers_detail::min_value(n, s.size() - pos));
+                          s.begin() + pos + container_detail::min_value(n, s.size() - pos));
    }
 
    //! Requires: s points to an array of at least n elements of CharT.
@@ -1137,8 +1201,8 @@ class basic_string
    basic_string& assign(InputIter first, InputIter last) 
    {
       //Dispatch depending on integer/iterator
-      const bool aux_boolean = containers_detail::is_convertible::value;
-      typedef containers_detail::bool_ Result;
+      const bool aux_boolean = container_detail::is_convertible::value;
+      typedef container_detail::bool_ Result;
       return this->priv_assign_dispatch(first, last, Result());
    }
 
@@ -1172,10 +1236,10 @@ class basic_string
    {
       if (pos1 > this->size() || pos2 > s.size())
          this->throw_out_of_range();
-      size_type len = containers_detail::min_value(n, s.size() - pos2);
+      size_type len = container_detail::min_value(n, s.size() - pos2);
       if (this->size() > this->max_size() - len)
          this->throw_length_error();
-      const CharT *beg_ptr = containers_detail::get_pointer(s.begin()) + pos2;
+      const CharT *beg_ptr = container_detail::to_raw_pointer(s.begin()) + pos2;
       const CharT *end_ptr = beg_ptr + len;
       this->insert(this->priv_addr() + pos1, beg_ptr, end_ptr);
       return *this;
@@ -1271,8 +1335,8 @@ class basic_string
    void insert(const_iterator p, InputIter first, InputIter last) 
    {
       //Dispatch depending on integer/iterator
-      const bool aux_boolean = containers_detail::is_convertible::value;
-      typedef containers_detail::bool_ Result;
+      const bool aux_boolean = container_detail::is_convertible::value;
+      typedef container_detail::bool_ Result;
       this->priv_insert_dispatch(p, first, last, Result());
    }
 
@@ -1291,7 +1355,7 @@ class basic_string
    {
       if (pos > size())
          this->throw_out_of_range();
-      erase(this->priv_addr() + pos, this->priv_addr() + pos + containers_detail::min_value(n, size() - pos));
+      erase(this->priv_addr() + pos, this->priv_addr() + pos + container_detail::min_value(n, size() - pos));
       return *this;
    }  
 
@@ -1304,9 +1368,9 @@ class basic_string
    iterator erase(const_iterator p) 
    {
       // The move includes the terminating null.
-      CharT *ptr = const_cast(containers_detail::get_pointer(p));
+      CharT *ptr = const_cast(container_detail::to_raw_pointer(p));
       Traits::move(ptr,
-                   containers_detail::get_pointer(p + 1), 
+                   container_detail::to_raw_pointer(p + 1), 
                    this->priv_size() - (p - this->priv_addr()));
       this->priv_size(this->priv_size()-1);
       return iterator(ptr);
@@ -1322,11 +1386,11 @@ class basic_string
    //!   the other elements being erased. If no such element exists, end() is returned.
    iterator erase(const_iterator first, const_iterator last)
    {
-      CharT * f = const_cast(containers_detail::get_pointer(first));
+      CharT * f = const_cast(container_detail::to_raw_pointer(first));
       if (first != last) { // The move includes the terminating null.
          size_type num_erased = last - first;
          Traits::move(f,
-                      containers_detail::get_pointer(last), 
+                      container_detail::to_raw_pointer(last), 
                       (this->priv_size() + 1)-(last - this->priv_addr()));
          size_type new_length = this->priv_size() - num_erased;
          this->priv_size(new_length);
@@ -1356,7 +1420,7 @@ class basic_string
    {
       if (pos1 > size())
          this->throw_out_of_range();
-      const size_type len = containers_detail::min_value(n1, size() - pos1);
+      const size_type len = container_detail::min_value(n1, size() - pos1);
       if (this->size() - len >= this->max_size() - str.size())
          this->throw_length_error();
       return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len, 
@@ -1377,8 +1441,8 @@ class basic_string
    {
       if (pos1 > size() || pos2 > str.size())
          this->throw_out_of_range();
-      const size_type len1 = containers_detail::min_value(n1, size() - pos1);
-      const size_type len2 = containers_detail::min_value(n2, str.size() - pos2);
+      const size_type len1 = container_detail::min_value(n1, size() - pos1);
+      const size_type len2 = container_detail::min_value(n2, str.size() - pos2);
       if (this->size() - len1 >= this->max_size() - len2)
          this->throw_length_error();
       return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len1,
@@ -1404,7 +1468,7 @@ class basic_string
    {
       if (pos1 > size())
          this->throw_out_of_range();
-      const size_type len = containers_detail::min_value(n1, size() - pos1);
+      const size_type len = container_detail::min_value(n1, size() - pos1);
       if (n2 > this->max_size() || size() - len >= this->max_size() - n2)
          this->throw_length_error();
       return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len,
@@ -1429,7 +1493,7 @@ class basic_string
    {
       if (pos > size())
          this->throw_out_of_range();
-      const size_type len = containers_detail::min_value(n1, size() - pos);
+      const size_type len = container_detail::min_value(n1, size() - pos);
       const size_type n2 = Traits::length(s);
       if (n2 > this->max_size() || size() - len >= this->max_size() - n2)
          this->throw_length_error();
@@ -1449,7 +1513,7 @@ class basic_string
    {
       if (pos1 > size())
          this->throw_out_of_range();
-      const size_type len = containers_detail::min_value(n1, size() - pos1);
+      const size_type len = container_detail::min_value(n1, size() - pos1);
       if (n2 > this->max_size() || size() - len >= this->max_size() - n2)
          this->throw_length_error();
       return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len, n2, c);
@@ -1498,11 +1562,11 @@ class basic_string
    {
       const size_type len = static_cast(i2 - i1);
       if (len >= n) {
-         Traits::assign(const_cast(containers_detail::get_pointer(i1)), n, c);
+         Traits::assign(const_cast(container_detail::to_raw_pointer(i1)), n, c);
          erase(i1 + n, i2);
       }
       else {
-         Traits::assign(const_cast(containers_detail::get_pointer(i1)), len, c);
+         Traits::assign(const_cast(container_detail::to_raw_pointer(i1)), len, c);
          insert(i2, n - len, c);
       }
       return *this;
@@ -1519,8 +1583,8 @@ class basic_string
    basic_string& replace(const_iterator i1, const_iterator i2, InputIter j1, InputIter j2) 
    {
       //Dispatch depending on integer/iterator
-      const bool aux_boolean = containers_detail::is_convertible::value;
-      typedef containers_detail::bool_ Result;
+      const bool aux_boolean = container_detail::is_convertible::value;
+      typedef container_detail::bool_ Result;
       return this->priv_replace_dispatch(i1, i2, j1, j2,  Result());
    }
 
@@ -1539,8 +1603,8 @@ class basic_string
    {
       if (pos > size())
          this->throw_out_of_range();
-      const size_type len = containers_detail::min_value(n, size() - pos);
-      Traits::copy(s, containers_detail::get_pointer(this->priv_addr() + pos), len);
+      const size_type len = container_detail::min_value(n, size() - pos);
+      Traits::copy(s, container_detail::to_raw_pointer(this->priv_addr() + pos), len);
       return len;
    }
 
@@ -1549,7 +1613,11 @@ class basic_string
    //!
    //! Throws: Nothing
    void swap(basic_string& x)
-   {  base_t::swap(x);  }
+   {
+      this->base_t::swap_data(x);
+      container_detail::bool_ flag;
+      container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
+   }
 
    //! Requires: The program shall not alter any of the values stored in the character array.
    //!
@@ -1557,7 +1625,7 @@ class basic_string
    //!
    //! Complexity: constant time.
    const CharT* c_str() const 
-   {  return containers_detail::get_pointer(this->priv_addr()); }
+   {  return container_detail::to_raw_pointer(this->priv_addr()); }
 
    //! Requires: The program shall not alter any of the values stored in the character array.
    //!
@@ -1565,7 +1633,7 @@ class basic_string
    //!
    //! Complexity: constant time.
    const CharT* data()  const 
-   {  return containers_detail::get_pointer(this->priv_addr()); }
+   {  return container_detail::to_raw_pointer(this->priv_addr()); }
 
    //! Effects: Determines the lowest position xpos, if possible, such that both 
    //!   of the following conditions obtain: 19 pos <= xpos and xpos + str.size() <= size();
@@ -1589,8 +1657,8 @@ class basic_string
       else {
          pointer finish = this->priv_addr() + this->priv_size();
          const const_iterator result =
-            std::search(containers_detail::get_pointer(this->priv_addr() + pos), 
-                   containers_detail::get_pointer(finish),
+            std::search(container_detail::to_raw_pointer(this->priv_addr() + pos), 
+                   container_detail::to_raw_pointer(finish),
                    s, s + n, Eq_traits());
          return result != finish ? result - begin() : npos;
       }
@@ -1643,9 +1711,9 @@ class basic_string
       if (n > len)
          return npos;
       else if (n == 0)
-         return containers_detail::min_value(len, pos);
+         return container_detail::min_value(len, pos);
       else {
-         const const_iterator last = begin() + containers_detail::min_value(len - n, pos) + n;
+         const const_iterator last = begin() + container_detail::min_value(len - n, pos) + n;
          const const_iterator result = find_end(begin(), last,
                                                 s, s + n,
                                                 Eq_traits());
@@ -1672,7 +1740,7 @@ class basic_string
       if (len < 1)
          return npos;
       else {
-         const const_iterator last = begin() + containers_detail::min_value(len - 1, pos) + 1;
+         const const_iterator last = begin() + container_detail::min_value(len - 1, pos) + 1;
          const_reverse_iterator rresult =
             std::find_if(const_reverse_iterator(last), rend(),
                   std::bind2nd(Eq_traits(), c));
@@ -1746,7 +1814,7 @@ class basic_string
       if (len < 1)
          return npos;
       else {
-         const const_iterator last = this->priv_addr() + containers_detail::min_value(len - 1, pos) + 1;
+         const const_iterator last = this->priv_addr() + container_detail::min_value(len - 1, pos) + 1;
          const const_reverse_iterator rresult =
             std::find_first_of(const_reverse_iterator(last), rend(),
                                s, s + n,
@@ -1843,7 +1911,7 @@ class basic_string
       if (len < 1)
          return npos;
       else {
-         const const_iterator last = begin() + containers_detail::min_value(len - 1, pos) + 1;
+         const const_iterator last = begin() + container_detail::min_value(len - 1, pos) + 1;
          const const_reverse_iterator rresult =
             std::find_if(const_reverse_iterator(last), rend(),
                     Not_within_traits(s, s + n));
@@ -1869,7 +1937,7 @@ class basic_string
       if (len < 1)
          return npos;
       else {
-         const const_iterator last = begin() + containers_detail::min_value(len - 1, pos) + 1;
+         const const_iterator last = begin() + container_detail::min_value(len - 1, pos) + 1;
          const_reverse_iterator rresult =
             std::find_if(const_reverse_iterator(last), rend(),
                   std::not1(std::bind2nd(Eq_traits(), c)));
@@ -1890,7 +1958,7 @@ class basic_string
       if (pos > size())
          this->throw_out_of_range();
       return basic_string(this->priv_addr() + pos, 
-                          this->priv_addr() + pos + containers_detail::min_value(n, size() - pos), this->alloc());
+                          this->priv_addr() + pos + container_detail::min_value(n, size() - pos), this->alloc());
    }
 
    //! Effects: Determines the effective length rlen of the string to copy as
@@ -1918,7 +1986,7 @@ class basic_string
       if (pos1 > size())
          this->throw_out_of_range();
       return s_compare(this->priv_addr() + pos1, 
-                        this->priv_addr() + pos1 + containers_detail::min_value(n1, size() - pos1),
+                        this->priv_addr() + pos1 + container_detail::min_value(n1, size() - pos1),
                         str.priv_addr(), str.priv_addr() + str.priv_size());
    }
 
@@ -1935,9 +2003,9 @@ class basic_string
       if (pos1 > size() || pos2 > str.size())
          this->throw_out_of_range();
       return s_compare(this->priv_addr() + pos1, 
-                        this->priv_addr() + pos1 + containers_detail::min_value(n1, size() - pos1),
+                        this->priv_addr() + pos1 + container_detail::min_value(n1, size() - pos1),
                         str.priv_addr() + pos2, 
-                        str.priv_addr() + pos2 + containers_detail::min_value(n2, size() - pos2));
+                        str.priv_addr() + pos2 + container_detail::min_value(n2, size() - pos2));
    }
 
    //! Throws: Nothing
@@ -1958,7 +2026,7 @@ class basic_string
       if (pos1 > size())
          this->throw_out_of_range();
       return s_compare(this->priv_addr() + pos1, 
-                        this->priv_addr() + pos1 + containers_detail::min_value(n1, size() - pos1),
+                        this->priv_addr() + pos1 + container_detail::min_value(n1, size() - pos1),
                         s, s + n2);
    }
 
@@ -1977,13 +2045,16 @@ class basic_string
    {
       const difference_type n1 = l1 - f1;
       const difference_type n2 = l2 - f2;
-      const int cmp = Traits::compare(containers_detail::get_pointer(f1), 
-                                      containers_detail::get_pointer(f2), 
-                                      containers_detail::min_value(n1, n2));
+      const int cmp = Traits::compare(container_detail::to_raw_pointer(f1), 
+                                      container_detail::to_raw_pointer(f2), 
+                                      container_detail::min_value(n1, n2));
       return cmp != 0 ? cmp : (n1 < n2 ? -1 : (n1 > n2 ? 1 : 0));
    }
 
-   void priv_shrink_to_fit_dynamic_buffer(allocator_v1)
+   template
+   void priv_shrink_to_fit_dynamic_buffer
+      ( AllocVersion
+      , typename container_detail::enable_if >::type* = 0)
    {
       //Allocate a new buffer.
       size_type real_cap = 0;
@@ -1995,8 +2066,8 @@ class basic_string
          std::pair ret = this->allocation_command
                (allocate_new, long_size+1, long_size+1, real_cap, long_addr);
          //Copy and update
-         Traits::copy( containers_detail::get_pointer(ret.first)
-                     , containers_detail::get_pointer(this->priv_long_addr())
+         Traits::copy( container_detail::to_raw_pointer(ret.first)
+                     , container_detail::to_raw_pointer(this->priv_long_addr())
                      , long_size+1);
          this->priv_long_addr(ret.first);
          this->priv_storage(real_cap);
@@ -2008,7 +2079,10 @@ class basic_string
       }
    }
 
-   void priv_shrink_to_fit_dynamic_buffer(allocator_v2)
+   template
+   void priv_shrink_to_fit_dynamic_buffer
+      ( AllocVersion 
+      , typename container_detail::enable_if >::type* = 0)
    {
       size_type received_size;
       if(this->alloc().allocation_command
@@ -2044,7 +2118,7 @@ class basic_string
                               std::forward_iterator_tag)
    {
       difference_type n = std::distance(f, l);
-      this->allocate_initial_block(containers_detail::max_value(n+1, InternalBufferChars));
+      this->allocate_initial_block(container_detail::max_value(n+1, InternalBufferChars));
       priv_uninitialized_copy(f, l, this->priv_addr());
       this->priv_size(n);
       this->priv_terminate_string();
@@ -2058,16 +2132,16 @@ class basic_string
    }
 
    template 
-   void priv_initialize_dispatch(Integer n, Integer x, containers_detail::true_)
+   void priv_initialize_dispatch(Integer n, Integer x, container_detail::true_)
    {
-      this->allocate_initial_block(containers_detail::max_value(n+1, InternalBufferChars));
+      this->allocate_initial_block(container_detail::max_value(n+1, InternalBufferChars));
       priv_uninitialized_fill_n(this->priv_addr(), n, x);
       this->priv_size(n);
       this->priv_terminate_string();
    }
 
    template 
-   void priv_initialize_dispatch(InputIter f, InputIter l, containers_detail::false_)
+   void priv_initialize_dispatch(InputIter f, InputIter l, container_detail::false_)
    {  this->priv_range_initialize(f, l);  }
  
    template inline
@@ -2117,15 +2191,15 @@ class basic_string
    }
 
    template 
-   basic_string& priv_assign_dispatch(Integer n, Integer x, containers_detail::true_) 
+   basic_string& priv_assign_dispatch(Integer n, Integer x, container_detail::true_) 
    {  return this->assign((size_type) n, (CharT) x);   }
 
    template 
    basic_string& priv_assign_dispatch(InputIter f, InputIter l,
-                                      containers_detail::false_)
+                                      container_detail::false_)
    {
       size_type cur = 0;
-      CharT *ptr = containers_detail::get_pointer(this->priv_addr());
+      CharT *ptr = container_detail::to_raw_pointer(this->priv_addr());
       while (f != l && cur != this->priv_size()) {
          Traits::assign(*ptr, *f);
          ++f;
@@ -2189,10 +2263,10 @@ class basic_string
                                        pointer_past_last, pointer_past_last);
 
                this->priv_size(this->priv_size()+n);
-               Traits::move(const_cast(containers_detail::get_pointer(position + n)),
-                           containers_detail::get_pointer(position),
+               Traits::move(const_cast(container_detail::to_raw_pointer(position + n)),
+                           container_detail::to_raw_pointer(position),
                            (elems_after - n) + 1);
-               this->priv_copy(first, last, const_cast(containers_detail::get_pointer(position)));
+               this->priv_copy(first, last, const_cast(container_detail::to_raw_pointer(position)));
             }
             else {
                ForwardIter mid = first;
@@ -2204,7 +2278,7 @@ class basic_string
                   (position, const_iterator(this->priv_addr() + old_length + 1),
                   this->priv_addr() + this->priv_size());
                this->priv_size(this->priv_size() + elems_after);
-               this->priv_copy(first, mid, const_cast(containers_detail::get_pointer(position)));
+               this->priv_copy(first, mid, const_cast(container_detail::to_raw_pointer(position)));
             }
          }
          else{
@@ -2231,9 +2305,9 @@ class basic_string
             else{
                //value_type is POD, so backwards expansion is much easier 
                //than with vector
-               value_type *oldbuf = containers_detail::get_pointer(old_start);
-               value_type *newbuf = containers_detail::get_pointer(new_start);
-               const value_type *pos    = containers_detail::get_pointer(position);
+               value_type *oldbuf = container_detail::to_raw_pointer(old_start);
+               value_type *newbuf = container_detail::to_raw_pointer(new_start);
+               const value_type *pos    = container_detail::to_raw_pointer(position);
                size_type  before  = pos - oldbuf;
 
                //First move old data
@@ -2253,12 +2327,12 @@ class basic_string
 
    template 
    void priv_insert_dispatch(const_iterator p, Integer n, Integer x,
-                           containers_detail::true_) 
+                           container_detail::true_) 
    {  insert(p, (size_type) n, (CharT) x);   }
 
    template 
    void priv_insert_dispatch(const_iterator p, InputIter first, InputIter last,
-                           containers_detail::false_) 
+                           container_detail::false_) 
    {
       typedef typename std::iterator_traits::iterator_category Category;
       priv_insert(p, first, last, Category());
@@ -2277,13 +2351,13 @@ class basic_string
    template 
    basic_string& priv_replace_dispatch(const_iterator first, const_iterator last,
                                        Integer n, Integer x,
-                                       containers_detail::true_) 
+                                       container_detail::true_) 
    {  return this->replace(first, last, (size_type) n, (CharT) x);   }
 
    template 
    basic_string& priv_replace_dispatch(const_iterator first, const_iterator last,
                                        InputIter f, InputIter l,
-                                       containers_detail::false_) 
+                                       container_detail::false_) 
    {
       typedef typename std::iterator_traits::iterator_category Category;
       return this->priv_replace(first, last, f, l, Category());
@@ -2312,13 +2386,13 @@ class basic_string
       difference_type n = std::distance(f, l);
       const difference_type len = last - first;
       if (len >= n) {
-         this->priv_copy(f, l, const_cast(containers_detail::get_pointer(first)));
+         this->priv_copy(f, l, const_cast(container_detail::to_raw_pointer(first)));
          this->erase(first + n, last);
       }
       else {
          ForwardIter m = f;
          std::advance(m, len);
-         this->priv_copy(f, m, const_cast(containers_detail::get_pointer(first)));
+         this->priv_copy(f, m, const_cast(container_detail::to_raw_pointer(first)));
          this->insert(last, m, l);
       }
       return *this;
@@ -2364,10 +2438,20 @@ operator+(const basic_string& x,
    typedef basic_string str_t;
    typedef typename str_t::reserve_t reserve_t;
    reserve_t reserve;
-   str_t result(reserve, x.size() + y.size(), x.alloc());
+   str_t result(reserve, x.size() + y.size(), x.get_stored_allocator());
    result.append(x);
    result.append(y);
-   return result;
+   return boost::move(result);
+}
+
+template  inline
+BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
+   operator+(
+   BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
+   , BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
+{
+   mx += my;
+   return boost::move(mx);
 }
 
 template  inline
@@ -2386,7 +2470,8 @@ BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
          BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
 {
    typedef typename basic_string::size_type size_type;
-   return my.replace(size_type(0), size_type(0), x);
+   my.replace(size_type(0), size_type(0), x);
+   return boost::move(my);
 }
 
 template 
@@ -2400,7 +2485,7 @@ operator+(const CharT* s, const basic_string& y)
    str_t result(reserve, n + y.size());
    result.append(s, s + n);
    result.append(y);
-   return result;
+   return boost::move(result);
 }
 
 template  inline
@@ -2409,7 +2494,7 @@ operator+(const CharT* s,
          BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
 {
    typedef typename basic_string::size_type size_type;
-   return boost::move(my.get().replace(size_type(0), size_type(0), s));
+   return boost::move(my.replace(size_type(0), size_type(0), s));
 }
 
 template 
@@ -2422,7 +2507,7 @@ operator+(CharT c, const basic_string& y)
    str_t result(reserve, 1 + y.size());
    result.push_back(c);
    result.append(y);
-   return result;
+   return boost::move(result);
 }
 
 template  inline
@@ -2431,7 +2516,7 @@ operator+(CharT c,
          BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
 {
    typedef typename basic_string::size_type size_type;
-   return my.replace(size_type(0), size_type(0), &c, &c + 1);
+   return boost::move(my.replace(size_type(0), size_type(0), &c, &c + 1));
 }
 
 template 
@@ -2442,10 +2527,10 @@ operator+(const basic_string& x, const CharT* s)
    typedef typename str_t::reserve_t reserve_t;
    reserve_t reserve;
    const typename str_t::size_type n = Traits::length(s);
-   str_t result(reserve, x.size() + n, x.alloc());
+   str_t result(reserve, x.size() + n, x.get_stored_allocator());
    result.append(x);
    result.append(s, s + n);
-   return result;
+   return boost::move(result);
 }
 
 template 
@@ -2461,13 +2546,13 @@ template 
 inline basic_string
 operator+(const basic_string& x, const CharT c) 
 {
-  typedef basic_string str_t;
-  typedef typename str_t::reserve_t reserve_t;
+   typedef basic_string str_t;
+   typedef typename str_t::reserve_t reserve_t;
    reserve_t reserve;
-   str_t result(reserve, x.size() + 1, x.alloc());
+   str_t result(reserve, x.size() + 1, x.get_stored_allocator());
    result.append(x);
    result.push_back(c);
-   return result;
+   return boost::move(result);
 }
 
 template 
@@ -2616,7 +2701,7 @@ inline void swap(basic_string& x, basic_string&
 
 /// @cond
 // I/O.  
-namespace containers_detail {
+namespace container_detail {
 
 template 
 inline bool
@@ -2633,7 +2718,7 @@ string_fill(std::basic_ostream& os,
    return ok;
 }
 
-}  //namespace containers_detail {
+}  //namespace container_detail {
 /// @endcond
 
 template 
@@ -2655,13 +2740,13 @@ operator<<(std::basic_ostream& os, const basic_stringsputn(s.data(), std::streamsize(n)) == std::streamsize(n);
 
       if (left)
-         ok = ok && containers_detail::string_fill(os, buf, pad_len);
+         ok = ok && container_detail::string_fill(os, buf, pad_len);
    }
 
    if (!ok)
@@ -2783,4 +2868,4 @@ struct has_trivial_destructor_after_move
 
 #include 
 
-#endif // BOOST_CONTAINERS_STRING_HPP
+#endif // BOOST_CONTAINER_STRING_HPP
diff --git a/include/boost/container/vector.hpp b/include/boost/container/vector.hpp
index be1a222..7a2aa4f 100644
--- a/include/boost/container/vector.hpp
+++ b/include/boost/container/vector.hpp
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_CONTAINERS_VECTOR_HPP
-#define BOOST_CONTAINERS_CONTAINERS_VECTOR_HPP
+#ifndef BOOST_CONTAINER_CONTAINER_VECTOR_HPP
+#define BOOST_CONTAINER_CONTAINER_VECTOR_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -31,17 +31,20 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
-#include 
+#include 
+#include 
 #include 
+#include 
 #include 
 
 namespace boost {
@@ -49,25 +52,19 @@ namespace container {
 
 /// @cond
 
-namespace containers_detail {
+namespace container_detail {
 
 //! Const vector_iterator used to iterate through a vector. 
 template 
 class vector_const_iterator
-   : public std::iterator::value_type
-                          ,typename std::iterator_traits::difference_type
-                          ,typename boost::pointer_to_other
-                              ::value_type
-                              >::type
-                          ,const typename std::iterator_traits::value_type &>
 {
    public:
-   typedef typename std::iterator_traits::value_type  value_type;
-   typedef typename std::iterator_traits::difference_type   difference_type;
-   typedef typename boost::pointer_to_other::type      pointer;
-   typedef const value_type&                                               reference;
+	typedef std::random_access_iterator_tag                                          iterator_category;
+   typedef typename boost::intrusive::pointer_traits::element_type         value_type;
+   typedef typename boost::intrusive::pointer_traits::difference_type      difference_type;
+   typedef typename boost::intrusive::pointer_traits::template
+                                 rebind_pointer::type             pointer;
+   typedef  const value_type&                                                       reference;
 
    /// @cond
    protected:
@@ -88,7 +85,7 @@ class vector_const_iterator
    {  return *m_ptr;  }
 
    const value_type * operator->()  const  
-   {  return  containers_detail::get_pointer(m_ptr);  }
+   {  return  container_detail::to_raw_pointer(m_ptr);  }
 
    reference operator[](difference_type off) const
    {  return m_ptr[off];   }
@@ -156,10 +153,11 @@ class vector_iterator
    {}
 
    public:
-   typedef typename std::iterator_traits::value_type        value_type;
-   typedef typename vector_const_iterator::difference_type  difference_type;
-   typedef Pointer                                                   pointer;
-   typedef value_type&                                               reference;
+	typedef std::random_access_iterator_tag                                       iterator_category;
+   typedef typename boost::intrusive::pointer_traits::element_type      value_type;
+   typedef typename boost::intrusive::pointer_traits::difference_type   difference_type;
+   typedef Pointer                                                               pointer;
+   typedef value_type&                                                           reference;
 
    //Constructors
    vector_iterator()
@@ -170,7 +168,7 @@ class vector_iterator
    {  return *this->m_ptr;  }
 
    value_type* operator->() const  
-   {  return  containers_detail::get_pointer(this->m_ptr);  }
+   {  return  container_detail::to_raw_pointer(this->m_ptr);  }
 
    reference operator[](difference_type off) const 
    {  return this->m_ptr[off];   }
@@ -216,30 +214,35 @@ struct vector_value_traits
    static const bool trivial_dctr = boost::has_trivial_destructor::value;
    static const bool trivial_dctr_after_move = trivial_dctr;
       //::boost::has_trivial_destructor_after_move::value || trivial_dctr;
+   //static const bool trivial_copy = has_trivial_copy::value;
+   //static const bool nothrow_copy = has_nothrow_copy::value;
+   //static const bool trivial_assign = has_trivial_assign::value;
+   //static const bool nothrow_assign = has_nothrow_assign::value;
+
    static const bool trivial_copy = has_trivial_copy::value;
    static const bool nothrow_copy = has_nothrow_copy::value;
    static const bool trivial_assign = has_trivial_assign::value;
-   static const bool nothrow_assign = has_nothrow_assign::value;
+   static const bool nothrow_assign = false;
 
    //This is the anti-exception array destructor
    //to deallocate values already constructed
-   typedef typename containers_detail::if_c
+   typedef typename container_detail::if_c
       
-      ,containers_detail::scoped_destructor_n
+      ,container_detail::null_scoped_destructor_n
+      ,container_detail::scoped_destructor_n
       >::type   OldArrayDestructor;
    //This is the anti-exception array destructor
    //to destroy objects created with copy construction
-   typedef typename containers_detail::if_c
+   typedef typename container_detail::if_c
       
-      ,containers_detail::scoped_destructor_n
+      ,container_detail::null_scoped_destructor_n
+      ,container_detail::scoped_destructor_n
       >::type   ArrayDestructor;
    //This is the anti-exception array deallocator
-   typedef typename containers_detail::if_c
+   typedef typename container_detail::if_c
       
-      ,containers_detail::scoped_array_deallocator
+      ,container_detail::null_scoped_array_deallocator
+      ,container_detail::scoped_array_deallocator
       >::type   ArrayDeallocator;
 };
 
@@ -247,14 +250,22 @@ struct vector_value_traits
 template 
 struct vector_alloc_holder 
 {
-   typedef typename A::pointer      pointer;
-   typedef typename A::size_type    size_type;
-   typedef typename A::value_type   value_type;
-   typedef vector_value_traits value_traits;
+   typedef boost::container::allocator_traits         allocator_traits_type;
+   typedef typename allocator_traits_type::pointer       pointer;
+   typedef typename allocator_traits_type::size_type     size_type;
+   typedef typename allocator_traits_type::value_type    value_type;
+   typedef vector_value_traits            value_traits;
 
    //Constructor, does not throw
-   vector_alloc_holder(const A &a)
-      : members_(a)
+   vector_alloc_holder()
+      BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor::value)
+      : members_()
+   {}
+
+   //Constructor, does not throw
+   template
+   explicit vector_alloc_holder(BOOST_FWD_REF(AllocConvertible) a) BOOST_CONTAINER_NOEXCEPT
+      : members_(boost::forward(a))
    {}
 
    //Destructor
@@ -264,10 +275,10 @@ struct vector_alloc_holder
       this->prot_deallocate();
    }
 
-   typedef containers_detail::integral_constant      allocator_v1;
-   typedef containers_detail::integral_constant      allocator_v2;
-   typedef containers_detail::integral_constant::value> alloc_version;
+   typedef container_detail::integral_constant      allocator_v1;
+   typedef container_detail::integral_constant      allocator_v2;
+   typedef container_detail::integral_constant::value> alloc_version;
    std::pair
       allocation_command(allocation_type command,
                          size_type limit_size, 
@@ -307,7 +318,10 @@ struct vector_alloc_holder
    }
 
    size_type next_capacity(size_type additional_objects) const
-   {  return get_next_capacity(this->alloc().max_size(), this->members_.m_capacity, additional_objects);  }
+   {
+      return get_next_capacity( allocator_traits_type::max_size(this->alloc())
+                              , this->members_.m_capacity, additional_objects);
+   }
 
    struct members_holder
       : public A
@@ -316,8 +330,13 @@ struct vector_alloc_holder
       members_holder(const members_holder&);
 
       public:
-      members_holder(const A &alloc)
-         :  A(alloc), m_start(0), m_size(0), m_capacity(0)
+      template
+      explicit members_holder(BOOST_FWD_REF(Alloc) alloc)
+         :  A(boost::forward(alloc)), m_start(0), m_size(0), m_capacity(0)
+      {}
+
+      members_holder()
+         :  A(), m_start(0), m_size(0), m_capacity(0)
       {}
 
       pointer     m_start;
@@ -325,6 +344,13 @@ struct vector_alloc_holder
       size_type   m_capacity;
    } members_;
 
+   void swap_members(vector_alloc_holder &x)
+   {
+      container_detail::do_swap(this->members_.m_start, x.members_.m_start);
+      container_detail::do_swap(this->members_.m_size, x.members_.m_size);
+      container_detail::do_swap(this->members_.m_capacity, x.members_.m_capacity);
+   }
+
    A &alloc()
    {  return members_;  }
 
@@ -344,23 +370,26 @@ struct vector_alloc_holder
    void destroy(value_type* p)
    {
       if(!value_traits::trivial_dctr)
-         containers_detail::get_pointer(p)->~value_type();
+         allocator_traits_type::destroy(this->alloc(), p);
    }
 
    void destroy_n(value_type* p, size_type n)
    {
-      if(!value_traits::trivial_dctr)
-         for(; n--; ++p)   p->~value_type();
+      if(!value_traits::trivial_dctr){
+         for(; n--; ++p){
+            allocator_traits_type::destroy(this->alloc(), p);
+         }
+      }
    }
 
    void prot_destroy_all()
    {
-      this->destroy_n(containers_detail::get_pointer(this->members_.m_start), this->members_.m_size);
+      this->destroy_n(container_detail::to_raw_pointer(this->members_.m_start), this->members_.m_size);
       this->members_.m_size = 0;
    }
 };
 
-}  //namespace containers_detail {
+}  //namespace container_detail {
 /// @endcond
 
 //! \class vector
@@ -375,33 +404,34 @@ template  >
 #else
 template 
 #endif
-class vector : private containers_detail::vector_alloc_holder
+class vector : private container_detail::vector_alloc_holder
 {
    /// @cond
    typedef vector                   self_t;
-   typedef containers_detail::vector_alloc_holder base_t;
+   typedef container_detail::vector_alloc_holder base_t;
+   typedef allocator_traits            allocator_traits_type;
    /// @endcond
    public:
    //! The type of object, T, stored in the vector
-   typedef T                                       value_type;
+   typedef T                                                value_type;
    //! Pointer to T
-   typedef typename A::pointer                     pointer;
+   typedef typename allocator_traits_type::pointer          pointer;
    //! Const pointer to T
-   typedef typename A::const_pointer               const_pointer;
+   typedef typename allocator_traits_type::const_pointer    const_pointer;
    //! Reference to T
-   typedef typename A::reference                   reference;
+   typedef typename allocator_traits_type::reference        reference;
    //! Const reference to T
-   typedef typename A::const_reference             const_reference;
+   typedef typename allocator_traits_type::const_reference  const_reference;
    //! An unsigned integral type
-   typedef typename A::size_type                   size_type;
+   typedef typename allocator_traits_type::size_type        size_type;
    //! A signed integral type
-   typedef typename A::difference_type             difference_type;
+   typedef typename allocator_traits_type::difference_type  difference_type;
    //! The allocator type
    typedef A                                       allocator_type;
    //! The random access iterator
-   typedef containers_detail::vector_iterator        iterator;
+   typedef container_detail::vector_iterator        iterator;
    //! The random access const_iterator
-   typedef containers_detail::vector_const_iterator  const_iterator;
+   typedef container_detail::vector_const_iterator  const_iterator;
 
    //! Iterator used to iterate backwards through a vector. 
    typedef std::reverse_iterator   
@@ -415,8 +445,8 @@ class vector : private containers_detail::vector_alloc_holder
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(vector)
-   typedef containers_detail::advanced_insert_aux_int    advanced_insert_aux_int_t;
-   typedef containers_detail::vector_value_traits value_traits;
+   typedef container_detail::advanced_insert_aux_int    advanced_insert_aux_int_t;
+   typedef container_detail::vector_value_traits value_traits;
 
    typedef typename base_t::allocator_v1           allocator_v1;
    typedef typename base_t::allocator_v2           allocator_v2;
@@ -431,33 +461,43 @@ class vector : private containers_detail::vector_alloc_holder
 
    //! Effects: Constructs a vector taking the allocator as parameter.
    //! 
-   //! Throws: If allocator_type's copy constructor throws.
+   //! Throws: If allocator_type's default constructor throws.
    //! 
    //! Complexity: Constant.
-   explicit vector(const A& a = A())
+   vector()
+      BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor::value)
+      : base_t()
+   {}
+
+   //! Effects: Constructs a vector taking the allocator as parameter.
+   //! 
+   //! Throws: Nothing
+   //! 
+   //! Complexity: Constant.
+   explicit vector(const A& a) BOOST_CONTAINER_NOEXCEPT
       : base_t(a)
    {}
 
    //! Effects: Constructs a vector that will use a copy of allocator a
    //!   and inserts n default contructed values.
    //!
-   //! Throws: If allocator_type's default constructor or copy constructor
-   //!   throws or T's default or copy constructor throws.
+   //! Throws: If allocator_type's default constructor or allocation
+   //!   throws or T's default constructor throws.
    //! 
    //! Complexity: Linear to n.
-   explicit vector(size_type n) 
-      :  base_t(allocator_type())
+   explicit vector(size_type n)
+      :  base_t()
    {
       //Allocate
       size_type real_cap;
       std::pair ret =
          this->allocation_command(allocate_new, n, n, real_cap, this->members_.m_start);
-      T *new_mem = containers_detail::get_pointer(ret.first);
+      T *new_mem = container_detail::to_raw_pointer(ret.first);
       //Anti-exception rollback
       typename value_traits::ArrayDeallocator scoped_alloc(new_mem, this->alloc(), real_cap);
       //Default constructor
-      containers_detail::default_construct_aux_proxy proxy(n);
-      proxy.uninitialized_copy_all_to(new_mem);
+      container_detail::default_construct_aux_proxy proxy(this->alloc(), n);
+      proxy.uninitialized_copy_remaining_to(new_mem);
       //All ok, commit
       this->members_.m_start = ret.first;
       this->members_.m_size  = n;
@@ -468,8 +508,8 @@ class vector : private containers_detail::vector_alloc_holder
    //! Effects: Constructs a vector that will use a copy of allocator a
    //!   and inserts n copies of value.
    //!
-   //! Throws: If allocator_type's default constructor or copy constructor
-   //!   throws or T's default or copy constructor throws.
+   //! Throws: If allocator_type's default constructor or allocation
+   //!   throws or T's copy constructor throws.
    //! 
    //! Complexity: Linear to n.
    vector(size_type n, const T& value, const allocator_type& a = allocator_type()) 
@@ -480,24 +520,30 @@ class vector : private containers_detail::vector_alloc_holder
    //!
    //! Postcondition: x == *this.
    //! 
+   //! Throws: If allocator_type's default constructor or allocation
+   //!   throws or T's copy constructor throws.
+   //! 
    //! Complexity: Linear to the elements x contains.
-   vector(const vector& x) 
-      :  base_t(static_cast(x).alloc())
-   {  *this = x;  }
+   vector(const vector &x) 
+      :  base_t(allocator_traits_type::select_on_container_copy_construction(x.alloc()))
+   {
+      this->assign( container_detail::to_raw_pointer(x.members_.m_start)
+                  , container_detail::to_raw_pointer(x.members_.m_start + x.members_.m_size));
+   }
 
    //! Effects: Move constructor. Moves mx's resources to *this.
    //!
-   //! Throws: If allocator_type's copy constructor throws.
+   //! Throws: Nothing
    //! 
    //! Complexity: Constant.
-   vector(BOOST_RV_REF(vector) mx) 
-      :  base_t(static_cast(mx).alloc())
-   {  this->swap(mx);   }
+   vector(BOOST_RV_REF(vector) mx) BOOST_CONTAINER_NOEXCEPT
+      :  base_t(boost::move(mx.alloc()))
+   {  this->swap_members(mx);   }
 
    //! Effects: Constructs a vector that will use a copy of allocator a
    //!   and inserts a copy of the range [first, last) in the vector.
    //!
-   //! Throws: If allocator_type's default constructor or copy constructor
+   //! Throws: If allocator_type's default constructor or allocation
    //!   throws or T's constructor taking an dereferenced InIt throws.
    //!
    //! Complexity: Linear to the range [first, last).
@@ -512,7 +558,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //!
    //! Complexity: Linear to the number of elements.
-   ~vector() 
+   ~vector() BOOST_CONTAINER_NOEXCEPT
    {} //vector_alloc_holder clears the data
 
    //! Effects: Returns an iterator to the first element contained in the vector.
@@ -520,7 +566,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   iterator begin()      
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
    { return iterator(this->members_.m_start); }
 
    //! Effects: Returns a const_iterator to the first element contained in the vector.
@@ -528,7 +574,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_iterator begin() const
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
    { return const_iterator(this->members_.m_start); }
 
    //! Effects: Returns an iterator to the end of the vector.
@@ -536,7 +582,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   iterator end()        
+   iterator end() BOOST_CONTAINER_NOEXCEPT
    { return iterator(this->members_.m_start + this->members_.m_size); }
 
    //! Effects: Returns a const_iterator to the end of the vector.
@@ -544,7 +590,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_iterator end()   const
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
    { return this->cend(); }
 
    //! Effects: Returns a reverse_iterator pointing to the beginning 
@@ -553,7 +599,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   reverse_iterator rbegin()     
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
    { return reverse_iterator(this->end());      }
 
    //! Effects: Returns a const_reverse_iterator pointing to the beginning 
@@ -562,7 +608,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_reverse_iterator rbegin()const
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
    { return this->crbegin(); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
@@ -571,7 +617,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   reverse_iterator rend()       
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
    { return reverse_iterator(this->begin());       }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
@@ -580,7 +626,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_reverse_iterator rend()  const
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
    { return this->crend(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the vector.
@@ -588,7 +634,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_iterator cbegin() const
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
    { return const_iterator(this->members_.m_start); }
 
    //! Effects: Returns a const_iterator to the end of the vector.
@@ -596,7 +642,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_iterator cend()   const
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
    { return const_iterator(this->members_.m_start + this->members_.m_size); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the beginning 
@@ -605,7 +651,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_reverse_iterator crbegin()const
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
    { return const_reverse_iterator(this->end());}
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
@@ -614,7 +660,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_reverse_iterator crend()  const
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
    { return const_reverse_iterator(this->begin()); }
 
    //! Requires: !empty()
@@ -625,7 +671,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   reference         front()       
+   reference         front() BOOST_CONTAINER_NOEXCEPT
    { return *this->members_.m_start; }
 
    //! Requires: !empty()
@@ -636,7 +682,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_reference   front() const 
+   const_reference   front() const BOOST_CONTAINER_NOEXCEPT
    { return *this->members_.m_start; }
 
    //! Requires: !empty()
@@ -647,7 +693,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   reference         back()        
+   reference         back() BOOST_CONTAINER_NOEXCEPT
    { return this->members_.m_start[this->members_.m_size - 1]; }
 
    //! Requires: !empty()
@@ -658,7 +704,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_reference   back()  const 
+   const_reference   back()  const BOOST_CONTAINER_NOEXCEPT
    { return this->members_.m_start[this->members_.m_size - 1]; }
 
    //! Returns: A pointer such that [data(),data() + size()) is a valid range.
@@ -667,7 +713,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   pointer data()        
+   pointer data() BOOST_CONTAINER_NOEXCEPT
    { return this->members_.m_start; }
 
    //! Returns: A pointer such that [data(),data() + size()) is a valid range.
@@ -676,7 +722,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_pointer data()  const 
+   const_pointer data()  const BOOST_CONTAINER_NOEXCEPT
    { return this->members_.m_start; }
 
    //! Effects: Returns the number of the elements contained in the vector.
@@ -684,7 +730,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
    { return this->members_.m_size; }
 
    //! Effects: Returns the largest possible size of the vector.
@@ -692,8 +738,8 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   size_type max_size() const 
-   { return this->alloc().max_size(); }
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
+   { return allocator_traits_type::max_size(this->alloc()); }
 
    //! Effects: Number of elements for which memory has been allocated.
    //!   capacity() is always greater than or equal to size().
@@ -701,7 +747,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   size_type capacity() const 
+   size_type capacity() const BOOST_CONTAINER_NOEXCEPT
    { return this->members_.m_capacity; }
 
    //! Effects: Returns true if the vector contains no elements.
@@ -709,7 +755,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
    { return !this->members_.m_size; }
 
    //! Requires: size() < n.
@@ -731,7 +777,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //! 
    //! Complexity: Constant.
-   const_reference operator[](size_type n) const   
+   const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
    { return this->members_.m_start[n]; }
 
    //! Requires: size() < n.
@@ -742,7 +788,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: std::range_error if n >= size()
    //! 
    //! Complexity: Constant.
-   reference at(size_type n)
+   reference at(size_type n) 
    { this->priv_check_range(n); return this->members_.m_start[n]; }
 
    //! Requires: size() < n.
@@ -761,13 +807,27 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: If allocator's copy constructor throws.
    //! 
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
    { return this->alloc();  }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   //! Effects: Returns a reference to the internal allocator.
+   //! 
+   //! Throws: Nothing
+   //! 
+   //! Complexity: Constant.
+   //! 
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
    {  return this->alloc(); }
 
-   stored_allocator_type &get_stored_allocator()
+   //! Effects: Returns a reference to the internal allocator.
+   //! 
+   //! Throws: Nothing
+   //! 
+   //! Complexity: Constant.
+   //! 
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
    {  return this->alloc(); }
 
    //! Effects: If n is less than or equal to capacity(), this call has no
@@ -791,7 +851,7 @@ class vector : private containers_detail::vector_alloc_holder
          //Check for forward expansion
          same_buffer_start = ret.second && this->members_.m_start == ret.first;
          if(same_buffer_start){
-            #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+            #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
             ++this->num_expand_fwd;
             #endif
             this->members_.m_capacity  = real_cap;
@@ -800,30 +860,30 @@ class vector : private containers_detail::vector_alloc_holder
          //If there is no forward expansion, move objects
          else{
             //We will reuse insert code, so create a dummy input iterator
-            T *dummy_it(containers_detail::get_pointer(this->members_.m_start));
-            containers_detail::advanced_insert_aux_proxy, T*>
-               proxy(::boost::make_move_iterator(dummy_it), ::boost::make_move_iterator(dummy_it));
+            T *dummy_it(container_detail::to_raw_pointer(this->members_.m_start));
+            container_detail::advanced_insert_aux_proxy, T*>
+               proxy(this->alloc(), ::boost::make_move_iterator(dummy_it), ::boost::make_move_iterator(dummy_it));
             //Backwards (and possibly forward) expansion
             if(ret.second){
-               #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+               #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
                ++this->num_expand_bwd;
                #endif
                this->priv_range_insert_expand_backwards
-                  ( containers_detail::get_pointer(ret.first)
+                  ( container_detail::to_raw_pointer(ret.first)
                   , real_cap
-                  , containers_detail::get_pointer(this->members_.m_start)
+                  , container_detail::to_raw_pointer(this->members_.m_start)
                   , 0
                   , proxy);
             }
             //New buffer
             else{
-               #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+               #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
                ++this->num_alloc;
                #endif
                this->priv_range_insert_new_allocation
-                  ( containers_detail::get_pointer(ret.first)
+                  ( container_detail::to_raw_pointer(ret.first)
                   , real_cap
-                  , containers_detail::get_pointer(this->members_.m_start)
+                  , container_detail::to_raw_pointer(this->members_.m_start)
                   , 0
                   , proxy);
             }
@@ -836,13 +896,23 @@ class vector : private containers_detail::vector_alloc_holder
    //! Postcondition: this->size() == x.size(). *this contains a copy 
    //! of each of x's elements. 
    //!
-   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //! Throws: If memory allocation throws or T's copy/move constructor/assignment throws.
    //!
    //! Complexity: Linear to the number of elements in x.
    vector& operator=(BOOST_COPY_ASSIGN_REF(vector) x)
    {
       if (&x != this){
-         this->assign(x.members_.m_start, x.members_.m_start + x.members_.m_size);
+         allocator_type &this_alloc     = this->alloc();
+         const allocator_type &x_alloc  = x.alloc();
+         container_detail::bool_ flag;
+         if(flag && this_alloc != x_alloc){
+            this->clear();
+            this->shrink_to_fit();
+         }
+         container_detail::assign_alloc(this_alloc, x_alloc, flag);
+         this->assign( container_detail::to_raw_pointer(x.members_.m_start)
+                     , container_detail::to_raw_pointer(x.members_.m_start + x.members_.m_size));
       }
       return *this;
    }
@@ -852,21 +922,39 @@ class vector : private containers_detail::vector_alloc_holder
    //! Postcondition: x.empty(). *this contains a the elements x had
    //!   before the function.
    //!
-   //! Throws: If allocator_type's copy constructor throws.
+   //! Throws: Nothing
    //!
    //! Complexity: Linear.
    vector& operator=(BOOST_RV_REF(vector) x)
+      //iG BOOST_CONTAINER_NOEXCEPT_IF(!allocator_type::propagate_on_container_move_assignment::value || is_nothrow_move_assignable::value);)
+      BOOST_CONTAINER_NOEXCEPT
    {
       if (&x != this){
-         this->swap(x);
-         x.clear();
+         allocator_type &this_alloc = this->alloc();
+         allocator_type &x_alloc    = x.alloc();
+         //If allocators are equal we can just swap pointers
+         if(this_alloc == x_alloc){
+            //Destroy objects but retain memory in case x reuses it in the future
+            this->clear();
+            this->swap_members(x);
+            //Move allocator if needed
+            container_detail::bool_ flag;
+            container_detail::move_alloc(this_alloc, x_alloc, flag);
+         }
+         //If unequal allocators, then do a one by one move
+         else{
+            this->assign( boost::make_move_iterator(container_detail::to_raw_pointer(x.members_.m_start))
+                        , boost::make_move_iterator(container_detail::to_raw_pointer(x.members_.m_start + x.members_.m_size)));
+         }
       }
       return *this;
    }
 
    //! Effects: Assigns the n copies of val to *this.
    //!
-   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //! Throws: If memory allocation throws or
+   //!   T's copy/move constructor/assignment throws.
    //!
    //! Complexity: Linear to n.
    void assign(size_type n, const value_type& val)
@@ -874,16 +962,16 @@ class vector : private containers_detail::vector_alloc_holder
 
    //! Effects: Assigns the the range [first, last) to *this.
    //!
-   //! Throws: If memory allocation throws or
-   //!   T's constructor from dereferencing InpIt throws.
+   //! Throws: If memory allocation throws or T's copy/move constructor/assignment or
+   //!   T's constructor/assignment from dereferencing InpIt throws.
    //!
    //! Complexity: Linear to n.
    template 
    void assign(InIt first, InIt last) 
    {
       //Dispatch depending on integer/iterator
-      const bool aux_boolean = containers_detail::is_convertible::value;
-      typedef containers_detail::bool_ Result;
+      const bool aux_boolean = container_detail::is_convertible::value;
+      typedef container_detail::bool_ Result;
       this->priv_assign_dispatch(first, last, Result());
    }
 
@@ -891,7 +979,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Effects: Inserts a copy of x at the end of the vector.
    //!
    //! Throws: If memory allocation throws or
-   //!   T's copy constructor throws.
+   //!   T's copy/move constructor throws.
    //!
    //! Complexity: Amortized constant time.
    void push_back(const T &x);
@@ -899,7 +987,8 @@ class vector : private containers_detail::vector_alloc_holder
    //! Effects: Constructs a new element in the end of the vector
    //!   and moves the resources of mx to this new element.
    //!
-   //! Throws: If memory allocation throws.
+   //! Throws: If memory allocation throws or
+   //!   T's move constructor throws.
    //!
    //! Complexity: Amortized constant time.
    void push_back(T &&x);
@@ -907,69 +996,26 @@ class vector : private containers_detail::vector_alloc_holder
    BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
    #endif
 
-/*
-   void push_back(insert_const_ref_type x) 
-   {  return priv_push_back(x);  }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   void push_back(T &x) { push_back(const_cast(x)); }
-
-   template
-   typename containers_detail::enable_if_c
-                     ::value &&
-                     containers_detail::is_same::value
-                     >::type
-   push_back(const U &u)
-   { return priv_push_back(u); }
-
-   #endif
-
-   //! Effects: Constructs a new element in the end of the vector
-   //!   and moves the resources of mx to this new element.
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_back(BOOST_RV_REF(T) x)
-   {
-      if (this->members_.m_size < this->members_.m_capacity){
-         //There is more memory, just construct a new object at the end
-         new((void*)containers_detail::get_pointer(this->members_.m_start + this->members_.m_size))value_type(::boost::move(x));
-         ++this->members_.m_size;
-      }
-      else{
-         this->insert(this->cend(), ::boost::move(x));
-      }
-   }
-*/
-   //! Effects: Constructs a new element in the end of the vector
-   //!   and moves the resources of mx to this new element.
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Amortized constant time.
-
-
-   #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... in the end of the vector.
    //!
-   //! Throws: If memory allocation throws or the in-place constructor throws.
+   //! Throws: If memory allocation throws or the in-place constructor throws or
+   //!   T's move constructor throws.
    //!
    //! Complexity: Amortized constant time.
    template
    void emplace_back(Args &&...args)
    {
-      T* back_pos = containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size;
+      T* back_pos = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
       if (this->members_.m_size < this->members_.m_capacity){
          //There is more memory, just construct a new object at the end
-         new((void*)(back_pos))value_type(::boost::forward(args)...);
+         allocator_traits_type::construct(this->alloc(), back_pos, ::boost::forward(args)...);
          ++this->members_.m_size;
       }
       else{
-         typedef containers_detail::advanced_insert_aux_emplace type;
-         type &&proxy = type(::boost::forward(args)...);
+         typedef container_detail::advanced_insert_aux_emplace type;
+         type &&proxy = type(this->alloc(), ::boost::forward(args)...);
          priv_range_insert(back_pos, 1, proxy);
       }
    }
@@ -979,7 +1025,8 @@ class vector : private containers_detail::vector_alloc_holder
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... before position
    //!
-   //! Throws: If memory allocation throws or the in-place constructor throws.
+   //! Throws: If memory allocation throws or the in-place constructor throws or
+   //!   T's move constructor/assignment throws.
    //!
    //! Complexity: If position is end(), amortized constant time
    //!   Linear time otherwise.
@@ -988,69 +1035,49 @@ class vector : private containers_detail::vector_alloc_holder
    {
       //Just call more general insert(pos, size, value) and return iterator
       size_type pos_n = position - cbegin();
-      typedef containers_detail::advanced_insert_aux_emplace type;
-      type &&proxy = type(::boost::forward(args)...);
+      typedef container_detail::advanced_insert_aux_emplace type;
+      type &&proxy = type(this->alloc(), ::boost::forward(args)...);
       priv_range_insert(position.get_ptr(), 1, proxy);
       return iterator(this->members_.m_start + pos_n);
    }
 
    #else
 
-   void emplace_back()
-   {
-      T* back_pos = containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size;
-      if (this->members_.m_size < this->members_.m_capacity){
-         //There is more memory, just construct a new object at the end
-         new((void*)(back_pos))value_type();
-         ++this->members_.m_size;
-      }
-      else{
-         containers_detail::advanced_insert_aux_emplace proxy;
-         priv_range_insert(back_pos, 1, proxy);
-      }
-   }
-
-   iterator emplace(const_iterator position)
-   {
-      size_type pos_n = position - cbegin();
-      containers_detail::advanced_insert_aux_emplace proxy;
-      priv_range_insert(containers_detail::get_pointer(position.get_ptr()), 1, proxy);
-      return iterator(this->members_.m_start + pos_n);
-   }
-
    #define BOOST_PP_LOCAL_MACRO(n)                                                              \
-   template                                                   \
-   void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))                       \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)       \
+   void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                       \
    {                                                                                            \
-      T* back_pos = containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size;        \
+      T* back_pos = container_detail::to_raw_pointer                                              \
+         (this->members_.m_start) + this->members_.m_size;                                      \
       if (this->members_.m_size < this->members_.m_capacity){                                   \
-         new((void*)(back_pos))value_type                                                       \
-            (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));                           \
+         allocator_traits_type::construct (this->alloc()                                        \
+            , back_pos BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );       \
          ++this->members_.m_size;                                                               \
       }                                                                                         \
       else{                                                                                     \
-         containers_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)     \
-                                                    \
-               proxy(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));                   \
+         container_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)     \
+             proxy                                   \
+            (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));    \
          priv_range_insert(back_pos, 1, proxy);                                                 \
       }                                                                                         \
    }                                                                                            \
                                                                                                 \
-   template                                                   \
-   iterator emplace(const_iterator pos, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _))    \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)       \
+   iterator emplace(const_iterator pos                                                          \
+                    BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))               \
    {                                                                                            \
       size_type pos_n = pos - cbegin();                                                         \
-      containers_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)        \
-                                                    \
-            proxy(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));                      \
-      priv_range_insert(containers_detail::get_pointer(pos.get_ptr()), 1, proxy);               \
+         container_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)     \
+             proxy                                   \
+            (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));    \
+      priv_range_insert(container_detail::to_raw_pointer(pos.get_ptr()), 1, proxy);               \
       return iterator(this->members_.m_start + pos_n);                                          \
    }                                                                                            \
    //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
-   #endif   //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
   
    //! Effects: Swaps the contents of *this and x.
    //!   If this->allocator_type() != x.allocator_type()
@@ -1061,15 +1088,11 @@ class vector : private containers_detail::vector_alloc_holder
    //! Complexity: Constant.
    void swap(vector& x)
    {
-      allocator_type &this_al = this->alloc(), &other_al = x.alloc();
       //Just swap internals
-      containers_detail::do_swap(this->members_.m_start, x.members_.m_start);
-      containers_detail::do_swap(this->members_.m_size, x.members_.m_size);
-      containers_detail::do_swap(this->members_.m_capacity, x.members_.m_capacity);
-
-      if (this_al != other_al){
-         containers_detail::do_swap(this_al, other_al);
-      }
+      this->swap_members(x);
+      //And now the allocator
+      container_detail::bool_ flag;
+      container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
    }
 
    #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -1077,7 +1100,7 @@ class vector : private containers_detail::vector_alloc_holder
    //!
    //! Effects: Insert a copy of x before position.
    //!
-   //! Throws: If memory allocation throws or x's copy constructor throws.
+   //! Throws: If memory allocation throws or T's copy/move constructor/assignment throws.
    //!
    //! Complexity: If position is end(), amortized constant time
    //!   Linear time otherwise.
@@ -1101,15 +1124,15 @@ class vector : private containers_detail::vector_alloc_holder
    //! Effects: Insert a copy of the [first, last) range before pos.
    //!
    //! Throws: If memory allocation throws, T's constructor from a
-   //!   dereferenced InpIt throws or T's copy constructor throws.
+   //!   dereferenced InpIt throws or T's copy/move constructor/assignment throws.
    //!
    //! Complexity: Linear to std::distance [first, last).
    template 
    void insert(const_iterator pos, InIt first, InIt last)
    {
       //Dispatch depending on integer/iterator
-      const bool aux_boolean = containers_detail::is_convertible::value;
-      typedef containers_detail::bool_ Result;
+      const bool aux_boolean = container_detail::is_convertible::value;
+      typedef container_detail::bool_ Result;
       this->priv_insert_dispatch(pos, first, last, Result());
    }
 
@@ -1132,7 +1155,7 @@ class vector : private containers_detail::vector_alloc_holder
    {
       //Destroy last element
       --this->members_.m_size;
-      this->destroy(containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size);
+      this->destroy(container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size);
    }
 
    //! Effects: Erases the element at position pos.
@@ -1143,12 +1166,12 @@ class vector : private containers_detail::vector_alloc_holder
    //!   last element. Constant if pos is the last element.
    iterator erase(const_iterator position) 
    {
-      T *pos = containers_detail::get_pointer(position.get_ptr());
-      T *beg = containers_detail::get_pointer(this->members_.m_start);
+      T *pos = container_detail::to_raw_pointer(position.get_ptr());
+      T *beg = container_detail::to_raw_pointer(this->members_.m_start);
       ::boost::move(pos + 1, beg + this->members_.m_size, pos);
       --this->members_.m_size;
       //Destroy last element
-      base_t::destroy(containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size);
+      base_t::destroy(container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size);
       return iterator(position.get_ptr());
    }
 
@@ -1161,11 +1184,11 @@ class vector : private containers_detail::vector_alloc_holder
    iterator erase(const_iterator first, const_iterator last) 
    {
       if (first != last){   // worth doing, copy down over hole
-         T* end_pos = containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size;
-         T* ptr = containers_detail::get_pointer(boost::move
-            (containers_detail::get_pointer(last.get_ptr())
+         T* end_pos = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
+         T* ptr = container_detail::to_raw_pointer(boost::move
+            (container_detail::to_raw_pointer(last.get_ptr())
             ,end_pos
-            ,containers_detail::get_pointer(first.get_ptr())
+            ,container_detail::to_raw_pointer(first.get_ptr())
             ));
          size_type destroyed = (end_pos - ptr);
          this->destroy_n(ptr, destroyed);
@@ -1208,7 +1231,7 @@ class vector : private containers_detail::vector_alloc_holder
       else{
          size_type n = new_size - this->size();
          this->reserve(new_size);
-         containers_detail::default_construct_aux_proxy proxy(n);
+         container_detail::default_construct_aux_proxy proxy(this->alloc(), n);
          priv_range_insert(this->cend().get_ptr(), n, proxy);
       }
    }
@@ -1218,7 +1241,7 @@ class vector : private containers_detail::vector_alloc_holder
    //! Throws: Nothing.
    //!
    //! Complexity: Linear to the number of elements in the vector.
-   void clear() 
+   void clear() BOOST_CONTAINER_NOEXCEPT
    {  this->prot_destroy_all();  }
 
    //! Effects: Tries to deallocate the excess of memory created
@@ -1256,7 +1279,10 @@ class vector : private containers_detail::vector_alloc_holder
    {
       if (this->members_.m_size < this->members_.m_capacity){
          //There is more memory, just construct a new object at the end
-         new((void*)containers_detail::get_pointer(this->members_.m_start + this->members_.m_size))value_type(::boost::forward(x));
+         allocator_traits_type::construct
+            ( this->alloc()
+            , container_detail::to_raw_pointer(this->members_.m_start + this->members_.m_size)
+            , ::boost::forward(x) );
          ++this->members_.m_size;
       }
       else{
@@ -1264,7 +1290,10 @@ class vector : private containers_detail::vector_alloc_holder
       }
    }
 
-   void priv_shrink_to_fit(allocator_v1)
+   template
+   void priv_shrink_to_fit( AllocVersion
+                          , typename container_detail::enable_if_c<
+                              container_detail::is_same::value >::type * = 0)
    {
       if(this->members_.m_capacity){
          if(!size()){
@@ -1278,16 +1307,16 @@ class vector : private containers_detail::vector_alloc_holder
                   (allocate_new, this->size(), this->size(), real_cap, this->members_.m_start);
             if(real_cap < this->capacity()){
                //We will reuse insert code, so create a dummy input iterator
-               T *dummy_it(containers_detail::get_pointer(this->members_.m_start));
-               containers_detail::advanced_insert_aux_proxy, T*>
-                  proxy(::boost::make_move_iterator(dummy_it), ::boost::make_move_iterator(dummy_it));
-               #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+               T *dummy_it(container_detail::to_raw_pointer(this->members_.m_start));
+               container_detail::advanced_insert_aux_proxy, T*>
+                  proxy(this->alloc(), ::boost::make_move_iterator(dummy_it), ::boost::make_move_iterator(dummy_it));
+               #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
                ++this->num_alloc;
                #endif
                this->priv_range_insert_new_allocation
-                  ( containers_detail::get_pointer(ret.first)
+                  ( container_detail::to_raw_pointer(ret.first)
                   , real_cap
-                  , containers_detail::get_pointer(this->members_.m_start)
+                  , container_detail::to_raw_pointer(this->members_.m_start)
                   , 0
                   , proxy);
             }
@@ -1298,7 +1327,10 @@ class vector : private containers_detail::vector_alloc_holder
       }
    }
 
-   void priv_shrink_to_fit(allocator_v2)
+   template
+   void priv_shrink_to_fit(AllocVersion
+                          , typename container_detail::enable_if_c<
+                              container_detail::is_same::value >::type * = 0)
    {
       if(this->members_.m_capacity){
          if(!size()){
@@ -1311,7 +1343,7 @@ class vector : private containers_detail::vector_alloc_holder
                , this->capacity(), this->size()
                , received_size,   this->members_.m_start).first){
                this->members_.m_capacity = received_size;
-               #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+               #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
                ++this->num_shrink;
                #endif
             }
@@ -1324,7 +1356,7 @@ class vector : private containers_detail::vector_alloc_holder
    {
       if(first != last){        
          const size_type n = std::distance(first, last);
-         containers_detail::advanced_insert_aux_proxy proxy(first, last);
+         container_detail::advanced_insert_aux_proxy proxy(this->alloc(), first, last);
          priv_range_insert(pos.get_ptr(), n, proxy);
       }
    }
@@ -1366,33 +1398,33 @@ class vector : private containers_detail::vector_alloc_holder
       
       //If we had room or we have expanded forward
       if (same_buffer_start){
-         #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+         #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
          ++this->num_expand_fwd;
          #endif
          this->priv_range_insert_expand_forward
-            (containers_detail::get_pointer(pos), n, interf);
+            (container_detail::to_raw_pointer(pos), n, interf);
       }
       //Backwards (and possibly forward) expansion
       else if(ret.second){
-         #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+         #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
          ++this->num_expand_bwd;
          #endif
          this->priv_range_insert_expand_backwards
-            ( containers_detail::get_pointer(ret.first)
+            ( container_detail::to_raw_pointer(ret.first)
             , real_cap
-            , containers_detail::get_pointer(pos)
+            , container_detail::to_raw_pointer(pos)
             , n
             , interf);
       }
       //New buffer
       else{
-         #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+         #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
          ++this->num_alloc;
          #endif
          this->priv_range_insert_new_allocation
-            ( containers_detail::get_pointer(ret.first)
+            ( container_detail::to_raw_pointer(ret.first)
             , real_cap
-            , containers_detail::get_pointer(pos)
+            , container_detail::to_raw_pointer(pos)
             , n
             , interf);
       }
@@ -1403,18 +1435,19 @@ class vector : private containers_detail::vector_alloc_holder
       //n can't be 0, because there is nothing to do in that case
       if(!n) return;
       //There is enough memory
-      T* old_finish = containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size;
+      T* old_finish = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
       const size_type elems_after = old_finish - pos;
 
-      if (elems_after > n){
+      if (elems_after >= n){
          //New elements can be just copied.
          //Move to uninitialized memory last objects
-         ::boost::uninitialized_move(old_finish - n, old_finish, old_finish);
+         ::boost::container::uninitialized_move_alloc
+            (this->alloc(), old_finish - n, old_finish, old_finish);
          this->members_.m_size += n;
          //Copy previous to last objects to the initialized end
          boost::move_backward(pos, old_finish - n, old_finish);
          //Insert new objects in the pos
-         interf.copy_all_to(pos);
+         interf.copy_remaining_to(pos);
       }
       else {
          //The new elements don't fit in the [pos, end()) range. Copy
@@ -1422,11 +1455,11 @@ class vector : private containers_detail::vector_alloc_holder
          interf.uninitialized_copy_some_and_update(old_finish, elems_after, false);
          this->members_.m_size += n - elems_after;
          //Copy old [pos, end()) elements to the uninitialized memory
-         ::boost::uninitialized_move
-            ( pos, old_finish, containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size);
+         ::boost::container::uninitialized_move_alloc
+            (this->alloc(), pos, old_finish, container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size);
          this->members_.m_size += elems_after;
          //Copy first new elements in pos
-         interf.copy_all_to(pos);
+         interf.copy_remaining_to(pos);
       }
    }
 
@@ -1438,25 +1471,25 @@ class vector : private containers_detail::vector_alloc_holder
       T *old_finish;
       //Anti-exception rollbacks
       typename value_traits::ArrayDeallocator scoped_alloc(new_start, this->alloc(), new_cap);
-      typename value_traits::ArrayDestructor constructed_values_destroyer(new_start, 0u);
+      typename value_traits::ArrayDestructor constructed_values_destroyer(new_start, this->alloc(), 0u);
 
       //Initialize with [begin(), pos) old buffer 
       //the start of the new buffer
-      T *old_buffer = containers_detail::get_pointer(this->members_.m_start);
+      T *old_buffer = container_detail::to_raw_pointer(this->members_.m_start);
       if(old_buffer){
-         new_finish = ::boost::uninitialized_move
-            (containers_detail::get_pointer(this->members_.m_start), pos, old_finish = new_finish);
+         new_finish = ::boost::container::uninitialized_move_alloc
+            (this->alloc(), container_detail::to_raw_pointer(this->members_.m_start), pos, old_finish = new_finish);
          constructed_values_destroyer.increment_size(new_finish - old_finish);
       }
       //Initialize new objects, starting from previous point
-      interf.uninitialized_copy_all_to(old_finish = new_finish);
+      interf.uninitialized_copy_remaining_to(old_finish = new_finish);
       new_finish += n;
       constructed_values_destroyer.increment_size(new_finish - old_finish);
       //Initialize from the rest of the old buffer, 
       //starting from previous point
       if(old_buffer){
-         new_finish = ::boost::uninitialized_move
-            (pos, old_buffer + this->members_.m_size, new_finish);
+         new_finish = ::boost::container::uninitialized_move_alloc
+            (this->alloc(), pos, old_buffer + this->members_.m_size, new_finish);
          //Destroy and deallocate old elements
          //If there is allocated memory, destroy and deallocate
          if(!value_traits::trivial_dctr_after_move)
@@ -1477,7 +1510,7 @@ class vector : private containers_detail::vector_alloc_holder
    {
       //n can be zero to just expand capacity
       //Backup old data
-      T* old_start  = containers_detail::get_pointer(this->members_.m_start);
+      T* old_start  = container_detail::to_raw_pointer(this->members_.m_start);
       T* old_finish = old_start + this->members_.m_size;
       size_type old_size = this->members_.m_size;
 
@@ -1492,13 +1525,13 @@ class vector : private containers_detail::vector_alloc_holder
 
       //If anything goes wrong, this object will destroy
       //all the old objects to fulfill previous vector state
-      typename value_traits::OldArrayDestructor old_values_destroyer(old_start, old_size);
+      typename value_traits::OldArrayDestructor old_values_destroyer(old_start, this->alloc(), old_size);
       //Check if s_before is big enough to hold the beginning of old data + new data
       if(difference_type(s_before) >= difference_type(elemsbefore + n)){
          //Copy first old values before pos, after that the new objects
-         ::boost::uninitialized_move(old_start, pos, new_start);
+         ::boost::container::uninitialized_move_alloc(this->alloc(), old_start, pos, new_start);
          this->members_.m_size = elemsbefore;
-         interf.uninitialized_copy_all_to(new_start + elemsbefore);
+         interf.uninitialized_copy_remaining_to(new_start + elemsbefore);
          this->members_.m_size += n;
          //Check if s_before is so big that even copying the old data + new data
          //there is a gap between the new data and the old data
@@ -1514,8 +1547,8 @@ class vector : private containers_detail::vector_alloc_holder
             //|___________|__________|_________|________________________|
             //
             //Now initialize the rest of memory with the last old values
-            ::boost::uninitialized_move
-               (pos, old_finish, new_start + elemsbefore + n);
+            ::boost::container::uninitialized_move_alloc
+               (this->alloc(), pos, old_finish, new_start + elemsbefore + n);
             //All new elements correctly constructed, avoid new element destruction
             this->members_.m_size = old_size + n;
             //Old values destroyed automatically with "old_values_destroyer"
@@ -1541,7 +1574,8 @@ class vector : private containers_detail::vector_alloc_holder
             size_type raw_gap = s_before - (elemsbefore + n);
             //Now initialize the rest of s_before memory with the
             //first of elements after new values
-            ::boost::uninitialized_move(pos, pos + raw_gap, new_start + elemsbefore + n);
+            ::boost::container::uninitialized_move_alloc
+               (this->alloc(), pos, pos + raw_gap, new_start + elemsbefore + n);
             //Update size since we have a contiguous buffer
             this->members_.m_size = old_size + s_before;
             //All new elements correctly constructed, avoid old element destruction
@@ -1606,7 +1640,8 @@ class vector : private containers_detail::vector_alloc_holder
             //
             //Copy the first part of old_begin to raw_mem
             T *start_n = old_start + difference_type(s_before); 
-            ::boost::uninitialized_move(old_start, start_n, new_start);
+            ::boost::container::uninitialized_move_alloc
+               (this->alloc(), old_start, start_n, new_start);
             //The buffer is all constructed until old_end,
             //release destroyer and update size
             old_values_destroyer.release();
@@ -1619,7 +1654,7 @@ class vector : private containers_detail::vector_alloc_holder
             }
             else{
                //Now copy the all the new elements
-               interf.copy_all_to(next);
+               interf.copy_remaining_to(next);
                T* move_start = next + n;
                //Now displace old_end elements
                T* move_end   = ::boost::move(pos, old_finish, move_start);
@@ -1658,7 +1693,8 @@ class vector : private containers_detail::vector_alloc_holder
             //|___________|_____|_________|__________________________|
             //
             //First copy whole old_begin and part of new to raw_mem
-            ::boost::uninitialized_move(old_start, pos, new_start);
+            ::boost::container::uninitialized_move_alloc
+               (this->alloc(), old_start, pos, new_start);
             this->members_.m_size = elemsbefore;
 
             const size_type mid_n = difference_type(s_before) - elemsbefore;
@@ -1674,7 +1710,7 @@ class vector : private containers_detail::vector_alloc_holder
             }
             else{
                //Copy all new elements
-               interf.copy_all_to(old_start);
+               interf.copy_remaining_to(old_start);
                T* move_start = old_start + (n-mid_n);
                //Displace old_end
                T* move_end = ::boost::move(pos, old_finish, move_start);
@@ -1728,13 +1764,14 @@ class vector : private containers_detail::vector_alloc_holder
                //
                //First copy the part of old_end raw_mem
                T* finish_n = old_finish - difference_type(n_after);
-               ::boost::uninitialized_move(finish_n, old_finish, old_finish);
+               ::boost::container::uninitialized_move_alloc
+                  (this->alloc(), finish_n, old_finish, old_finish);
                this->members_.m_size += n_after;
                //Displace the rest of old_end to the new position
                boost::move_backward(pos, finish_n, old_finish);
                //Now overwrite with new_end
                //The new_end part is [first + (n - n_after), last)
-               interf.copy_all_to(pos);
+               interf.copy_remaining_to(pos);
             }
             else {
                //The raw_mem from end will divide new_end part
@@ -1754,10 +1791,11 @@ class vector : private containers_detail::vector_alloc_holder
                //The new_end part is [first + (n - n_after), last)
                interf.uninitialized_copy_some_and_update(old_finish, elemsafter, false);
                this->members_.m_size += mid_last_dist;
-               ::boost::uninitialized_move(pos, old_finish, old_finish + mid_last_dist);
+               ::boost::container::uninitialized_move_alloc
+                  (this->alloc(), pos, old_finish, old_finish + mid_last_dist);
                this->members_.m_size += n_after - mid_last_dist;
                //Now copy the part of new_end over constructed elements
-               interf.copy_all_to(pos);
+               interf.copy_remaining_to(pos);
             }
          }
       }
@@ -1812,7 +1850,7 @@ class vector : private containers_detail::vector_alloc_holder
       }
       
       if(same_buffer_start){
-         T *start = containers_detail::get_pointer(this->members_.m_start);
+         T *start = container_detail::to_raw_pointer(this->members_.m_start);
          if (this->size() >= n){
             //There is memory, but there are more old elements than new ones
             //Overwrite old elements with new ones
@@ -1829,19 +1867,17 @@ class vector : private containers_detail::vector_alloc_holder
             // iG T *end = std::copy(first, mid, start);
             T *end = std::copy(first, mid, start);
             //Initialize the remaining new elements in the uninitialized memory
-            // iG std::uninitialized_copy(mid, last, end);
-            ::boost::uninitialized_copy_or_move(mid, last, end);
+            ::boost::container::uninitialized_copy_or_move_alloc(this->alloc(), mid, last, end);
             this->members_.m_size = n;
          }
       }
       else if(!ret.second){
          typename value_traits::ArrayDeallocator scoped_alloc(ret.first, this->alloc(), real_cap);
-         // iG std::uninitialized_copy(first, last, containers_detail::get_pointer(ret.first));
-         ::boost::uninitialized_copy_or_move(first, last, containers_detail::get_pointer(ret.first));
+         ::boost::container::uninitialized_copy_or_move_alloc(this->alloc(), first, last, container_detail::to_raw_pointer(ret.first));
          scoped_alloc.release();
          //Destroy and deallocate old buffer
          if(this->members_.m_start != 0){
-            this->destroy_n(containers_detail::get_pointer(this->members_.m_start), this->members_.m_size); 
+            this->destroy_n(container_detail::to_raw_pointer(this->members_.m_start), this->members_.m_size); 
             this->alloc().deallocate(this->members_.m_start, this->members_.m_capacity);
          }
          this->members_.m_start     = ret.first;
@@ -1851,9 +1887,9 @@ class vector : private containers_detail::vector_alloc_holder
       else{
          //Backwards expansion
          //If anything goes wrong, this object will destroy old objects
-         T *old_start         = containers_detail::get_pointer(this->members_.m_start);
+         T *old_start         = container_detail::to_raw_pointer(this->members_.m_start);
          size_type old_size   = this->members_.m_size;
-         typename value_traits::OldArrayDestructor old_values_destroyer(old_start, old_size);
+         typename value_traits::OldArrayDestructor old_values_destroyer(old_start, this->alloc(), old_size);
          //If something goes wrong size will be 0
          //but holding the whole buffer
          this->members_.m_size  = 0;
@@ -1861,13 +1897,13 @@ class vector : private containers_detail::vector_alloc_holder
          this->members_.m_capacity = real_cap;
          
          //Backup old buffer data
-         size_type old_offset    = old_start - containers_detail::get_pointer(ret.first);
-         size_type first_count   = containers_detail::min_value(n, old_offset);
+         size_type old_offset    = old_start - container_detail::to_raw_pointer(ret.first);
+         size_type first_count   = container_detail::min_value(n, old_offset);
 
          FwdIt mid = first;
          std::advance(mid, first_count);
-         // iG std::uninitialized_copy(first, mid, containers_detail::get_pointer(ret.first));
-         ::boost::uninitialized_copy_or_move(first, mid, containers_detail::get_pointer(ret.first));
+         ::boost::container::uninitialized_copy_or_move_alloc
+            (this->alloc(), first, mid, container_detail::to_raw_pointer(ret.first));
 
          if(old_offset > n){
             //All old elements will be destroyed by "old_values_destroyer" 
@@ -1880,7 +1916,7 @@ class vector : private containers_detail::vector_alloc_holder
             this->members_.m_start  = ret.first;
             this->members_.m_size   = first_count + old_size;
             //Now overwrite the old values
-            size_type second_count = containers_detail::min_value(old_size, n - first_count);
+            size_type second_count = container_detail::min_value(old_size, n - first_count);
             FwdIt mid2 = mid;
             std::advance(mid2, second_count);
             // iG std::copy(mid, mid2, old_start);
@@ -1904,11 +1940,11 @@ class vector : private containers_detail::vector_alloc_holder
    }
 
    template 
-   void priv_assign_dispatch(Integer n, Integer val, containers_detail::true_)
+   void priv_assign_dispatch(Integer n, Integer val, container_detail::true_)
    { this->assign((size_type) n, (value_type)val); }
 
    template 
-   void priv_assign_dispatch(InIt first, InIt last, containers_detail::false_)
+   void priv_assign_dispatch(InIt first, InIt last, container_detail::false_)
    { 
       //Dispatch depending on integer/iterator
       typedef typename std::iterator_traits::iterator_category ItCat;
@@ -1916,12 +1952,12 @@ class vector : private containers_detail::vector_alloc_holder
    }
 
    template 
-   void priv_insert_dispatch(const_iterator pos, Integer n, Integer val, containers_detail::true_) 
+   void priv_insert_dispatch(const_iterator pos, Integer n, Integer val, container_detail::true_) 
    {  this->insert(pos, (size_type)n, (T)val);  }
 
    template 
    void priv_insert_dispatch(const_iterator pos, InIt first, 
-                             InIt last,      containers_detail::false_)
+                             InIt last,      container_detail::false_)
    {
       //Dispatch depending on integer/iterator
       typedef typename std::iterator_traits::iterator_category ItCat;
@@ -1935,7 +1971,7 @@ class vector : private containers_detail::vector_alloc_holder
          throw std::out_of_range("vector::at");
    }
 
-   #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+   #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
    public:
    unsigned int num_expand_fwd;
    unsigned int num_expand_bwd;
@@ -1998,5 +2034,5 @@ struct has_trivial_destructor_after_move >
 
 #include 
 
-#endif //   #ifndef  BOOST_CONTAINERS_CONTAINERS_VECTOR_HPP
+#endif //   #ifndef  BOOST_CONTAINER_CONTAINER_VECTOR_HPP