From c5bdec851e0a7b9444831ca90652064f5c1310ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Thu, 22 Mar 2012 18:46:55 +0000 Subject: [PATCH] Experimental scoped_allocator support [SVN r77480] --- .../container/allocator/allocator_traits.hpp | 382 ---------- .../boost/container/allocator/memory_util.hpp | 77 --- .../container/allocator/scoped_allocator.hpp | 651 ------------------ include/boost/container/container_fwd.hpp | 2 +- include/boost/container/deque.hpp | 44 +- .../detail/adaptive_node_pool_impl.hpp | 2 +- .../container/detail/advanced_insert_int.hpp | 129 ++-- include/boost/container/detail/algorithms.hpp | 2 +- .../container/detail/allocation_type.hpp | 2 +- .../boost/container/detail/config_begin.hpp | 3 +- include/boost/container/detail/config_end.hpp | 2 +- include/boost/container/detail/destroyers.hpp | 35 +- include/boost/container/detail/flat_tree.hpp | 22 +- .../container/detail/function_detector.hpp | 2 +- include/boost/container/detail/iterators.hpp | 14 +- .../boost/container/detail/math_functions.hpp | 2 +- include/boost/container/detail/mpl.hpp | 2 +- .../detail/multiallocation_chain.hpp | 2 +- .../container/detail/node_alloc_holder.hpp | 57 +- .../boost/container/detail/node_pool_impl.hpp | 2 +- include/boost/container/detail/pair.hpp | 107 +-- .../boost/container/detail/pool_common.hpp | 2 +- .../boost/container/detail/preprocessor.hpp | 12 +- include/boost/container/detail/stored_ref.hpp | 2 +- .../container/detail/transform_iterator.hpp | 2 +- include/boost/container/detail/tree.hpp | 92 ++- .../boost/container/detail/type_traits.hpp | 9 +- include/boost/container/detail/utilities.hpp | 15 +- include/boost/container/detail/value_init.hpp | 2 +- .../detail/variadic_templates_tools.hpp | 2 +- .../boost/container/detail/version_type.hpp | 2 +- include/boost/container/detail/workaround.hpp | 7 +- include/boost/container/flat_map.hpp | 50 +- include/boost/container/flat_set.hpp | 88 ++- include/boost/container/list.hpp | 59 +- include/boost/container/map.hpp | 72 +- include/boost/container/set.hpp | 40 +- include/boost/container/slist.hpp | 60 +- include/boost/container/stable_vector.hpp | 170 ++--- include/boost/container/string.hpp | 34 +- include/boost/container/vector.hpp | 120 +++- 41 files changed, 888 insertions(+), 1493 deletions(-) delete mode 100644 include/boost/container/allocator/allocator_traits.hpp delete mode 100644 include/boost/container/allocator/memory_util.hpp delete mode 100644 include/boost/container/allocator/scoped_allocator.hpp diff --git a/include/boost/container/allocator/allocator_traits.hpp b/include/boost/container/allocator/allocator_traits.hpp deleted file mode 100644 index 0192161..0000000 --- a/include/boost/container/allocator/allocator_traits.hpp +++ /dev/null @@ -1,382 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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 -#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_EVAL_DEFAULT(boost::container::container_detail::, Alloc, 
-         const_pointer, typename boost::intrusive::pointer_traits::template
-            rebind_pointer)
-               const_pointer;
-      //reference
-      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
-         reference, typename container_detail::unvoid::type&)
-            reference;
-      //const_reference
-      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, 
-         const_reference, const typename container_detail::unvoid::type&)
-               const_reference;
-      //void_pointer
-      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc, 
-         void_pointer, typename boost::intrusive::pointer_traits::template
-            rebind_pointer)
-               void_pointer;
-      //const_void_pointer
-      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc,
-         const_void_pointer, typename boost::intrusive::pointer_traits::template
-            rebind_pointer)
-               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
deleted file mode 100644
index ea4bc05..0000000
--- a/include/boost/container/allocator/memory_util.hpp
+++ /dev/null
@@ -1,77 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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
deleted file mode 100644
index 03e12d1..0000000
--- a/include/boost/container/allocator/scoped_allocator.hpp
+++ /dev/null
@@ -1,651 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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 da325e4..affea83 100644
--- a/include/boost/container/container_fwd.hpp
+++ b/include/boost/container/container_fwd.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
diff --git a/include/boost/container/deque.hpp b/include/boost/container/deque.hpp
index 9ee0ee1..92bf0d4 100644
--- a/include/boost/container/deque.hpp
+++ b/include/boost/container/deque.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
@@ -44,7 +44,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -896,6 +896,46 @@ class deque : protected deque_base
       :  Base(boost::move(static_cast(x)))
    {  this->swap_members(x);   }
 
+   //! Effects: Copy constructs a vector using the specified allocator.
+   //!
+   //! Postcondition: x == *this.
+   //! 
+   //! Throws: If allocation
+   //!   throws or T's copy constructor throws.
+   //! 
+   //! Complexity: Linear to the elements x contains.
+   deque(const deque& x, const allocator_type &a)
+      :  Base(a)
+   {
+      if(x.size()){
+         this->priv_initialize_map(x.size());
+         boost::container::uninitialized_copy_alloc
+            (this->alloc(), x.begin(), x.end(), this->members_.m_start);
+      }
+   }
+
+   //! Effects: Move constructor using the specified allocator.
+   //!                 Moves mx's resources to *this if a == allocator_type().
+   //!                 Otherwise copies values from x to *this.
+   //!
+   //! Throws: If allocation or T's copy constructor throws.
+   //! 
+   //! Complexity: Constant if a == mx.get_allocator(), linear otherwise.
+   deque(BOOST_RV_REF(deque) mx, const allocator_type &a) 
+      :  Base(a)
+   {
+      if(mx.alloc() == a){
+         this->swap_members(mx);
+      }
+      else{
+         if(mx.size()){
+            this->priv_initialize_map(mx.size());
+            boost::container::uninitialized_copy_alloc
+               (this->alloc(), mx.begin(), mx.end(), this->members_.m_start);
+         }
+      }
+   }
+
    //! Effects: Constructs a deque that will use a copy of allocator a
    //!   and inserts a copy of the range [first, last) in the deque.
    //!
diff --git a/include/boost/container/detail/adaptive_node_pool_impl.hpp b/include/boost/container/detail/adaptive_node_pool_impl.hpp
index 3649579..92b6133 100644
--- a/include/boost/container/detail/adaptive_node_pool_impl.hpp
+++ b/include/boost/container/detail/adaptive_node_pool_impl.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
diff --git a/include/boost/container/detail/advanced_insert_int.hpp b/include/boost/container/detail/advanced_insert_int.hpp
index 58199c7..978a819 100644
--- a/include/boost/container/detail/advanced_insert_int.hpp
+++ b/include/boost/container/detail/advanced_insert_int.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-2012. 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)
 //
@@ -17,7 +17,9 @@
 
 #include "config_begin.hpp"
 #include 
-#include 
+#include 
+#include 
+#include 
 #include 
 #include   //std::iterator_traits
 #include 
@@ -41,7 +43,6 @@ template
 struct advanced_insert_aux_proxy
    :  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;
@@ -54,36 +55,36 @@ struct advanced_insert_aux_proxy
    {}
 
    virtual void copy_remaining_to(Iterator p)
-   {  ::boost::copy_or_move(first_, last_, p);  }
+   {  ::boost::copy_or_move(this->first_, this->last_, p);  }
 
    virtual void uninitialized_copy_remaining_to(Iterator p)
-   {  ::boost::container::uninitialized_copy_or_move_alloc(a_, first_, last_, p);  }
+   {  ::boost::container::uninitialized_copy_or_move_alloc(this->a_, this->first_, this->last_, p);  }
 
    virtual void uninitialized_copy_some_and_update(Iterator pos, difference_type division_count, bool first_n)
    {
-      FwdIt mid = first_;
+      FwdIt mid = this->first_;
       std::advance(mid, division_count);
       if(first_n){
-         ::boost::container::uninitialized_copy_or_move_alloc(a_, first_, mid, pos);
-         first_ = mid;
+         ::boost::container::uninitialized_copy_or_move_alloc(this->a_, this->first_, mid, pos);
+         this->first_ = mid;
       }
       else{
-         ::boost::container::uninitialized_copy_or_move_alloc(a_, mid, last_, pos);
-         last_ = mid;
+         ::boost::container::uninitialized_copy_or_move_alloc(this->a_, mid, this->last_, pos);
+         this->last_ = mid;
       }
    }
 
    virtual void copy_some_and_update(Iterator pos, difference_type division_count, bool first_n)
    {
-      FwdIt mid = first_;
+      FwdIt mid = this->first_;
       std::advance(mid, division_count);
       if(first_n){
-         ::boost::copy_or_move(first_, mid, pos);
-         first_ = mid;
+         ::boost::copy_or_move(this->first_, mid, pos);
+         this->first_ = mid;
       }
       else{
-         ::boost::copy_or_move(mid, last_, pos);
-         last_ = mid;
+         ::boost::copy_or_move(mid, this->last_, pos);
+         this->last_ = mid;
       }
    }
    A &a_;
@@ -95,7 +96,7 @@ template
 struct default_construct_aux_proxy
    :  public advanced_insert_aux_int
 {
-   typedef boost::container::allocator_traits alloc_traits;
+   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;
@@ -109,11 +110,11 @@ struct default_construct_aux_proxy
 
    virtual void copy_remaining_to(Iterator)
    {  //This should never be called with any count
-      BOOST_ASSERT(count_ == 0);
+      BOOST_ASSERT(this->count_ == 0);
    }
 
    virtual void uninitialized_copy_remaining_to(Iterator p)
-   {  this->priv_uninitialized_copy(p, count_); }
+   {  this->priv_uninitialized_copy(p, this->count_); }
 
    virtual void uninitialized_copy_some_and_update(Iterator pos, difference_type division_count, bool first_n)
    {
@@ -122,22 +123,22 @@ struct default_construct_aux_proxy
          new_count = division_count;
       }
       else{
-         BOOST_ASSERT(difference_type(count_)>= division_count);
-         new_count = count_ - division_count;
+         BOOST_ASSERT(difference_type(this->count_)>= division_count);
+         new_count = this->count_ - division_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);
+      BOOST_ASSERT(this->count_ == 0);
       size_type new_count;
       if(first_n){
          new_count = division_count;
       }
       else{
-         BOOST_ASSERT(difference_type(count_)>= division_count);
-         new_count = count_ - division_count;
+         BOOST_ASSERT(difference_type(this->count_)>= division_count);
+         new_count = this->count_ - division_count;
       }
       //This function should never called with a count different to zero
       BOOST_ASSERT(new_count == 0);
@@ -147,21 +148,21 @@ struct default_construct_aux_proxy
    private:
    void priv_uninitialized_copy(Iterator p, const size_type n)
    {
-      BOOST_ASSERT(n <= count_);
+      BOOST_ASSERT(n <= this->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));
+            alloc_traits::construct(this->a_, container_detail::to_raw_pointer(&*p));
          }
       }
       catch(...){
          while(i--){
-            alloc_traits::destroy(a_, container_detail::to_raw_pointer(&*orig_p++));
+            alloc_traits::destroy(this->a_, container_detail::to_raw_pointer(&*orig_p++));
          }
          throw;
       }
-      count_ -= n;
+      this->count_ -= n;
    }
    A &a_;
    size_type count_;
@@ -223,13 +224,13 @@ struct advanced_insert_aux_non_movable_emplace
    {
       BOOST_ASSERT(division_count <=1);
       if((first_n && division_count == 1) || (!first_n && division_count == 0)){
-         if(!used_){
-            alloc_traits::construct( a_
+         if(!this->used_){
+            alloc_traits::construct( this->a_
                                    , container_detail::to_raw_pointer(&*p)
                                    , ::boost::container::container_detail::
-                                       stored_ref::forward(get(args_))...
+                                       stored_ref::forward(get(this->args_))...
                                    );
-            used_ = true;
+            this->used_ = true;
          }
       }
    }
@@ -237,13 +238,13 @@ struct advanced_insert_aux_non_movable_emplace
    template
    void priv_uninitialized_copy_remaining_to(const index_tuple&, Iterator p)
    {
-      if(!used_){
-         alloc_traits::construct( a_
+      if(!this->used_){
+         alloc_traits::construct( this->a_
                                 , container_detail::to_raw_pointer(&*p)
                                 , ::boost::container::container_detail::
-                                    stored_ref::forward(get(args_))...
+                                    stored_ref::forward(get(this->args_))...
                                 );
-         used_ = true;
+         this->used_ = true;
       }
    }
 
@@ -260,6 +261,7 @@ struct advanced_insert_aux_emplace
    :  public advanced_insert_aux_non_movable_emplace
 {
    typedef advanced_insert_aux_non_movable_emplace base_t;
+   typedef boost::container::allocator_traits alloc_traits;
    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;
@@ -283,8 +285,13 @@ struct advanced_insert_aux_emplace
    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_))...));
+         aligned_storage::value> v;
+         value_type *vp = static_cast(static_cast(&v));
+         alloc_traits::construct(this->a_, vp,
+            ::boost::container::container_detail::stored_ref::forward(get(this->args_))...);
+         scoped_destructor d(this->a_, vp);
+         *p = boost::move(*vp);
+         d.release();
          this->used_ = true;
       }
    }
@@ -295,8 +302,17 @@ struct advanced_insert_aux_emplace
       BOOST_ASSERT(division_count <=1);
       if((first_n && division_count == 1) || (!first_n && division_count == 0)){
          if(!this->used_){
-            *p = boost::move(value_type(
-               ::boost::container::container_detail::stored_ref::forward(get(this->args_))...));
+            aligned_storage::value> v;
+            value_type *vp = static_cast(static_cast(&v));
+            alloc_traits::construct(this->a_, vp,
+               ::boost::container::container_detail::stored_ref::forward(get(this->args_))...);
+            try {
+               *p = boost::move(*vp);
+            } catch (...) {
+               alloc_traits::destroy(this->a_, vp);
+               throw;
+            }
+            alloc_traits::destroy(this->a_, vp);
             this->used_ = true;
          }
       }
@@ -337,13 +353,13 @@ struct BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_non_movable_emplace, n), ar
                                                                                     \
    virtual void uninitialized_copy_remaining_to(Iterator p)                         \
    {                                                                                \
-      if(!used_){                                                                   \
+      if(!this->used_){                                                             \
          alloc_traits::construct                                                    \
-            ( a_                                                                    \
+            ( this->a_                                                              \
             , container_detail::to_raw_pointer(&*p)                                 \
             BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)         \
             );                                                                      \
-         used_ = true;                                                              \
+         this->used_ = true;                                                        \
       }                                                                             \
    }                                                                                \
                                                                                     \
@@ -352,13 +368,13 @@ struct BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_non_movable_emplace, n), ar
    {                                                                                \
       BOOST_ASSERT(division_count <=1);                                             \
       if((first_n && division_count == 1) || (!first_n && division_count == 0)){    \
-         if(!used_){                                                                \
+         if(!this->used_){                                                          \
             alloc_traits::construct                                                 \
-               ( a_                                                                 \
+               ( this->a_                                                           \
                , container_detail::to_raw_pointer(&*p)                              \
                BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)      \
                );                                                                   \
-            used_ = true;                                                           \
+            this->used_ = true;                                                     \
          }                                                                          \
       }                                                                             \
    }                                                                                \
@@ -382,6 +398,7 @@ struct BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)
           base_t;                 \
    typedef typename base_t::value_type       value_type;                            \
    typedef typename base_t::difference_type  difference_type;                       \
+   typedef boost::container::allocator_traits alloc_traits;                      \
                                                                                     \
    BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)                  \
       ( A &a BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _) )          \
@@ -391,10 +408,13 @@ struct BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)
    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);                                                       \
+         aligned_storage::value> v;    \
+         value_type *vp = static_cast(static_cast(&v));       \
+         alloc_traits::construct(this->a_, vp                                       \
+            BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _));       \
+         scoped_destructor d(this->a_, vp);                                      \
+         *p = boost::move(*vp);                                                     \
+         d.release();                                                               \
          this->used_ = true;                                                        \
       }                                                                             \
    }                                                                                \
@@ -405,10 +425,13 @@ struct BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)
       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);                                                    \
+            aligned_storage::value> v; \
+            value_type *vp = static_cast(static_cast(&v));    \
+            alloc_traits::construct(this->a_, vp                                    \
+               BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _));    \
+            scoped_destructor d(this->a_, vp);                                   \
+            *p = boost::move(*vp);                                                  \
+            d.release();                                                            \
             this->used_ = true;                                                     \
          }                                                                          \
       }                                                                             \
diff --git a/include/boost/container/detail/algorithms.hpp b/include/boost/container/detail/algorithms.hpp
index a2713f5..5735f4d 100644
--- a/include/boost/container/detail/algorithms.hpp
+++ b/include/boost/container/detail/algorithms.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
diff --git a/include/boost/container/detail/allocation_type.hpp b/include/boost/container/detail/allocation_type.hpp
index edad487..3988fda 100644
--- a/include/boost/container/detail/allocation_type.hpp
+++ b/include/boost/container/detail/allocation_type.hpp
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
diff --git a/include/boost/container/detail/config_begin.hpp b/include/boost/container/detail/config_begin.hpp
index bd44daa..83c2cfe 100644
--- a/include/boost/container/detail/config_begin.hpp
+++ b/include/boost/container/detail/config_begin.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
@@ -45,4 +45,5 @@
                                     //    with /GR-; unpredictable behavior may result
    #pragma warning (disable : 4673) //  throwing '' the following types will not be considered at the catch site
    #pragma warning (disable : 4671) //  the copy constructor is inaccessible
+   #pragma warning (disable : 4584) //  X is already a base-class of Y
 #endif   //BOOST_MSVC
diff --git a/include/boost/container/detail/config_end.hpp b/include/boost/container/detail/config_end.hpp
index b71fabc..3451371 100644
--- a/include/boost/container/detail/config_end.hpp
+++ b/include/boost/container/detail/config_end.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
diff --git a/include/boost/container/detail/destroyers.hpp b/include/boost/container/detail/destroyers.hpp
index 26ae089..55b811d 100644
--- a/include/boost/container/detail/destroyers.hpp
+++ b/include/boost/container/detail/destroyers.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
@@ -21,7 +21,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 namespace boost {
 namespace container { 
@@ -85,6 +85,9 @@ struct scoped_destructor_n
 
    void increment_size(size_type inc)
    {  m_n += inc;   }
+
+   void increment_size_backwards(size_type inc)
+   {  m_n += inc;   m_p -= inc;  }
    
    ~scoped_destructor_n()
    {
@@ -115,10 +118,38 @@ struct null_scoped_destructor_n
    void increment_size(size_type)
    {}
 
+   void increment_size_backwards(size_type)
+   {}
+
    void release()
    {}
 };
 
+template
+class scoped_destructor
+{
+   typedef boost::container::allocator_traits AllocTraits;
+   public:
+   typedef typename A::value_type value_type;
+   scoped_destructor(A &a, value_type *pv)
+      : pv_(pv), a_(a)
+   {}
+
+   ~scoped_destructor()
+   {
+      if(pv_){
+         AllocTraits::destroy(a_, pv_);
+      }
+   }
+
+   void release()
+   {  pv_ = 0; }
+
+   private:
+   value_type *pv_;
+   A &a_;
+};
+
 template 
 class allocator_destroyer
 {
diff --git a/include/boost/container/detail/flat_tree.hpp b/include/boost/container/detail/flat_tree.hpp
index 4443838..1cbe8da 100644
--- a/include/boost/container/detail/flat_tree.hpp
+++ b/include/boost/container/detail/flat_tree.hpp
@@ -1,6 +1,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
@@ -102,11 +102,19 @@ class flat_tree
       {}
 
       Data(const Data &d)
-         : value_compare(d), m_vect(d.m_vect)
+         : value_compare(static_cast(d)), m_vect(d.m_vect)
       {}
 
       Data(BOOST_RV_REF(Data) d)
-         : value_compare(boost::move(d)), m_vect(boost::move(d.m_vect))
+         : value_compare(boost::move(static_cast(d))), m_vect(boost::move(d.m_vect))
+      {}
+
+      Data(const Data &d, const A &a)
+         : value_compare(static_cast(d)), m_vect(d.m_vect, a)
+      {}
+
+      Data(BOOST_RV_REF(Data) d, const A &a)
+         : value_compare(boost::move(static_cast(d))), m_vect(boost::move(d.m_vect), a)
       {}
 
       Data(const Compare &comp) 
@@ -185,6 +193,14 @@ class flat_tree
       :  m_data(boost::move(x.m_data))
    { }
 
+   flat_tree(const flat_tree& x, const allocator_type &a) 
+      :  m_data(x.m_data, a)
+   { }
+
+   flat_tree(BOOST_RV_REF(flat_tree) x, const allocator_type &a)
+      :  m_data(boost::move(x.m_data), a)
+   { }
+
    template 
    flat_tree( ordered_range_t, InputIterator first, InputIterator last
             , const Compare& comp     = Compare()
diff --git a/include/boost/container/detail/function_detector.hpp b/include/boost/container/detail/function_detector.hpp
index c37c766..c30ed81 100644
--- a/include/boost/container/detail/function_detector.hpp
+++ b/include/boost/container/detail/function_detector.hpp
@@ -1,6 +1,6 @@
 /////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga  2009-2011.
+// (C) Copyright Ion Gaztanaga  2009-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 //    (See accompanying file LICENSE_1_0.txt or copy at
diff --git a/include/boost/container/detail/iterators.hpp b/include/boost/container/detail/iterators.hpp
index 899cbe4..53a3ef5 100644
--- a/include/boost/container/detail/iterators.hpp
+++ b/include/boost/container/detail/iterators.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 // (C) Copyright Gennaro Prota 2003 - 2004.
 //
 // Distributed under the Boost Software License, Version 1.0.
@@ -21,7 +21,7 @@
 #include "config_begin.hpp"
 #include 
 #include 
-#include 
+#include 
 
 #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 #include 
@@ -513,7 +513,7 @@ struct emplace_functor
    container_detail::tuple args_;
 };
 
-#else
+#else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
 #define BOOST_PP_LOCAL_MACRO(n)                                                        \
    BOOST_PP_EXPR_IF(n, template <)                                                     \
@@ -522,16 +522,16 @@ struct emplace_functor
    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_CONTAINER_PP_PARAM_LIST, _) )                       \
-      BOOST_PP_EXPR_IF(n, :) BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_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, _){}      \
                                                                                        \
       template                                                       \
       void operator()(A &a, T *ptr)                                                    \
       {                                                                                \
          allocator_traits::construct                                                \
-            (a, ptr BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _) );\
+            (a, ptr BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _) ); \
       }                                                                                \
-      BOOST_PP_REPEAT(n, BOOST_CONTAINER_PP_PARAM_DEFINE, _)                         \
+      BOOST_PP_REPEAT(n, BOOST_CONTAINER_PP_PARAM_DEFINE, _)                           \
    };                                                                                  \
    //!
 #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
diff --git a/include/boost/container/detail/math_functions.hpp b/include/boost/container/detail/math_functions.hpp
index 4613573..609e1d4 100644
--- a/include/boost/container/detail/math_functions.hpp
+++ b/include/boost/container/detail/math_functions.hpp
@@ -1,7 +1,7 @@
 //////////////////////////////////////////////////////////////////////////////
 //
 // (C) Copyright Stephen Cleary 2000.
-// (C) Copyright Ion Gaztanaga 2007-2011.
+// (C) Copyright Ion Gaztanaga 2007-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 //    (See accompanying file LICENSE_1_0.txt or copy at 
diff --git a/include/boost/container/detail/mpl.hpp b/include/boost/container/detail/mpl.hpp
index c2d0ce4..032110a 100644
--- a/include/boost/container/detail/mpl.hpp
+++ b/include/boost/container/detail/mpl.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
diff --git a/include/boost/container/detail/multiallocation_chain.hpp b/include/boost/container/detail/multiallocation_chain.hpp
index a67fd77..c995253 100644
--- a/include/boost/container/detail/multiallocation_chain.hpp
+++ b/include/boost/container/detail/multiallocation_chain.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
diff --git a/include/boost/container/detail/node_alloc_holder.hpp b/include/boost/container/detail/node_alloc_holder.hpp
index 9b0a0a5..022a54f 100644
--- a/include/boost/container/detail/node_alloc_holder.hpp
+++ b/include/boost/container/detail/node_alloc_holder.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
@@ -27,7 +27,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -36,6 +36,7 @@
 #endif
 
 #include 
+#include 
 
 
 namespace boost {
@@ -259,47 +260,21 @@ struct node_alloc_holder
 
    void deallocate_one(const NodePtr &p, allocator_v2)
    {  this->node_alloc().deallocate_one(p);   }
-/*
-   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 = container_detail::to_raw_pointer(ptr);
 
-      //Hook constructor does not throw
-      allocator_traits::construct(a, static_cast(nodeptr));
-
-      //Now construct pair members_holder
-      value_type *valueptr = &nodeptr->get_data();
-      allocator_traits::construct(a, &valueptr->first, boost::move(value.first));
-      BOOST_TRY{
-         allocator_traits::construct(a, &valueptr->second, boost::move(value.second));
-      }
-      BOOST_CATCH(...){
-         allocator_traits::destroy(a, &valueptr->first);
-         BOOST_RETHROW
-      }
-      BOOST_CATCH_END
-   }
-*/
    #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
-/*
-   template
-   static void construct(A &a, const NodePtr &ptr, Args &&...args)
-   {  
-   }
-*/
+
    template
    NodePtr create_node(Args &&...args)
    {
       NodePtr p = this->allocate_one();
       Deallocator node_deallocator(p, this->node_alloc());
       allocator_traits::construct
-         (this->node_alloc(), container_detail::to_raw_pointer(p), boost::forward(args)...);
+         ( this->node_alloc()
+         , container_detail::addressof(p->m_data), boost::forward(args)...);
       node_deallocator.release();
+      //This does not throw
+      typedef typename Node::hook_type hook_type;
+      ::new(static_cast(container_detail::to_raw_pointer(p))) hook_type;
       return (p);
    }
 
@@ -313,9 +288,11 @@ struct node_alloc_holder
       NodePtr p = this->allocate_one();                                                   \
       Deallocator node_deallocator(p, this->node_alloc());                                \
       allocator_traits::construct                                              \
-         (this->node_alloc(), container_detail::to_raw_pointer(p)                         \
+         (this->node_alloc(), container_detail::addressof(p->m_data)                      \
             BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));              \
       node_deallocator.release();                                                         \
+      typedef typename Node::hook_type hook_type;                                         \
+      ::new(static_cast(container_detail::to_raw_pointer(p))) hook_type;      \
       return (p);                                                                         \
    }                                                                                      \
    //!
@@ -329,8 +306,11 @@ struct node_alloc_holder
    {
       NodePtr p = this->allocate_one();
       Deallocator node_deallocator(p, this->node_alloc());
-      ::boost::container::construct_in_place(this->node_alloc(), container_detail::to_raw_pointer(p), it);
+      ::boost::container::construct_in_place(this->node_alloc(), container_detail::addressof(p->m_data), it);
       node_deallocator.release();
+      //This does not throw
+      typedef typename Node::hook_type hook_type;
+      ::new(static_cast(container_detail::to_raw_pointer(p))) hook_type;
       return (p);
    }
 
@@ -364,8 +344,11 @@ struct node_alloc_holder
                mem.pop_front();
                //This can throw
                constructed = 0;
-               boost::container::construct_in_place(this->node_alloc(), p, beg);
+               boost::container::construct_in_place(this->node_alloc(), container_detail::addressof(p->m_data), beg);
                ++constructed;
+               //This does not throw
+               typedef typename Node::hook_type hook_type;
+               ::new(static_cast(container_detail::to_raw_pointer(p))) hook_type;
                //This can throw in some containers (predicate might throw)
                inserter(*p);
             }
diff --git a/include/boost/container/detail/node_pool_impl.hpp b/include/boost/container/detail/node_pool_impl.hpp
index 9ee9e31..b7fb511 100644
--- a/include/boost/container/detail/node_pool_impl.hpp
+++ b/include/boost/container/detail/node_pool_impl.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
diff --git a/include/boost/container/detail/pair.hpp b/include/boost/container/detail/pair.hpp
index 1aeff91..3c3ae38 100644
--- a/include/boost/container/detail/pair.hpp
+++ b/include/boost/container/detail/pair.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
@@ -62,6 +62,33 @@ struct pair_nat;
 struct piecewise_construct_t { };
 static const piecewise_construct_t piecewise_construct = piecewise_construct_t();
 
+/*
+template 
+struct pair
+{
+    template  pair(pair&& p);
+    template 
+        pair(piecewise_construct_t, tuple first_args,
+             tuple second_args);
+
+    template  pair& operator=(const pair& p);
+    pair& operator=(pair&& p) noexcept(is_nothrow_move_assignable::value &&
+                                       is_nothrow_move_assignable::value);
+    template  pair& operator=(pair&& p);
+
+    void swap(pair& p) noexcept(noexcept(swap(first, p.first)) &&
+                                noexcept(swap(second, p.second)));
+};
+
+template  bool operator==(const pair&, const pair&);
+template  bool operator!=(const pair&, const pair&);
+template  bool operator< (const pair&, const pair&);
+template  bool operator> (const pair&, const pair&);
+template  bool operator>=(const pair&, const pair&);
+template  bool operator<=(const pair&, const pair&);
+*/
+
+
 template 
 struct pair
 {
@@ -79,47 +106,40 @@ struct pair
    pair()
       : first(), second()
    {}
-/*
-   //pair from two values
-   pair(const T1 &t1, const T2 &t2)
-      : first(t1)
-      , second(t2)
-   {}
-
-
-   //pair from two values
-   pair(BOOST_RV_REF(T1) t1, BOOST_RV_REF(T2) t2)
-      : first(::boost::move(t1))
-      , second(::boost::move(t2))
-   {}
-*/
-   template
-   pair(BOOST_FWD_REF(U) u, BOOST_FWD_REF(V) v)
-      : first(::boost::forward(u))
-      , second(::boost::forward(v))
-   {}
 
    //pair copy assignment
    pair(const pair& x)
       : first(x.first), second(x.second)
    {}
 
-   template 
-   pair(const pair &p)
-      : first(p.first), second(p.second)
-   {}
-
    //pair move constructor
    pair(BOOST_RV_REF(pair) p)
       : first(::boost::move(p.first)), second(::boost::move(p.second))
    {}
 
    template 
-   pair(BOOST_RV_REF_2_TEMPL_ARGS(pair, D, S) p)
+   pair(const pair &p)
+      : first(p.first), second(p.second)
+   {}
+
+   template 
+   pair(BOOST_RV_REF_BEG pair BOOST_RV_REF_END p)
       : first(::boost::move(p.first)), second(::boost::move(p.second))
    {}
 
-   //std::pair copy constructor
+   //pair from two values
+   pair(const T1 &t1, const T2 &t2)
+      : first(t1)
+      , second(t2)
+   {}
+
+   template
+   pair(BOOST_FWD_REF(U) u, BOOST_FWD_REF(V) v)
+      : first(::boost::forward(u))
+      , second(::boost::forward(v))
+   {}
+
+   //And now compatibility with std::pair
    pair(const std::pair& x)
       : first(x.first), second(x.second)
    {}
@@ -129,17 +149,20 @@ struct pair
       : first(p.first), second(p.second)
    {}
 
-   //std::pair move constructor
-   template 
-   pair(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p)
+   pair(BOOST_RV_REF_BEG std::pair BOOST_RV_REF_END p)
       : first(::boost::move(p.first)), second(::boost::move(p.second))
    {}
 
-   pair(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, T1, T2) p)
+   template 
+   pair(BOOST_RV_REF_BEG std::pair BOOST_RV_REF_END p)
       : first(::boost::move(p.first)), second(::boost::move(p.second))
    {}
 
    //piecewise_construct missing
+   //template  pair(pair&& p);
+   //template 
+   //   pair(piecewise_construct_t, tuple first_args,
+   //        tuple second_args);
 /*
    //Variadic versions
    template
@@ -179,14 +202,6 @@ struct pair
       return *this;
    }
 
-   template 
-   pair& operator=(const pair&p)
-   {
-      first  = p.first;
-      second = p.second;
-      return *this;
-   }
-
    //pair move assignment
    pair& operator=(BOOST_RV_REF(pair) p)
    {
@@ -196,7 +211,15 @@ struct pair
    }
 
    template 
-   pair& operator=(BOOST_RV_REF_2_TEMPL_ARGS(pair, D, S) p)
+   pair& operator=(const pair&p)
+   {
+      first  = p.first;
+      second = p.second;
+      return *this;
+   }
+
+   template 
+   pair& operator=(BOOST_RV_REF_BEG pair BOOST_RV_REF_END p)
    {
       first  = ::boost::move(p.first);
       second = ::boost::move(p.second);
@@ -220,7 +243,7 @@ struct pair
    }
 
    //std::pair move assignment
-   pair& operator=(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, T1, T2) p)
+   pair& operator=(BOOST_RV_REF_BEG std::pair BOOST_RV_REF_END p)
    {
       first  = ::boost::move(p.first);
       second = ::boost::move(p.second);
@@ -228,7 +251,7 @@ struct pair
    }
 
    template 
-   pair& operator=(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p)
+   pair& operator=(BOOST_RV_REF_BEG std::pair BOOST_RV_REF_END p)
    {
       first  = ::boost::move(p.first);
       second = ::boost::move(p.second);
diff --git a/include/boost/container/detail/pool_common.hpp b/include/boost/container/detail/pool_common.hpp
index c66e2cd..500b912 100644
--- a/include/boost/container/detail/pool_common.hpp
+++ b/include/boost/container/detail/pool_common.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
diff --git a/include/boost/container/detail/preprocessor.hpp b/include/boost/container/detail/preprocessor.hpp
index 9916fba..edea7a0 100644
--- a/include/boost/container/detail/preprocessor.hpp
+++ b/include/boost/container/detail/preprocessor.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-2012. 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)
 //
@@ -62,6 +62,10 @@
    //!
 #endif   //#ifndef BOOST_NO_RVALUE_REFERENCES
 
+#define BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q(z, n, Data) \
+const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
+//!
+
 #ifndef BOOST_NO_RVALUE_REFERENCES
    #define BOOST_CONTAINER_PP_PARAM(U, u) \
    U && u \
@@ -152,7 +156,11 @@ 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                                      \
+  BOOST_PP_CAT(class P, n) = void                                    \
+//!
+
+#define BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT(z, n, default_type) \
+  BOOST_PP_CAT(class P, n) = default_type                                  \
 //!
 
 #define BOOST_CONTAINER_PP_STATIC_PARAM_REF_DECLARE(z, n, data) \
diff --git a/include/boost/container/detail/stored_ref.hpp b/include/boost/container/detail/stored_ref.hpp
index df0faa8..80fda89 100644
--- a/include/boost/container/detail/stored_ref.hpp
+++ b/include/boost/container/detail/stored_ref.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-2012. 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)
 //
diff --git a/include/boost/container/detail/transform_iterator.hpp b/include/boost/container/detail/transform_iterator.hpp
index 17eca9e..bc558ba 100644
--- a/include/boost/container/detail/transform_iterator.hpp
+++ b/include/boost/container/detail/transform_iterator.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 // (C) Copyright Gennaro Prota 2003 - 2004.
 //
 // Distributed under the Boost Software License, Version 1.0.
diff --git a/include/boost/container/detail/tree.hpp b/include/boost/container/detail/tree.hpp
index 6cd91ed..e9a4bdd 100644
--- a/include/boost/container/detail/tree.hpp
+++ b/include/boost/container/detail/tree.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
@@ -27,7 +27,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 #include 
 #endif
@@ -90,43 +90,49 @@ struct rbtree_hook
       >::type  type;
 };
 
+//This trait is used to type-pun std::pair because in C++03
+//compilers std::pair is useless for C++11 features
 template
-struct rbtree_type
+struct rbtree_internal_data_type
 {
    typedef T type;
 };
 
 template
-struct rbtree_type< std::pair >
+struct rbtree_internal_data_type< std::pair >
 {
    typedef pair type;
 };
 
+
+//The node to be store in the tree
 template 
 struct rbtree_node
    :  public rbtree_hook::type
 {
-   private:
-   BOOST_COPYABLE_AND_MOVABLE(rbtree_node)
+   //private:
+   //BOOST_COPYABLE_AND_MOVABLE(rbtree_node)
 
    public:
    typedef typename rbtree_hook::type hook_type;
 
    typedef T value_type;
-   typedef typename rbtree_type::type internal_type;
+   typedef typename rbtree_internal_data_type::type internal_type;
 
    typedef rbtree_node node_type;
 
-   rbtree_node()
-      : m_data()
-   {}
+   private:
+   rbtree_node();
+   rbtree_node (const rbtree_node &);
+   rbtree_node & operator=(const rbtree_node &);
 
+/*
    rbtree_node(const rbtree_node &other)
       : m_data(other.m_data)
    {}
 
    rbtree_node(BOOST_RV_REF(rbtree_node) other)
-      : m_data(boost::move(other.m_data))
+      : m_data(::boost::move(other.m_data))
    {}
 
    #ifndef BOOST_CONTAINER_PERFECT_FORWARDING
@@ -152,8 +158,9 @@ struct rbtree_node
    {  do_assign(other.m_data);   return *this;  }
 
    rbtree_node &operator=(BOOST_RV_REF(rbtree_node) other)
-   {  do_move(other.m_data);   return *this;  }
-
+   {  do_move_assign(other.m_data);   return *this;  }
+*/
+   public:
    T &get_data()
    {
       T* ptr = reinterpret_cast(&this->m_data);
@@ -166,7 +173,7 @@ struct rbtree_node
       return *ptr;
    }
 
-   private:
+//   private:
    internal_type m_data;
 
    template
@@ -188,22 +195,22 @@ struct rbtree_node
    {  m_data = v; }
 
    template
-   void do_move(std::pair &p)
+   void do_move_assign(std::pair &p)
    {
-      const_cast(m_data.first) = boost::move(p.first);
-      m_data.second  = boost::move(p.second);
+      const_cast(m_data.first) = ::boost::move(p.first);
+      m_data.second = ::boost::move(p.second);
    }
 
    template
-   void do_move(pair &p)
+   void do_move_assign(pair &p)
    {
-      const_cast(m_data.first) = boost::move(p.first);
-      m_data.second  = boost::move(p.second);
+      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); }
+   void do_move_assign(V &v)
+   {  m_data = ::boost::move(v); }
 };
 
 }//namespace container_detail {
@@ -282,7 +289,7 @@ class rbtree
             //First recycle a node (this can't throw)
             try{
                //This can throw
-               *p = other;
+               p->do_assign(other.m_data);
                return p;
             }
             catch(...){
@@ -295,7 +302,7 @@ class rbtree
             }
          }
          else{
-            return m_holder.create_node(other);
+            return m_holder.create_node(other.m_data);
          }
       }
 
@@ -319,7 +326,7 @@ class rbtree
             //First recycle a node (this can't throw)
             try{
                //This can throw
-               *p = boost::move(other);
+               p->do_move_assign(const_cast(other).m_data);
                return p;
             }
             catch(...){
@@ -332,7 +339,7 @@ class rbtree
             }
          }
          else{
-            return m_holder.create_node(other);
+            return m_holder.create_node(other.m_data);
          }
       }
 
@@ -478,8 +485,10 @@ class rbtree
       iterator(){}
 
       //Pointer like operators
-      reference operator*()  const {  return  this->m_it->get_data();  }
-      pointer   operator->() const {  return  pointer(&this->m_it->get_data());  }
+      reference operator*()  const
+         {  return this->m_it->get_data();  }
+      pointer   operator->() const
+         {  return boost::intrusive::pointer_traits::pointer_to(this->m_it->get_data());  }
 
       //Increment / Decrement
       iterator& operator++()  
@@ -532,9 +541,28 @@ class rbtree
    }
 
    rbtree(BOOST_RV_REF(rbtree) x) 
-      :  AllocHolder(boost::move(static_cast(x)), x.key_comp())
+      :  AllocHolder(::boost::move(static_cast(x)), x.key_comp())
    {}
 
+   rbtree(const rbtree& x, const allocator_type &a) 
+      :  AllocHolder(a, x.key_comp())
+   {
+      this->icont().clone_from
+         (x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
+   }
+
+   rbtree(BOOST_RV_REF(rbtree) x, const allocator_type &a)
+      :  AllocHolder(a, x.key_comp())
+   {
+      if(this->node_alloc() == x.node_alloc()){
+         this->icont().swap(x.icont());
+      }
+      else{
+         this->icont().clone_from
+            (x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
+      }
+   }
+
    ~rbtree()
    {} //AllocHolder clears the tree
 
@@ -552,7 +580,7 @@ class rbtree
          //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()));
+         Icont other_tree(::boost::move(this->icont()));
 
          //Now recreate the source tree reusing nodes stored by other_tree
          this->icont().clone_from
@@ -578,7 +606,7 @@ class rbtree
          if(this_alloc == x_alloc){
             //Destroy and swap pointers
             this->clear();
-            this->icont() = boost::move(x.icont());
+            this->icont() = ::boost::move(x.icont());
             //Move allocator if needed
             this->AllocHolder::move_assign_alloc(x);
          }
@@ -587,7 +615,7 @@ class rbtree
             //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()));
+            Icont other_tree(::boost::move(this->icont()));
 
             //Now recreate the source tree reusing nodes stored by other_tree
             this->icont().clone_from
diff --git a/include/boost/container/detail/type_traits.hpp b/include/boost/container/detail/type_traits.hpp
index 6a0b3ed..2940f72 100644
--- a/include/boost/container/detail/type_traits.hpp
+++ b/include/boost/container/detail/type_traits.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 // (C) Copyright John Maddock 2000.
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
@@ -29,6 +29,13 @@ namespace container_detail {
 
 struct nat{};
 
+template 
+struct LowPriorityConversion
+{
+   // Convertible from T with user-defined-conversion rank.
+   LowPriorityConversion(const U&) { }
+};
+
 //boost::alignment_of yields to 10K lines of preprocessed code, so we
 //need an alternative
 template  struct alignment_of;
diff --git a/include/boost/container/detail/utilities.hpp b/include/boost/container/detail/utilities.hpp
index ee0fe99..57ce356 100644
--- a/include/boost/container/detail/utilities.hpp
+++ b/include/boost/container/detail/utilities.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
@@ -21,13 +21,23 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 namespace boost {
 namespace container {
 namespace container_detail {
 
+template 
+inline T* addressof(T& obj)
+{
+   return static_cast(
+	   static_cast(
+	      const_cast(
+            &reinterpret_cast(obj)
+   )));
+}
+
 template
 const T &max_value(const T &a, const T &b)
 {  return a > b ? a : b;   }
@@ -262,6 +272,7 @@ F uninitialized_copy_or_move_alloc
    return ::boost::container::uninitialized_copy_alloc(a, f, l, r);
 }
 
+
 }  //namespace container {
 }  //namespace boost {
 
diff --git a/include/boost/container/detail/value_init.hpp b/include/boost/container/detail/value_init.hpp
index afbc9c1..f164d21 100644
--- a/include/boost/container/detail/value_init.hpp
+++ b/include/boost/container/detail/value_init.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
diff --git a/include/boost/container/detail/variadic_templates_tools.hpp b/include/boost/container/detail/variadic_templates_tools.hpp
index f21f972..e24a2e0 100644
--- a/include/boost/container/detail/variadic_templates_tools.hpp
+++ b/include/boost/container/detail/variadic_templates_tools.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-2012. 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)
 //
diff --git a/include/boost/container/detail/version_type.hpp b/include/boost/container/detail/version_type.hpp
index 46344fa..aac704f 100644
--- a/include/boost/container/detail/version_type.hpp
+++ b/include/boost/container/detail/version_type.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
diff --git a/include/boost/container/detail/workaround.hpp b/include/boost/container/detail/workaround.hpp
index 45ab2f2..c444074 100644
--- a/include/boost/container/detail/workaround.hpp
+++ b/include/boost/container/detail/workaround.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
@@ -26,6 +26,11 @@
    #define BOOST_CONTAINER_NOEXCEPT_IF(x) noexcept(x)
 #endif
 
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES) && defined(__GXX_EXPERIMENTAL_CXX0X__)\
+    && (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40700)
+   #define BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST
+#endif
+
 #include 
 
 #endif   //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
diff --git a/include/boost/container/flat_map.hpp b/include/boost/container/flat_map.hpp
index 2d4515b..93429f3 100644
--- a/include/boost/container/flat_map.hpp
+++ b/include/boost/container/flat_map.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
@@ -26,7 +26,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -209,23 +209,38 @@ class flat_map
    //! Effects: Copy constructs a flat_map.
    //! 
    //! Complexity: Linear in x.size().
-   flat_map(const flat_map& x) 
+   flat_map(const flat_map& x) 
       : m_flat_tree(x.m_flat_tree) {}
 
    //! Effects: Move constructs a flat_map.
    //!   Constructs *this using x's resources.
    //! 
-   //! Complexity: Construct.
+   //! Complexity: Constant.
    //! 
    //! Postcondition: x is emptied.
    flat_map(BOOST_RV_REF(flat_map) x) 
       : m_flat_tree(boost::move(x.m_flat_tree))
    {}
 
+   //! Effects: Copy constructs a flat_map using the specified allocator.
+   //! 
+   //! Complexity: Linear in x.size().
+   flat_map(const flat_map& x, const allocator_type &a)
+      : m_flat_tree(x.m_flat_tree, a)
+   {}
+
+   //! Effects: Move constructs a flat_map using the specified allocator.
+   //!   Constructs *this using x's resources.
+   //! 
+   //! Complexity: Constant if x.get_allocator() == a, linear otherwise.
+   flat_map(BOOST_RV_REF(flat_map) x, const allocator_type &a) 
+      : m_flat_tree(boost::move(x.m_flat_tree), a)
+   {}
+
    //! Effects: Makes *this a copy of x.
    //! 
    //! Complexity: Linear in x.size().
-   flat_map& operator=(BOOST_COPY_ASSIGN_REF(flat_map) x)
+   flat_map& operator=(BOOST_COPY_ASSIGN_REF(flat_map) x)
    {  m_flat_tree = x.m_flat_tree;   return *this;  }
 
    //! Effects: Move constructs a flat_map.
@@ -234,7 +249,7 @@ class flat_map
    //! Complexity: Construct.
    //! 
    //! Postcondition: x is emptied.
-   flat_map& operator=(BOOST_RV_REF(flat_map) mx)
+   flat_map& operator=(BOOST_RV_REF(flat_map) mx)
    {  m_flat_tree = boost::move(mx.m_flat_tree);   return *this;  }
 
    //! Effects: Returns the comparison object out
@@ -960,28 +975,43 @@ class flat_multimap
    //! Effects: Copy constructs a flat_multimap.
    //! 
    //! Complexity: Linear in x.size().
-   flat_multimap(const flat_multimap& x) 
+   flat_multimap(const flat_multimap& x) 
       : m_flat_tree(x.m_flat_tree) { }
 
    //! Effects: Move constructs a flat_multimap. Constructs *this using x's resources.
    //! 
-   //! Complexity: Construct.
+   //! Complexity: Constant.
    //! 
    //! Postcondition: x is emptied.
    flat_multimap(BOOST_RV_REF(flat_multimap) x) 
       : m_flat_tree(boost::move(x.m_flat_tree))
    { }
 
+   //! Effects: Copy constructs a flat_multimap using the specified allocator.
+   //! 
+   //! Complexity: Linear in x.size().
+   flat_multimap(const flat_multimap& x, const allocator_type &a) 
+      : m_flat_tree(x.m_flat_tree, a)
+   {}
+
+   //! Effects: Move constructs a flat_multimap using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   flat_multimap(BOOST_RV_REF(flat_multimap) x, const allocator_type &a) 
+      : m_flat_tree(boost::move(x.m_flat_tree), a)
+   { }
+
    //! Effects: Makes *this a copy of x.
    //! 
    //! Complexity: Linear in x.size().
-   flat_multimap& operator=(BOOST_COPY_ASSIGN_REF(flat_multimap) x) 
+   flat_multimap& operator=(BOOST_COPY_ASSIGN_REF(flat_multimap) x) 
       {  m_flat_tree = x.m_flat_tree;   return *this;  }
 
    //! Effects: this->swap(x.get()).
    //! 
    //! Complexity: Constant.
-   flat_multimap& operator=(BOOST_RV_REF(flat_multimap) mx) 
+   flat_multimap& operator=(BOOST_RV_REF(flat_multimap) mx) 
       {  m_flat_tree = boost::move(mx.m_flat_tree);   return *this;  }
 
    //! Effects: Returns the comparison object out
diff --git a/include/boost/container/flat_set.hpp b/include/boost/container/flat_set.hpp
index f367309..e10e7be 100644
--- a/include/boost/container/flat_set.hpp
+++ b/include/boost/container/flat_set.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
@@ -100,14 +100,14 @@ 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.
+   //! Effects: Default constructs an empty flat_set.
    //! 
    //! Complexity: Constant.
    explicit flat_set()
       : m_flat_tree()
    {}
 
-   //! Effects: Constructs an empty flat_map using the specified
+   //! Effects: Constructs an empty flat_set using the specified
    //! comparison object and allocator.
    //! 
    //! Complexity: Constant.
@@ -116,7 +116,7 @@ class flat_set
       : m_flat_tree(comp, a)
    {}
 
-   //! Effects: Constructs an empty map using the specified comparison object and 
+   //! Effects: Constructs an empty set using the specified comparison object and 
    //! allocator, and inserts elements from the range [first ,last ).
    //! 
    //! Complexity: Linear in N if the range [first ,last ) is already sorted using 
@@ -143,31 +143,47 @@ class flat_set
       : m_flat_tree(ordered_range, first, last, comp, a) 
    {}
 
-   //! Effects: Copy constructs a map.
+   //! Effects: Copy constructs a set.
    //! 
    //! Complexity: Linear in x.size().
-   flat_set(const flat_set& x) 
-      : m_flat_tree(x.m_flat_tree) {}
+   flat_set(const flat_set& x) 
+      : m_flat_tree(x.m_flat_tree)
+   {}
 
-   //! Effects: Move constructs a map. Constructs *this using x's resources.
+   //! Effects: Move constructs a set. Constructs *this using x's resources.
    //! 
-   //! Complexity: Construct.
+   //! Complexity: Constant.
    //! 
    //! Postcondition: x is emptied.
    flat_set(BOOST_RV_REF(flat_set) mx) 
       : m_flat_tree(boost::move(mx.m_flat_tree))
    {}
 
-   //! Effects: Makes *this a copy of x.
+   //! Effects: Copy constructs a set using the specified allocator.
    //! 
    //! Complexity: Linear in x.size().
-   flat_set& operator=(BOOST_COPY_ASSIGN_REF(flat_set) x)
-      {  m_flat_tree = x.m_flat_tree;   return *this;  }
+   flat_set(const flat_set& x, const allocator_type &a)
+      : m_flat_tree(x.m_flat_tree, a)
+   {}
+
+   //! Effects: Move constructs a set using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //! 
+   //! Complexity: Constant if a == mx.get_allocator(), linear otherwise
+   flat_set(BOOST_RV_REF(flat_set) mx, const allocator_type &a) 
+      : m_flat_tree(boost::move(mx.m_flat_tree), a)
+   {}
 
    //! Effects: Makes *this a copy of x.
    //! 
    //! Complexity: Linear in x.size().
-   flat_set& operator=(BOOST_RV_REF(flat_set) mx)
+   flat_set& operator=(BOOST_COPY_ASSIGN_REF(flat_set) x)
+      {  m_flat_tree = x.m_flat_tree;   return *this;  }
+
+   //! Effects: Makes *this a copy of the previous value of xx.
+   //! 
+   //! Complexity: Linear in x.size().
+   flat_set& operator=(BOOST_RV_REF(flat_set) mx)
    {  m_flat_tree = boost::move(mx.m_flat_tree);   return *this;  }
 
    //! Effects: Returns the comparison object out
@@ -729,7 +745,7 @@ class flat_multiset
    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.
+   //! Effects: Default constructs an empty flat_multiset.
    //! 
    //! Complexity: Constant.
    explicit flat_multiset()
@@ -761,17 +777,47 @@ class flat_multiset
       : m_flat_tree(ordered_range, first, last, comp, a) 
    {}
 
-   flat_multiset(const flat_multiset& x) 
-      : m_flat_tree(x.m_flat_tree) {}
-
-   flat_multiset(BOOST_RV_REF(flat_multiset) x) 
-      : m_flat_tree(boost::move(x.m_flat_tree))
+   //! Effects: Copy constructs a flat_multiset.
+   //! 
+   //! Complexity: Linear in x.size().
+   flat_multiset(const flat_multiset& x) 
+      : m_flat_tree(x.m_flat_tree)
    {}
 
-   flat_multiset& operator=(BOOST_COPY_ASSIGN_REF(flat_multiset) x) 
+   //! Effects: Move constructs a flat_multiset. Constructs *this using x's resources.
+   //! 
+   //! Complexity: Constant.
+   //! 
+   //! Postcondition: x is emptied.
+   flat_multiset(BOOST_RV_REF(flat_multiset) mx) 
+      : m_flat_tree(boost::move(mx.m_flat_tree))
+   {}
+
+   //! Effects: Copy constructs a flat_multiset using the specified allocator.
+   //! 
+   //! Complexity: Linear in x.size().
+   flat_multiset(const flat_multiset& x, const allocator_type &a)
+      : m_flat_tree(x.m_flat_tree, a)
+   {}
+
+   //! Effects: Move constructs a flat_multiset using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //! 
+   //! Complexity: Constant if a == mx.get_allocator(), linear otherwise
+   flat_multiset(BOOST_RV_REF(flat_multiset) mx, const allocator_type &a) 
+      : m_flat_tree(boost::move(mx.m_flat_tree), a)
+   {}
+
+   //! Effects: Makes *this a copy of x.
+   //! 
+   //! Complexity: Linear in x.size().
+   flat_multiset& operator=(BOOST_COPY_ASSIGN_REF(flat_multiset) x) 
       {  m_flat_tree = x.m_flat_tree;   return *this;  }
 
-   flat_multiset& operator=(BOOST_RV_REF(flat_multiset) mx) 
+   //! Effects: Makes *this a copy of x.
+   //! 
+   //! Complexity: Linear in x.size().
+   flat_multiset& operator=(BOOST_RV_REF(flat_multiset) mx) 
    {  m_flat_tree = boost::move(mx.m_flat_tree);   return *this;  }
 
    //! Effects: Returns the comparison object out
diff --git a/include/boost/container/list.hpp b/include/boost/container/list.hpp
index 6df999b..512835a 100644
--- a/include/boost/container/list.hpp
+++ b/include/boost/container/list.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
@@ -65,30 +65,13 @@ template 
 struct list_node
    :  public list_hook::type
 {
+   private:
+   list_node();
+   list_node(const list_node &);
+   list_node & operator=(const list_node &);
 
-   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_CONTAINER_PERFECT_FORWARDING
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                           \
-   template                                                \
-   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_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
-   #include BOOST_PP_LOCAL_ITERATE()
-
-   #endif//#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
-
+   public:
+   typedef typename list_hook::type hook_type;
    T m_data;
 };
 
@@ -374,6 +357,34 @@ class list
       : AllocHolder(boost::move(static_cast(x)))
    {}
 
+   //! Effects: Copy constructs a list using the specified allocator.
+   //!
+   //! Postcondition: x == *this.
+   //! 
+   //! Throws: If allocator_type's default constructor or copy constructor throws.
+   //! 
+   //! Complexity: Linear to the elements x contains.
+   list(const list& x, const allocator_type &a) 
+      : AllocHolder(a)
+   {  this->insert(this->cbegin(), x.begin(), x.end());   }
+
+   //! Effects: Move constructor sing the specified allocator.
+   //!                 Moves mx's resources to *this.
+   //!
+   //! Throws: If allocation or value_type's copy constructor throws.
+   //! 
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   list(BOOST_RV_REF(list) x, const allocator_type &a)
+      : AllocHolder(a)
+   {
+      if(this->node_alloc() == x.node_alloc()){
+         this->icont().swap(x.icont());
+      }
+      else{
+         this->insert(this->cbegin(), x.begin(), x.end());
+      }
+   }
+
    //! Effects: Constructs a list that will use a copy of allocator a
    //!   and inserts a copy of the range [first, last) in the list.
    //!
diff --git a/include/boost/container/map.hpp b/include/boost/container/map.hpp
index 8f7ecd4..25403e0 100644
--- a/include/boost/container/map.hpp
+++ b/include/boost/container/map.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
@@ -158,7 +158,7 @@ class map
       : m_tree(first, last, comp, a, true) 
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_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 
@@ -175,29 +175,52 @@ class map
       : m_tree(ordered_range, first, last, comp, a) 
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_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.
    //! 
    //! Complexity: Linear in x.size().
-   map(const map& x) 
+   map(const map& x) 
       : m_tree(x.m_tree)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_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.
    //! 
-   //! Complexity: Construct.
+   //! Complexity: Constant.
    //! 
    //! Postcondition: x is emptied.
    map(BOOST_RV_REF(map) x) 
       : m_tree(boost::move(x.m_tree))
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_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 using the specified allocator.
+   //! 
+   //! Complexity: Linear in x.size().
+   map(const map& x, const allocator_type &a) 
+      : m_tree(x.m_tree, a)
+   {
+      //Allocator type must be std::pair
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value));
+   }
+
+   //! Effects: Move constructs a map using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant if x == x.get_allocator(), linear otherwise.
+   //! 
+   //! Postcondition: x is emptied.
+   map(BOOST_RV_REF(map) x, const allocator_type &a) 
+      : m_tree(boost::move(x.m_tree), a)
+   {
+      //Allocator type must be std::pair
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value));
    }
 
    //! Effects: Makes *this a copy of x.
@@ -833,7 +856,7 @@ class multimap
       : m_tree(comp, a)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_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
@@ -848,7 +871,7 @@ class multimap
       : m_tree(first, last, comp, a, false) 
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_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 
@@ -864,27 +887,48 @@ class multimap
       : m_tree(ordered_range, first, last, comp, a) 
    {}
 
-
    //! Effects: Copy constructs a multimap.
    //! 
    //! Complexity: Linear in x.size().
-   multimap(const multimap& x) 
+   multimap(const multimap& x) 
       : m_tree(x.m_tree)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_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.
    //! 
-   //! Complexity: Construct.
+   //! Complexity: Constant.
    //! 
    //! Postcondition: x is emptied.
    multimap(BOOST_RV_REF(multimap) x) 
       : m_tree(boost::move(x.m_tree))
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value));
+   }
+
+   //! Effects: Copy constructs a multimap.
+   //! 
+   //! Complexity: Linear in x.size().
+   multimap(const multimap& x, const allocator_type &a) 
+      : m_tree(x.m_tree, a)
+   {
+      //Allocator type must be std::pair
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value));
+   }
+
+   //! Effects: Move constructs a multimap using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   //! 
+   //! Postcondition: x is emptied.
+   multimap(BOOST_RV_REF(multimap) x, const allocator_type &a)
+      : m_tree(boost::move(x.m_tree), a)
+   {
+      //Allocator type must be std::pair
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value));
    }
 
    //! Effects: Makes *this a copy of x.
diff --git a/include/boost/container/set.hpp b/include/boost/container/set.hpp
index b25e701..ef3d989 100644
--- a/include/boost/container/set.hpp
+++ b/include/boost/container/set.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
@@ -144,16 +144,31 @@ class set
 
    //! Effects: Move constructs a set. Constructs *this using x's resources.
    //! 
-   //! Complexity: Construct.
+   //! Complexity: Constant.
    //! 
    //! Postcondition: x is emptied.
    set(BOOST_RV_REF(set) x) 
       : m_tree(boost::move(x.m_tree))
    {}
 
-   //! Effects: Makes *this a copy of x.
+   //! Effects: Copy constructs a set using the specified allocator.
    //! 
    //! Complexity: Linear in x.size().
+   set(const set& x, const allocator_type &a) 
+      : m_tree(x.m_tree, a)
+   {}
+
+   //! Effects: Move constructs a set using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   set(BOOST_RV_REF(set) x, const allocator_type &a) 
+      : m_tree(boost::move(x.m_tree), a)
+   {}
+
+   //! Effects: Makes *this a copy of x.
+   //!
+   //! Complexity: Linear in x.size().
    set& operator=(BOOST_COPY_ASSIGN_REF(set) x)
    {  m_tree = x.m_tree;   return *this;  }
 
@@ -716,13 +731,30 @@ class multiset
 
    //! Effects: Move constructs a multiset. Constructs *this using x's resources.
    //! 
-   //! Complexity: Construct.
+   //! Complexity: Constant.
    //! 
    //! Postcondition: x is emptied.
    multiset(BOOST_RV_REF(multiset) x) 
       : m_tree(boost::move(x.m_tree))
    {}
 
+   //! Effects: Copy constructs a multiset using the specified allocator.
+   //! 
+   //! Complexity: Linear in x.size().
+   multiset(const multiset& x, const allocator_type &a) 
+      : m_tree(x.m_tree, a)
+   {}
+
+   //! Effects: Move constructs a multiset using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //! 
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   //! 
+   //! Postcondition: x is emptied.
+   multiset(BOOST_RV_REF(multiset) x, const allocator_type &a) 
+      : m_tree(boost::move(x.m_tree), a)
+   {}
+
    //! Effects: Makes *this a copy of x.
    //! 
    //! Complexity: Linear in x.size().
diff --git a/include/boost/container/slist.hpp b/include/boost/container/slist.hpp
index 1cdcdf1..3146c0f 100644
--- a/include/boost/container/slist.hpp
+++ b/include/boost/container/slist.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2004-2012. 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)
 //
@@ -65,31 +65,13 @@ template 
 struct slist_node
    :  public slist_hook::type
 {
+   private:
+   slist_node();
+   slist_node(const slist_node &);
+   slist_node & operator=(const slist_node &);
 
-   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_CONTAINER_PERFECT_FORWARDING
-
-   #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_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
-   #include BOOST_PP_LOCAL_ITERATE()
-
-   #endif//#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
-
+   public:
+   typedef typename slist_hook::type hook_type;
    T m_data;
 };
 
@@ -391,6 +373,34 @@ class slist
       : AllocHolder(boost::move(static_cast(x)))
    {}
 
+   //! Effects: Copy constructs a list using the specified allocator.
+   //!
+   //! Postcondition: x == *this.
+   //! 
+   //! Throws: If allocator_type's default constructor or copy constructor throws.
+   //! 
+   //! Complexity: Linear to the elements x contains.
+   slist(const slist& x, const allocator_type &a) 
+      : AllocHolder(a)
+   { this->insert_after(this->before_begin(), x.begin(), x.end()); }
+
+   //! Effects: Move constructor using the specified allocator.
+   //!                 Moves x's resources to *this.
+   //!
+   //! Throws: If allocation or value_type's copy constructor throws.
+   //! 
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   slist(BOOST_RV_REF(slist) x, const allocator_type &a)
+      : AllocHolder(a)
+   {
+      if(this->node_alloc() == x.node_alloc()){
+         this->icont().swap(x.icont());
+      }
+      else{
+         this->insert(this->cbegin(), x.begin(), x.end());
+      }
+   }
+
    //! Effects: Makes *this contain the same elements as x.
    //!
    //! Postcondition: this->size() == x.size(). *this contains a copy 
diff --git a/include/boost/container/stable_vector.hpp b/include/boost/container/stable_vector.hpp
index 851b5f2..2d15f46 100644
--- a/include/boost/container/stable_vector.hpp
+++ b/include/boost/container/stable_vector.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-2012. 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)
 //
@@ -34,7 +34,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -78,10 +78,6 @@ struct smart_ptr_type
    {  return ptr;}
 };
 
-template
-inline typename smart_ptr_type::pointer to_raw_pointer(const Ptr &ptr)
-{  return smart_ptr_type::get(ptr);   }
-
 template 
 class clear_on_destroy
 {
@@ -110,13 +106,10 @@ class clear_on_destroy
 
 template
 struct node_type_base
-{/*
-   node_type_base(VoidPtr p)
-      : up(p)
-   {}*/
+{
    node_type_base()
    {}
-   void set_pointer(VoidPtr p)
+   void set_pointer(const VoidPtr &p)
    {  up = p; }
 
    VoidPtr up;
@@ -126,33 +119,12 @@ template
 struct node_type
    : public node_type_base
 {
-   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_CONTAINER_PERFECT_FORWARDING
-
-   #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_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
-   #include BOOST_PP_LOCAL_ITERATE()
-
-   #endif//BOOST_CONTAINER_PERFECT_FORWARDING
-   
-   void set_pointer(VoidPointer p)
-   {  node_type_base::set_pointer(p); }
+   private:
+   node_type();
+   node_type(const node_type &);
+   node_type & operator=(const node_type &);
 
+   public:
    T value;
 };
 
@@ -206,17 +178,17 @@ class iterator
    private:
    static node_type_ptr_t node_ptr_cast(const void_ptr &p)
    {
-      return node_type_ptr_t(static_cast(stable_vector_detail::to_raw_pointer(p)));
+      return node_type_ptr_t(static_cast(container_detail::to_raw_pointer(p)));
    }
 
    static const_node_type_ptr_t node_ptr_cast(const const_void_ptr &p)
    {
-      return const_node_type_ptr_t(static_cast(stable_vector_detail::to_raw_pointer(p)));
+      return const_node_type_ptr_t(static_cast(container_detail::to_raw_pointer(p)));
    }
 
    static void_ptr_ptr void_ptr_ptr_cast(const void_ptr &p)
    {
-      return void_ptr_ptr(static_cast(stable_vector_detail::to_raw_pointer(p)));
+      return void_ptr_ptr(static_cast(container_detail::to_raw_pointer(p)));
    }
 
    reference dereference() const
@@ -353,35 +325,37 @@ BOOST_JOIN(check_invariant_,__LINE__).touch();
 
 /// @endcond
 
-//!Originally developed by Joaquin M. Lopez Munoz, stable_vector is std::vector
-//!drop-in replacement implemented as a node container, offering iterator and reference
-//!stability.
+//! Originally developed by Joaquin M. Lopez Munoz, stable_vector is std::vector
+//! drop-in replacement implemented as a node container, offering iterator and reference
+//! stability.
 //!
-//!More details taken the author's blog: ( Introducing stable_vector)
+//! More details taken the author's blog:
+//! ( 
+//! Introducing stable_vector)
 //!
-//!We present stable_vector, a fully STL-compliant stable container that provides
-//!most of the features of std::vector except element contiguity. 
+//! We present stable_vector, a fully STL-compliant stable container that provides
+//! most of the features of std::vector except element contiguity. 
 //!
-//!General properties: stable_vector satisfies all the requirements of a container,
-//!a reversible container and a sequence and provides all the optional operations
-//!present in std::vector. Like std::vector,  iterators are random access.
-//!stable_vector does not provide element contiguity; in exchange for this absence,
-//!the container is stable, i.e. references and iterators to an element of a stable_vector
-//!remain valid as long as the element is not erased, and an iterator that has been
-//!assigned the return value of end() always remain valid until the destruction of
-//!the associated  stable_vector.
+//! General properties: stable_vector satisfies all the requirements of a container,
+//! a reversible container and a sequence and provides all the optional operations
+//! present in std::vector. Like std::vector,  iterators are random access.
+//! stable_vector does not provide element contiguity; in exchange for this absence,
+//! the container is stable, i.e. references and iterators to an element of a stable_vector
+//! remain valid as long as the element is not erased, and an iterator that has been
+//! assigned the return value of end() always remain valid until the destruction of
+//! the associated  stable_vector.
 //!
-//!Operation complexity: The big-O complexities of stable_vector operations match
-//!exactly those of std::vector. In general, insertion/deletion is constant time at
-//!the end of the sequence and linear elsewhere. Unlike std::vector, stable_vector
-//!does not internally perform any value_type destruction, copy or assignment
-//!operations other than those exactly corresponding to the insertion of new
-//!elements or deletion of stored elements, which can sometimes compensate in terms
-//!of performance for the extra burden of doing more pointer manipulation and an
-//!additional allocation per element.
+//! Operation complexity: The big-O complexities of stable_vector operations match
+//! exactly those of std::vector. In general, insertion/deletion is constant time at
+//! the end of the sequence and linear elsewhere. Unlike std::vector, stable_vector
+//! does not internally perform any value_type destruction, copy or assignment
+//! operations other than those exactly corresponding to the insertion of new
+//! elements or deletion of stored elements, which can sometimes compensate in terms
+//! of performance for the extra burden of doing more pointer manipulation and an
+//! additional allocation per element.
 //!
-//!Exception safety: As stable_vector does not internally copy elements around, some
-//!operations provide stronger exception safety guarantees than in std::vector:
+//! Exception safety: As stable_vector does not internally copy elements around, some
+//! operations provide stronger exception safety guarantees than in std::vector:
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 template  >
 #else
@@ -524,7 +498,7 @@ class stable_vector
    //! Throws: If allocator_type's copy constructor throws.
    //! 
    //! Complexity: Constant.
-   explicit stable_vector(const A& al)
+   explicit stable_vector(const allocator_type& al)
       : internal_data(al),impl(al)
    {
       STABLE_VECTOR_CHECK_INVARIANT;
@@ -538,7 +512,7 @@ class stable_vector
    //! 
    //! Complexity: Linear to n.
    explicit stable_vector(size_type n)
-      : internal_data(A()),impl(A())
+      : internal_data(),impl()
    {
       stable_vector_detail::clear_on_destroy cod(*this);
       this->resize(n);
@@ -553,7 +527,7 @@ class stable_vector
    //!   throws or T's default or copy constructor throws.
    //! 
    //! Complexity: Linear to n.
-   stable_vector(size_type n, const T& t, const A& al=A())
+   stable_vector(size_type n, const T& t, const allocator_type& al = allocator_type())
       : internal_data(al),impl(al)
    {
       stable_vector_detail::clear_on_destroy cod(*this);
@@ -570,7 +544,7 @@ class stable_vector
    //!
    //! Complexity: Linear to the range [first, last).
    template 
-   stable_vector(InputIterator first,InputIterator last,const A& al=A())
+   stable_vector(InputIterator first,InputIterator last, const allocator_type& al = allocator_type())
       : internal_data(al),impl(al)
    {
       stable_vector_detail::clear_on_destroy cod(*this);
@@ -607,6 +581,40 @@ class stable_vector
       this->priv_swap_members(x);
    }
 
+   //! Effects: Copy constructs a stable_vector using the specified allocator.
+   //!
+   //! Postcondition: x == *this.
+   //! 
+   //! Complexity: Linear to the elements x contains.
+   stable_vector(const stable_vector& x, const allocator_type &a)
+      : internal_data(a), impl(a)
+   {
+      stable_vector_detail::clear_on_destroy cod(*this);
+      this->insert(this->cbegin(), x.begin(), x.end());
+      STABLE_VECTOR_CHECK_INVARIANT;
+      cod.release();
+   }
+
+   //! Effects: Move constructor using the specified allocator.
+   //!                 Moves mx's resources to *this.
+   //!
+   //! Throws: If allocator_type's copy constructor throws.
+   //! 
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise
+   stable_vector(BOOST_RV_REF(stable_vector) x, const allocator_type &a)
+      : internal_data(a), impl(a)
+   {
+      if(this->node_alloc() == x.node_alloc()){
+         this->priv_swap_members(x);
+      }
+      else{
+         stable_vector_detail::clear_on_destroy cod(*this);
+         this->insert(this->cbegin(), x.begin(), x.end());
+         STABLE_VECTOR_CHECK_INVARIANT;
+         cod.release();
+      }
+   }
+
    //! Effects: Destroys the stable_vector. All stored values are destroyed
    //!   and used memory is deallocated.
    //!
@@ -709,7 +717,7 @@ class stable_vector
    //! Throws: If allocator's copy constructor throws.
    //! 
    //! Complexity: Constant.
-   allocator_type get_allocator()const  {return node_alloc();}
+   allocator_type get_allocator()const  {return this->node_alloc();}
 
    //! Effects: Returns a reference to the internal allocator.
    //! 
@@ -1137,7 +1145,7 @@ class stable_vector
    void emplace_back(Args &&...args)
    {
       typedef emplace_functor         EmplaceFunctor;
-      typedef emplace_iterator EmplaceIterator;
+      typedef emplace_iterator EmplaceIterator;
       EmplaceFunctor &&ef = EmplaceFunctor(boost::forward(args)...);
       this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator());
    }
@@ -1157,7 +1165,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_iterator EmplaceIterator;
+      typedef emplace_iterator EmplaceIterator;
       EmplaceFunctor &&ef = EmplaceFunctor(boost::forward(args)...);
       this->insert(position, EmplaceIterator(ef), EmplaceIterator());
       return iterator(this->begin() + pos_n);
@@ -1172,7 +1180,7 @@ class stable_vector
       typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg)                               \
          BOOST_PP_EXPR_IF(n, <) BOOST_PP_ENUM_PARAMS(n, P) BOOST_PP_EXPR_IF(n, >)               \
             EmplaceFunctor;                                                                     \
-      typedef emplace_iterator  EmplaceIterator;  \
+      typedef emplace_iterator  EmplaceIterator;   \
       EmplaceFunctor ef BOOST_PP_LPAREN_IF(n)                                                   \
                         BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)                   \
                         BOOST_PP_RPAREN_IF(n);                                                  \
@@ -1186,7 +1194,7 @@ class stable_vector
       typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg)                               \
          BOOST_PP_EXPR_IF(n, <) BOOST_PP_ENUM_PARAMS(n, P) BOOST_PP_EXPR_IF(n, >)               \
             EmplaceFunctor;                                                                     \
-      typedef emplace_iterator  EmplaceIterator;  \
+      typedef emplace_iterator  EmplaceIterator;   \
       EmplaceFunctor ef BOOST_PP_LPAREN_IF(n)                                                   \
                         BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)                   \
                         BOOST_PP_RPAREN_IF(n);                                                  \
@@ -1482,12 +1490,12 @@ class stable_vector
 
    static node_type_ptr_t node_ptr_cast(const void_ptr &p)
    {
-      return node_type_ptr_t(static_cast(stable_vector_detail::to_raw_pointer(p)));
+      return node_type_ptr_t(static_cast(container_detail::to_raw_pointer(p)));
    }
 
    static node_type_base_ptr_t node_base_ptr_cast(const void_ptr &p)
    {
-      return node_type_base_ptr_t(static_cast(stable_vector_detail::to_raw_pointer(p)));
+      return node_type_base_ptr_t(static_cast(container_detail::to_raw_pointer(p)));
    }
 
    static value_type& value(const void_ptr &p)
@@ -1529,7 +1537,9 @@ class stable_vector
    {
       node_type_ptr_t p = this->allocate_one();
       try{
-         boost::container::construct_in_place(this->node_alloc(), &*p, it);
+         boost::container::construct_in_place(this->node_alloc(), container_detail::addressof(p->value), it);
+         //This does not throw
+         ::new(static_cast(container_detail::to_raw_pointer(p))) node_type_base_t;
          p->set_pointer(up);
       }
       catch(...){
@@ -1621,7 +1631,9 @@ class stable_vector
             p = mem.front();
             mem.pop_front();
             //This can throw
-            boost::container::construct_in_place(this->node_alloc(), &*p, first);
+            boost::container::construct_in_place(this->node_alloc(), container_detail::addressof(p->value), first);
+            //This does not throw
+            ::new(static_cast(container_detail::to_raw_pointer(p))) node_type_base_t;
             p->set_pointer(void_ptr_ptr(&it[i]));
             ++first;
             it[i] = p;
@@ -1650,7 +1662,9 @@ class stable_vector
                break;
             }
             //This can throw
-            boost::container::construct_in_place(this->node_alloc(), &*p, first);
+            boost::container::construct_in_place(this->node_alloc(), container_detail::addressof(p->value), first);
+            //This does not throw
+            ::new(static_cast(container_detail::to_raw_pointer(p))) node_type_base_t;
             p->set_pointer(void_ptr_ptr(&it[i]));
             ++first;
             it[i]=p;
diff --git a/include/boost/container/string.hpp b/include/boost/container/string.hpp
index 3a9c55a..5821f02 100644
--- a/include/boost/container/string.hpp
+++ b/include/boost/container/string.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
@@ -43,7 +43,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -620,12 +620,12 @@ class basic_string
    //!
    //! Postcondition: x == *this.
    //! 
-   //! Throws: If allocator_type's default constructor or copy constructor throws.
+   //! Throws: If allocator_type's default constructor throws.
    basic_string(const basic_string& s) 
       :  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.
+   //! Effects: Move constructor. Moves s's resources to *this.
    //!
    //! Throws: If allocator_type's copy constructor throws.
    //! 
@@ -634,6 +634,32 @@ class basic_string
       : base_t(boost::move((base_t&)s))
    {}
 
+   //! Effects: Copy constructs a basic_string using the specified allocator.
+   //!
+   //! Postcondition: x == *this.
+   //! 
+   //! Throws: If allocation throws.
+   basic_string(const basic_string& s, const allocator_type &a) 
+      :  base_t(a)
+   { this->priv_range_initialize(s.begin(), s.end()); }
+
+   //! Effects: Move constructor using the specified allocator.
+   //!                 Moves s's resources to *this.
+   //!
+   //! Throws: If allocation throws.
+   //! 
+   //! Complexity: Constant if a == s.get_allocator(), linear otherwise.
+   basic_string(BOOST_RV_REF(basic_string) s, const allocator_type &a) 
+      : base_t(a)
+   {
+      if(a == this->alloc()){
+         this->swap_data(s);
+      }
+      else{
+         this->priv_range_initialize(s.begin(), s.end());
+      }
+   }
+
    //! Effects: Constructs a basic_string taking the allocator as parameter,
    //!   and is initialized by a specific number of characters of the s string. 
    basic_string(const basic_string& s, size_type pos, size_type n = npos,
diff --git a/include/boost/container/vector.hpp b/include/boost/container/vector.hpp
index 742d00d..66e86ee 100644
--- a/include/boost/container/vector.hpp
+++ b/include/boost/container/vector.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
 //
@@ -38,7 +38,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace boost {
 namespace container {
@@ -540,6 +541,40 @@ class vector : private container_detail::vector_alloc_holder
       :  base_t(boost::move(mx.alloc()))
    {  this->swap_members(mx);   }
 
+   //! Effects: Copy constructs a vector using the specified allocator.
+   //!
+   //! Postcondition: x == *this.
+   //! 
+   //! Throws: If allocation
+   //!   throws or T's copy constructor throws.
+   //! 
+   //! Complexity: Linear to the elements x contains.
+   vector(const vector &x, const allocator_type &a) 
+      :  base_t(a)
+   {
+      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 using the specified allocator.
+   //!                 Moves mx's resources to *this if a == allocator_type().
+   //!                 Otherwise copies values from x to *this.
+   //!
+   //! Throws: If allocation or T's copy constructor throws.
+   //! 
+   //! Complexity: Constant if a == mx.get_allocator(), linear otherwise.
+   vector(BOOST_RV_REF(vector) mx, const allocator_type &a)
+      :  base_t(a)
+   {
+      if(mx.alloc() == a){
+         this->swap_members(mx);
+      }
+      else{
+         this->assign( container_detail::to_raw_pointer(mx.members_.m_start)
+                     , container_detail::to_raw_pointer(mx.members_.m_start + mx.members_.m_size));
+      }
+   }
+
    //! Effects: Constructs a vector that will use a copy of allocator a
    //!   and inserts a copy of the range [first, last) in the vector.
    //!
@@ -1428,6 +1463,87 @@ class vector : private container_detail::vector_alloc_holder
       }
    }
 
+   private:
+   template
+   void insert_at_ordered_positions(const size_type *positions, size_type element_count, BiDirIt end)
+   {
+      const size_type old_size_pos = this->size();
+      this->reserve(old_size_pos + element_count);
+      T* const begin_ptr = container_detail::to_raw_pointer(this->members_.m_start);
+      size_type insertions_left = element_count;
+      size_type next_pos = old_size_pos;
+      size_type hole_size = element_count;
+
+      //Exception rollback. If any copy throws before the hole is filled, values
+      //already inserted/copied at the end of the buffer will be destroyed.
+      typename value_traits::ArrayDestructor past_hole_values_destroyer
+         (begin_ptr + old_size_pos + element_count, this->alloc(), size_type(0u));
+      //Loop for each insertion backwards, first moving the elements after the insertion point,
+      //then inserting the element.
+      while(insertions_left){
+         const size_type pos = positions[insertions_left - 1];
+         BOOST_ASSERT(pos <= old_size_pos);
+         //Shift the range after the insertion point, function will take care if the shift
+         //crosses the size() boundary, using copy/move or uninitialized copy/move if necessary.
+         size_type new_hole_size = shift_range(pos, next_pos, this->size(), insertions_left);
+         if(new_hole_size > 0){
+            //The hole was reduced by shift_range so expand exception rollback range backwards
+            past_hole_values_destroyer.increment_size_backwards(next_pos - pos);
+            //Insert the new value in the hole
+            allocator_traits_type::construct(this->alloc(), begin_ptr + pos + insertions_left - 1, *(--end));
+            --new_hole_size;
+            if(new_hole_size == 0){
+               //Hole was just filled, disable exception rollback and change vector size
+               past_hole_values_destroyer.release();
+               this->members_.m_size += element_count;
+            }
+            else{
+               //The hole was reduced by the new insertion by one
+               past_hole_values_destroyer.increment_size_backwards(size_type(1u));
+            }
+         }
+         else{
+            if(hole_size){
+               //Hole was just filled by shift_range, disable exception rollback and change vector size
+               past_hole_values_destroyer.release();
+               this->members_.m_size += element_count;
+            }
+            //Insert the new value in the already constructed range
+            begin_ptr[pos + insertions_left - 1] = *(--end);
+         }
+         --insertions_left;
+         hole_size = new_hole_size;
+         next_pos = pos;
+      }
+   }
+
+   size_type shift_range(size_type first_pos, size_type last_pos, size_type limit_pos, size_type shift_count)
+   {
+      BOOST_ASSERT(first_pos <= last_pos);
+      BOOST_ASSERT(last_pos <= limit_pos);
+      //
+      T* const begin_ptr = container_detail::to_raw_pointer(this->members_.m_start);
+
+      size_type hole_size = 0;
+      if((last_pos + shift_count) < limit_pos){
+         //All inside
+         boost::move_backward(begin_ptr + first_pos, begin_ptr + last_pos, begin_ptr + last_pos + shift_count);
+      }
+      else if((first_pos + shift_count) >= limit_pos){
+         //All outside
+         ::boost::container::uninitialized_move_alloc
+            (this->alloc(), begin_ptr + first_pos, begin_ptr + last_pos, begin_ptr + first_pos + shift_count);
+         hole_size = last_pos + shift_count - limit_pos;
+      }
+      else{
+         ::boost::container::uninitialized_move_alloc
+            (this->alloc(), begin_ptr + limit_pos - shift_count, begin_ptr + last_pos, begin_ptr + limit_pos);
+         boost::move_backward(begin_ptr + first_pos, begin_ptr + limit_pos - shift_count, begin_ptr + limit_pos + shift_count);
+      }
+      return hole_size;
+   }
+
+   private:
    void priv_range_insert_expand_forward(T* pos, size_type n, advanced_insert_aux_int_t &interf)
    {
       //n can't be 0, because there is nothing to do in that case