Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76106 - in trunk/boost: container container/allocator container/detail interprocess interprocess/allocators interprocess/allocators/detail interprocess/containers interprocess/detail interprocess/indexes interprocess/ipc interprocess/mem_algo interprocess/mem_algo/detail interprocess/smart_ptr interprocess/smart_ptr/detail interprocess/streams interprocess/sync interprocess/sync/emulation interprocess/sync/posix interprocess/sync/shm interprocess/sync/spin interprocess/sync/windows interprocess/sync/xsi intrusive intrusive/detail move
From: igaztanaga_at_[hidden]
Date: 2011-12-22 15:08:47


Author: igaztanaga
Date: 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
New Revision: 76106
URL: http://svn.boost.org/trac/boost/changeset/76106

Log:
Introducing allocator_traits and pointer_traits changes into several libraries.
Added:
   trunk/boost/container/allocator/
   trunk/boost/container/allocator/allocator_traits.hpp (contents, props changed)
   trunk/boost/container/allocator/memory_util.hpp (contents, props changed)
   trunk/boost/container/allocator/scoped_allocator.hpp (contents, props changed)
   trunk/boost/container/detail/function_detector.hpp (contents, props changed)
   trunk/boost/interprocess/sync/posix/condition.hpp (contents, props changed)
   trunk/boost/interprocess/sync/posix/mutex.hpp (contents, props changed)
   trunk/boost/interprocess/sync/posix/named_mutex.hpp (contents, props changed)
   trunk/boost/interprocess/sync/posix/named_semaphore.hpp (contents, props changed)
   trunk/boost/interprocess/sync/posix/recursive_mutex.hpp (contents, props changed)
   trunk/boost/interprocess/sync/posix/semaphore.hpp (contents, props changed)
   trunk/boost/interprocess/sync/shm/
   trunk/boost/interprocess/sync/shm/named_condition.hpp (contents, props changed)
   trunk/boost/interprocess/sync/shm/named_creation_functor.hpp (contents, props changed)
   trunk/boost/interprocess/sync/shm/named_mutex.hpp (contents, props changed)
   trunk/boost/interprocess/sync/shm/named_recursive_mutex.hpp (contents, props changed)
   trunk/boost/interprocess/sync/shm/named_semaphore.hpp (contents, props changed)
   trunk/boost/interprocess/sync/shm/named_upgradable_mutex.hpp (contents, props changed)
   trunk/boost/interprocess/sync/spin/
   trunk/boost/interprocess/sync/spin/condition.hpp (contents, props changed)
   trunk/boost/interprocess/sync/spin/interprocess_barrier.hpp (contents, props changed)
   trunk/boost/interprocess/sync/spin/mutex.hpp (contents, props changed)
   trunk/boost/interprocess/sync/spin/recursive_mutex.hpp (contents, props changed)
   trunk/boost/interprocess/sync/spin/semaphore.hpp (contents, props changed)
   trunk/boost/interprocess/sync/windows/
   trunk/boost/interprocess/sync/windows/condition.hpp (contents, props changed)
   trunk/boost/interprocess/sync/windows/mutex.hpp (contents, props changed)
   trunk/boost/interprocess/sync/windows/recursive_mutex.hpp (contents, props changed)
   trunk/boost/interprocess/sync/windows/semaphore.hpp (contents, props changed)
   trunk/boost/interprocess/sync/windows/sync_utils.hpp (contents, props changed)
   trunk/boost/intrusive/detail/has_member_function_callable_with.hpp (contents, props changed)
   trunk/boost/intrusive/detail/memory_util.hpp (contents, props changed)
   trunk/boost/intrusive/detail/preprocessor.hpp (contents, props changed)
   trunk/boost/intrusive/pointer_traits.hpp (contents, props changed)
Removed:
   trunk/boost/interprocess/sync/emulation/
   trunk/boost/interprocess/sync/interprocess_barrier.hpp
   trunk/boost/interprocess/sync/posix/interprocess_barrier.hpp
   trunk/boost/interprocess/sync/posix/interprocess_condition.hpp
   trunk/boost/interprocess/sync/posix/interprocess_mutex.hpp
   trunk/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp
   trunk/boost/interprocess/sync/posix/interprocess_semaphore.hpp
   trunk/boost/intrusive/detail/pointer_to_other.hpp
Text files modified:
   trunk/boost/container/container_fwd.hpp | 8
   trunk/boost/container/deque.hpp | 574 ++++++++++++++++++++-------------
   trunk/boost/container/detail/adaptive_node_pool_impl.hpp | 20
   trunk/boost/container/detail/advanced_insert_int.hpp | 447 ++++++++++++++------------
   trunk/boost/container/detail/algorithms.hpp | 82 +---
   trunk/boost/container/detail/allocation_type.hpp | 6
   trunk/boost/container/detail/config_begin.hpp | 8
   trunk/boost/container/detail/config_end.hpp | 4
   trunk/boost/container/detail/destroyers.hpp | 85 ++--
   trunk/boost/container/detail/flat_tree.hpp | 190 +++++------
   trunk/boost/container/detail/iterators.hpp | 70 ++--
   trunk/boost/container/detail/math_functions.hpp | 4
   trunk/boost/container/detail/mpl.hpp | 11
   trunk/boost/container/detail/multiallocation_chain.hpp | 30
   trunk/boost/container/detail/node_alloc_holder.hpp | 299 ++++++++---------
   trunk/boost/container/detail/node_pool_impl.hpp | 12
   trunk/boost/container/detail/pair.hpp | 32
   trunk/boost/container/detail/pool_common.hpp | 4
   trunk/boost/container/detail/preprocessor.hpp | 157 +++++---
   trunk/boost/container/detail/stored_ref.hpp | 10
   trunk/boost/container/detail/transform_iterator.hpp | 8
   trunk/boost/container/detail/tree.hpp | 330 ++++++++++++-------
   trunk/boost/container/detail/type_traits.hpp | 10
   trunk/boost/container/detail/utilities.hpp | 203 +++++++++--
   trunk/boost/container/detail/value_init.hpp | 12
   trunk/boost/container/detail/variadic_templates_tools.hpp | 10
   trunk/boost/container/detail/version_type.hpp | 16
   trunk/boost/container/detail/workaround.hpp | 17
   trunk/boost/container/flat_map.hpp | 470 ++++++++++++++-------------
   trunk/boost/container/flat_set.hpp | 105 +++---
   trunk/boost/container/list.hpp | 250 +++++++-------
   trunk/boost/container/map.hpp | 190 ++++++----
   trunk/boost/container/set.hpp | 111 +++---
   trunk/boost/container/slist.hpp | 226 +++++++------
   trunk/boost/container/stable_vector.hpp | 467 +++++++++++++++++----------
   trunk/boost/container/string.hpp | 381 ++++++++++++++--------
   trunk/boost/container/vector.hpp | 664 +++++++++++++++++++++------------------
   trunk/boost/interprocess/allocators/adaptive_pool.hpp | 16
   trunk/boost/interprocess/allocators/allocator.hpp | 33 -
   trunk/boost/interprocess/allocators/cached_adaptive_pool.hpp | 2
   trunk/boost/interprocess/allocators/cached_node_allocator.hpp | 2
   trunk/boost/interprocess/allocators/detail/adaptive_node_pool.hpp | 6
   trunk/boost/interprocess/allocators/detail/allocator_common.hpp | 70 +--
   trunk/boost/interprocess/allocators/detail/node_pool.hpp | 6
   trunk/boost/interprocess/allocators/detail/node_tools.hpp | 2
   trunk/boost/interprocess/allocators/node_allocator.hpp | 12
   trunk/boost/interprocess/allocators/private_adaptive_pool.hpp | 4
   trunk/boost/interprocess/allocators/private_node_allocator.hpp | 4
   trunk/boost/interprocess/anonymous_shared_memory.hpp | 4
   trunk/boost/interprocess/containers/allocation_type.hpp | 2
   trunk/boost/interprocess/containers/deque.hpp | 2
   trunk/boost/interprocess/containers/flat_map.hpp | 2
   trunk/boost/interprocess/containers/flat_set.hpp | 2
   trunk/boost/interprocess/containers/list.hpp | 2
   trunk/boost/interprocess/containers/map.hpp | 2
   trunk/boost/interprocess/containers/pair.hpp | 6
   trunk/boost/interprocess/containers/set.hpp | 2
   trunk/boost/interprocess/containers/slist.hpp | 2
   trunk/boost/interprocess/containers/stable_vector.hpp | 2
   trunk/boost/interprocess/containers/string.hpp | 2
   trunk/boost/interprocess/containers/vector.hpp | 2
   trunk/boost/interprocess/containers/version_type.hpp | 6
   trunk/boost/interprocess/creation_tags.hpp | 2
   trunk/boost/interprocess/detail/atomic.hpp | 2
   trunk/boost/interprocess/detail/cast_tags.hpp | 2
   trunk/boost/interprocess/detail/config_begin.hpp | 2
   trunk/boost/interprocess/detail/config_end.hpp | 2
   trunk/boost/interprocess/detail/file_wrapper.hpp | 4
   trunk/boost/interprocess/detail/in_place_interface.hpp | 2
   trunk/boost/interprocess/detail/intermodule_singleton.hpp | 196 ++++++++++-
   trunk/boost/interprocess/detail/interprocess_tester.hpp | 2
   trunk/boost/interprocess/detail/intersegment_ptr.hpp | 36 +-
   trunk/boost/interprocess/detail/managed_memory_impl.hpp | 22
   trunk/boost/interprocess/detail/managed_multi_shared_memory.hpp | 32 +
   trunk/boost/interprocess/detail/managed_open_or_create_impl.hpp | 86 ++--
   trunk/boost/interprocess/detail/math_functions.hpp | 2
   trunk/boost/interprocess/detail/min_max.hpp | 2
   trunk/boost/interprocess/detail/mpl.hpp | 4
   trunk/boost/interprocess/detail/multi_segment_services.hpp | 2
   trunk/boost/interprocess/detail/named_proxy.hpp | 46 +-
   trunk/boost/interprocess/detail/os_file_functions.hpp | 7
   trunk/boost/interprocess/detail/os_thread_functions.hpp | 12
   trunk/boost/interprocess/detail/pointer_type.hpp | 2
   trunk/boost/interprocess/detail/posix_time_types_wrk.hpp | 2
   trunk/boost/interprocess/detail/preprocessor.hpp | 28
   trunk/boost/interprocess/detail/robust_emulation.hpp | 32
   trunk/boost/interprocess/detail/segment_manager_helper.hpp | 33 +
   trunk/boost/interprocess/detail/tmp_dir_helpers.hpp | 9
   trunk/boost/interprocess/detail/transform_iterator.hpp | 2
   trunk/boost/interprocess/detail/type_traits.hpp | 37 +
   trunk/boost/interprocess/detail/utilities.hpp | 44 -
   trunk/boost/interprocess/detail/variadic_templates_tools.hpp | 2
   trunk/boost/interprocess/detail/win32_api.hpp | 204 +++++++-----
   trunk/boost/interprocess/detail/workaround.hpp | 4
   trunk/boost/interprocess/detail/xsi_shared_memory_device.hpp | 20
   trunk/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp | 4
   trunk/boost/interprocess/errors.hpp | 3
   trunk/boost/interprocess/exceptions.hpp | 2
   trunk/boost/interprocess/file_mapping.hpp | 6
   trunk/boost/interprocess/indexes/flat_map_index.hpp | 2
   trunk/boost/interprocess/indexes/iset_index.hpp | 4
   trunk/boost/interprocess/indexes/iunordered_set_index.hpp | 24
   trunk/boost/interprocess/indexes/map_index.hpp | 4
   trunk/boost/interprocess/indexes/null_index.hpp | 2
   trunk/boost/interprocess/indexes/unordered_map_index.hpp | 6
   trunk/boost/interprocess/interprocess_fwd.hpp | 2
   trunk/boost/interprocess/ipc/message_queue.hpp | 26
   trunk/boost/interprocess/managed_external_buffer.hpp | 11
   trunk/boost/interprocess/managed_heap_memory.hpp | 11
   trunk/boost/interprocess/managed_mapped_file.hpp | 22
   trunk/boost/interprocess/managed_shared_memory.hpp | 20
   trunk/boost/interprocess/managed_windows_shared_memory.hpp | 25 +
   trunk/boost/interprocess/managed_xsi_shared_memory.hpp | 18
   trunk/boost/interprocess/mapped_region.hpp | 6
   trunk/boost/interprocess/mem_algo/detail/mem_algo_common.hpp | 62 +-
   trunk/boost/interprocess/mem_algo/detail/multi_simple_seq_fit.hpp | 2
   trunk/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp | 47 +-
   trunk/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp | 49 +-
   trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp | 44 +-
   trunk/boost/interprocess/mem_algo/simple_seq_fit.hpp | 2
   trunk/boost/interprocess/offset_ptr.hpp | 343 +++++++++++---------
   trunk/boost/interprocess/permissions.hpp | 2
   trunk/boost/interprocess/segment_manager.hpp | 18
   trunk/boost/interprocess/shared_memory_object.hpp | 12
   trunk/boost/interprocess/smart_ptr/deleter.hpp | 4
   trunk/boost/interprocess/smart_ptr/detail/shared_count.hpp | 10
   trunk/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp | 2
   trunk/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp | 2
   trunk/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp | 2
   trunk/boost/interprocess/smart_ptr/enable_shared_from_this.hpp | 4
   trunk/boost/interprocess/smart_ptr/intrusive_ptr.hpp | 20
   trunk/boost/interprocess/smart_ptr/scoped_ptr.hpp | 6
   trunk/boost/interprocess/smart_ptr/shared_ptr.hpp | 32
   trunk/boost/interprocess/smart_ptr/unique_ptr.hpp | 12
   trunk/boost/interprocess/smart_ptr/weak_ptr.hpp | 2
   trunk/boost/interprocess/streams/bufferstream.hpp | 2
   trunk/boost/interprocess/streams/vectorstream.hpp | 2
   trunk/boost/interprocess/sync/file_lock.hpp | 6
   trunk/boost/interprocess/sync/interprocess_condition.hpp | 71 +--
   trunk/boost/interprocess/sync/interprocess_mutex.hpp | 78 ++--
   trunk/boost/interprocess/sync/interprocess_recursive_mutex.hpp | 76 ++--
   trunk/boost/interprocess/sync/interprocess_semaphore.hpp | 70 ++-
   trunk/boost/interprocess/sync/interprocess_upgradable_mutex.hpp | 3
   trunk/boost/interprocess/sync/lock_options.hpp | 2
   trunk/boost/interprocess/sync/mutex_family.hpp | 2
   trunk/boost/interprocess/sync/named_condition.hpp | 235 +-------------
   trunk/boost/interprocess/sync/named_mutex.hpp | 109 -----
   trunk/boost/interprocess/sync/named_recursive_mutex.hpp | 52 --
   trunk/boost/interprocess/sync/named_semaphore.hpp | 94 -----
   trunk/boost/interprocess/sync/named_upgradable_mutex.hpp | 4
   trunk/boost/interprocess/sync/null_mutex.hpp | 2
   trunk/boost/interprocess/sync/posix/pthread_helpers.hpp | 2
   trunk/boost/interprocess/sync/posix/ptime_to_timespec.hpp | 2
   trunk/boost/interprocess/sync/posix/semaphore_wrapper.hpp | 152 ++------
   trunk/boost/interprocess/sync/scoped_lock.hpp | 8
   trunk/boost/interprocess/sync/sharable_lock.hpp | 10
   trunk/boost/interprocess/sync/upgradable_lock.hpp | 8
   trunk/boost/interprocess/sync/xsi/xsi_named_mutex.hpp | 4
   trunk/boost/interprocess/windows_shared_memory.hpp | 4
   trunk/boost/interprocess/xsi_key.hpp | 2
   trunk/boost/interprocess/xsi_shared_memory.hpp | 4
   trunk/boost/intrusive/any_hook.hpp | 10
   trunk/boost/intrusive/avltree.hpp | 118 +++---
   trunk/boost/intrusive/avltree_algorithms.hpp | 104 +++---
   trunk/boost/intrusive/circular_list_algorithms.hpp | 56 +-
   trunk/boost/intrusive/circular_slist_algorithms.hpp | 40 +-
   trunk/boost/intrusive/derivation_value_traits.hpp | 10
   trunk/boost/intrusive/detail/any_node_and_algorithms.hpp | 145 ++++----
   trunk/boost/intrusive/detail/avltree_node.hpp | 68 ++-
   trunk/boost/intrusive/detail/common_slist_algorithms.hpp | 24
   trunk/boost/intrusive/detail/function_detector.hpp | 1
   trunk/boost/intrusive/detail/generic_hook.hpp | 22
   trunk/boost/intrusive/detail/hashtable_node.hpp | 51 +-
   trunk/boost/intrusive/detail/list_node.hpp | 38 +-
   trunk/boost/intrusive/detail/rbtree_node.hpp | 62 +-
   trunk/boost/intrusive/detail/slist_node.hpp | 28
   trunk/boost/intrusive/detail/tree_algorithms.hpp | 230 +++++++------
   trunk/boost/intrusive/detail/tree_node.hpp | 38 +-
   trunk/boost/intrusive/detail/utilities.hpp | 280 ++++++++++++----
   trunk/boost/intrusive/detail/workaround.hpp | 18
   trunk/boost/intrusive/hashtable.hpp | 356 +++++++++++++-------
   trunk/boost/intrusive/linear_slist_algorithms.hpp | 46 +-
   trunk/boost/intrusive/list.hpp | 28
   trunk/boost/intrusive/member_value_traits.hpp | 31 +
   trunk/boost/intrusive/rbtree.hpp | 105 +++---
   trunk/boost/intrusive/rbtree_algorithms.hpp | 107 +++---
   trunk/boost/intrusive/sgtree.hpp | 107 +++---
   trunk/boost/intrusive/sgtree_algorithms.hpp | 89 ++--
   trunk/boost/intrusive/slist.hpp | 55 +-
   trunk/boost/intrusive/splaytree.hpp | 108 +++---
   trunk/boost/intrusive/splaytree_algorithms.hpp | 147 ++++----
   trunk/boost/intrusive/treap.hpp | 118 +++---
   trunk/boost/intrusive/treap_algorithms.hpp | 99 +++--
   trunk/boost/intrusive/trivial_value_traits.hpp | 11
   trunk/boost/intrusive/unordered_set_hook.hpp | 59 +-
   trunk/boost/move/move.hpp | 113 ++++++
   196 files changed, 6162 insertions(+), 5241 deletions(-)

Added: trunk/boost/container/allocator/allocator_traits.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/container/allocator/allocator_traits.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,381 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Pablo Halpern 2009. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/container for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP
+#define BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
+#include <boost/container/allocator/memory_util.hpp>
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/move/move.hpp>
+#include <limits> //numeric_limits<>::max()
+#include <new> //placement new
+#include <memory> //std::allocator
+#include <boost/container/detail/preprocessor.hpp>
+
+///@cond
+
+namespace boost {
+namespace container {
+namespace container_detail {
+
+//workaround needed for C++03 compilers with no construct()
+//supporting rvalue references
+template<class A>
+struct is_std_allocator
+{ static const bool value = false; };
+
+template<class T>
+struct is_std_allocator< std::allocator<T> >
+{ static const bool value = true; };
+
+} //namespace container_detail {
+
+///@endcond
+
+template <typename Alloc>
+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<pointer>::rebind<const
+ //!
+ typedef unspecified const_pointer;
+ //!Non-standard extension
+ //!Alloc::reference if such a type exists; otherwise, value_type&
+ typedef unspecified pointer;
+ //!Non-standard extension
+ //!Alloc::const_reference if such a type exists ; otherwise, const value_type&
+ typedef unspecified const_pointer;
+ //!Alloc::void_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<void>.
+ //!
+ typedef unspecified void_pointer;
+ //!Alloc::const_void_pointer if such a type exists ; otherwis e, pointer_traits<pointer>::rebind<const
+ //!
+ typedef unspecified const_void_pointer;
+ //!Alloc::difference_type if such a type exists ; otherwise, pointer_traits<pointer>::difference_type.
+ //!
+ typedef unspecified difference_type;
+ //!Alloc::size_type if such a type exists ; otherwise, make_unsigned<difference_type>::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 <pre>value</pre> == 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 <pre>value</pre> == 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 <pre>value</pre> == false.
+ typedef unspecified propagate_on_container_swap;
+ //!Defines an allocator: Alloc::rebind<T>::other if such a type exists; otherwise, Alloc<T, Args>
+ //!if Alloc is a class template instantiation of the form Alloc<U, Args>, where Args is zero or
+ //!more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed.
+ //!
+ //!In C++03 compilers <pre>rebind_alloc</pre> is a struct derived from an allocator
+ //!deduced by previously detailed rules.
+ template <class T> using rebind_alloc = unspecified;
+
+ //!In C++03 compilers <pre>rebind_traits</pre> is a struct derived from
+ //!<pre>allocator_traits<OtherAlloc><pre>, where `OtherAlloc` is
+ //!the allocator deduced by rules explained in `rebind_alloc`.
+ template <class T> using rebind_traits = allocator_traits<rebind_alloc<T> >;
+
+ //!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 <class T>
+ struct portable_rebind_alloc
+ { typedef unspecified_type type; };
+ #else
+ //pointer
+ typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+ pointer, value_type*)
+ pointer;
+ //const_pointer
+ typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+ const_pointer, typename boost::intrusive::pointer_traits<pointer>::template
+ rebind_pointer<const value_type>::type)
+ const_pointer;
+ //reference
+ typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+ reference, value_type&)
+ reference;
+ //const_reference
+ typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+ const_reference, const value_type&)
+ const_reference;
+ //void_pointer
+ typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+ void_pointer, typename boost::intrusive::pointer_traits<pointer>::template
+ rebind_pointer<void>::type)
+ void_pointer;
+ //const_void_pointer
+ typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+ const_void_pointer, typename boost::intrusive::pointer_traits<pointer>::template
+ rebind_pointer<const void>::type)
+ const_void_pointer;
+ //difference_type
+ typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+ difference_type, std::ptrdiff_t)
+ difference_type;
+ //size_type
+ typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+ size_type, std::size_t)
+ size_type;
+ //propagate_on_container_copy_assignment
+ typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+ propagate_on_container_copy_assignment, boost::false_type)
+ propagate_on_container_copy_assignment;
+ //propagate_on_container_move_assignment
+ typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+ propagate_on_container_move_assignment, boost::false_type)
+ propagate_on_container_move_assignment;
+ //propagate_on_container_swap
+ typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+ propagate_on_container_swap, boost::false_type)
+ propagate_on_container_swap;
+
+ #if !defined(BOOST_NO_TEMPLATE_ALIASES)
+ //C++11
+ template <typename T> using rebind_alloc = boost::intrusive::detail::type_rebinder<Alloc, T>::type;
+ template <typename T> using rebind_traits = allocator_traits< rebind_alloc<T> >;
+ #else //!defined(BOOST_NO_TEMPLATE_ALIASES)
+ //Some workaround for C++03 or C++11 compilers with no template aliases
+ template <typename T>
+ struct rebind_alloc : boost::intrusive::detail::type_rebinder<Alloc,T>::type
+ {
+ typedef typename boost::intrusive::detail::type_rebinder<Alloc,T>::type Base;
+ #if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+ template <typename... Args>
+ rebind_alloc(Args&&... args)
+ : Base(boost::forward<Args>(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 <typename T>
+ struct rebind_traits
+ : allocator_traits<typename boost::intrusive::detail::type_rebinder<Alloc, T>::type>
+ {};
+ #endif //!defined(BOOST_NO_TEMPLATE_ALIASES)
+ template <class T>
+ struct portable_rebind_alloc
+ { typedef typename boost::intrusive::detail::type_rebinder<Alloc, T>::type type; };
+ #endif //BOOST_CONTAINER_DOXYGEN_INVOKED
+
+ //!<b>Returns</b>: a.allocate(n)
+ //!
+ static pointer allocate(Alloc &a, size_type n)
+ { return a.allocate(n); }
+
+ //!<b>Returns</b>: a.deallocate(p, n)
+ //!
+ //!<b>Throws</b>: Nothing
+ static void deallocate(Alloc &a, pointer p, size_type n)
+ { return a.deallocate(p, n); }
+
+ //!<b>Effects</b>: calls `a.construct(p, std::forward<Args>(args)...)` if that call is well-formed;
+ //!otherwise, invokes `::new (static_cast<void*>(p)) T(std::forward<Args>(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
+ <Alloc, const size_type, const const_void_pointer>::value;
+ ::boost::integral_constant<bool, value> flag;
+ return allocator_traits::priv_allocate(flag, a, n, p);
+ }
+
+ //!<b>Effects</b>: calls a.destroy(p) if that call is well-formed;
+ //!otherwise, invokes `p->~T()`.
+ template<class T>
+ static void destroy(Alloc &a, T*p)
+ {
+ typedef T* destroy_pointer;
+ const bool value = boost::container::container_detail::
+ has_member_function_callable_with_destroy
+ <Alloc, const destroy_pointer>::value;
+ ::boost::integral_constant<bool, value> flag;
+ allocator_traits::priv_destroy(flag, a, p);
+ }
+
+ //!<b>Returns</b>: a.max_size() if that expression is well-formed; otherwise,
+ //!`numeric_limits<size_type>::max()`.
+ static size_type max_size(const Alloc &a)
+ {
+ const bool value = boost::container::container_detail::
+ has_member_function_callable_with_max_size
+ <const Alloc>::value;
+ ::boost::integral_constant<bool, value> flag;
+ return allocator_traits::priv_max_size(flag, a);
+ }
+
+ //!<b>Returns</b>: 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
+ <const Alloc>::value;
+ ::boost::integral_constant<bool, value> 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>(args)...) if that call is well-formed;
+ //!otherwise, invokes `::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)`
+ template <class T, class ...Args>
+ static void construct(Alloc & a, T* p, Args&&... args)
+ {
+ ::boost::integral_constant<bool, container_detail::is_std_allocator<Alloc>::value> flag;
+ allocator_traits::priv_construct(flag, a, p, ::boost::forward<Args>(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<class T>
+ static void priv_destroy(boost::true_type, Alloc &a, T* p)
+ { a.destroy(p); }
+
+ template<class T>
+ 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<size_type>::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<class T, class ...Args>
+ 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<bool, value> flag;
+ priv_construct_dispatch2(flag, a, p, ::boost::forward<Args>(args)...);
+ }
+
+ template<class T, class ...Args>
+ static void priv_construct(boost::true_type, Alloc &a, T *p, Args && ...args)
+ {
+ priv_construct_dispatch2(boost::false_type(), a, p, ::boost::forward<Args>(args)...);
+ }
+
+ template<class T, class ...Args>
+ static void priv_construct_dispatch2(boost::true_type, Alloc &a, T *p, Args && ...args)
+ { a.construct( p, ::boost::forward<Args>(args)...); }
+
+ template<class T, class ...Args>
+ static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p, Args && ...args)
+ { ::new((void*)p) T(::boost::forward<Args>(args)...); }
+ #else
+ public:
+ #define BOOST_PP_LOCAL_MACRO(n) \
+ template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \
+ static void construct(Alloc &a, T *p \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { \
+ ::boost::integral_constant<bool, container_detail::is_std_allocator<Alloc>::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<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \
+ 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<bool, value> flag; \
+ priv_construct_dispatch2(flag, a, p \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \
+ } \
+ \
+ template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \
+ 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<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \
+ 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<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \
+ 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 <boost/container/detail/config_end.hpp>
+
+#endif // ! defined(BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP)

Added: trunk/boost/container/allocator/memory_util.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/container/allocator/memory_util.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,77 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/container for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP
+#define BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+#include <boost/container/detail/preprocessor.hpp>
+#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
+
+
+#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, <boost/intrusive/detail/has_member_function_callable_with.hpp>))
+#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, <boost/intrusive/detail/has_member_function_callable_with.hpp>))
+#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, <boost/intrusive/detail/has_member_function_callable_with.hpp>))
+#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, <boost/intrusive/detail/has_member_function_callable_with.hpp>))
+#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, <boost/intrusive/detail/has_member_function_callable_with.hpp>))
+#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 <boost/container/detail/config_end.hpp>
+
+#endif // ! defined(BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP)

Added: trunk/boost/container/allocator/scoped_allocator.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/container/allocator/scoped_allocator.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,651 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Pablo Halpern 2009. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/container for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP
+#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+#include <boost/container/allocator/allocator_traits.hpp>
+#include <boost/type_traits.hpp>
+#include <utility>
+
+namespace boost { namespace container {
+
+template <typename OuterAlloc, typename... InnerAllocs>
+class scoped_allocator_adaptor;
+
+template <typename OuterAlloc, typename... InnerAllocs>
+scoped_allocator_adaptor<OuterAlloc, InnerAllocs...> make_scoped();
+
+template <typename OuterAlloc, typename... InnerAllocs>
+class scoped_allocator_adaptor_base : public OuterAlloc
+{
+ typedef allocator_traits<OuterAlloc> OuterTraits;
+
+public:
+ // Workaround for inability of gcc-4.4.1 to expand InnerAllocs...
+// typedef scoped_allocator_adaptor<InnerAllocs...> inner_allocator_type;
+ typedef decltype(make_scoped<InnerAllocs...>()) inner_allocator_type;
+
+ scoped_allocator_adaptor_base();
+
+ template <typename OuterA2>
+ scoped_allocator_adaptor_base(OuterA2&& outerAlloc, const InnerAllocs&... innerAllocs);
+
+ template <typename OuterA2>
+ scoped_allocator_adaptor_base(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other);
+ template <typename OuterA2>
+ scoped_allocator_adaptor_base(scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& 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<OuterAlloc, InnerAllocs...>
+ 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 <typename OuterAlloc>
+class scoped_allocator_adaptor_base<OuterAlloc> : public OuterAlloc
+{
+ typedef allocator_traits<OuterAlloc> OuterTraits;
+public:
+ typedef scoped_allocator_adaptor<OuterAlloc> inner_allocator_type;
+
+ scoped_allocator_adaptor_base();
+
+ template <typename OuterA2>
+ scoped_allocator_adaptor_base(OuterA2&& outerAlloc);
+
+ template <typename OuterA2>
+ scoped_allocator_adaptor_base(const scoped_allocator_adaptor<OuterA2>& other);
+ template <typename OuterA2>
+ scoped_allocator_adaptor_base(scoped_allocator_adaptor<OuterA2>&& other);
+
+ inner_allocator_type& inner_allocator()
+ { return static_cast<inner_allocator_type&>(*this); }
+
+ inner_allocator_type const& inner_allocator() const
+ { return static_cast<const inner_allocator_type&>(*this); }
+
+ // Allocator propagation functions.
+ scoped_allocator_adaptor<OuterAlloc>
+ 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 <typename OuterAlloc, typename... InnerAllocs>
+class scoped_allocator_adaptor
+ : public scoped_allocator_adaptor_base<OuterAlloc, InnerAllocs...>
+{
+ typedef scoped_allocator_adaptor_base<OuterAlloc, InnerAllocs...> _Base;
+ typedef allocator_traits<OuterAlloc> _Traits;
+
+public:
+ typedef OuterAlloc outer_allocator_type;
+ typedef typename _Base::inner_allocator_type inner_allocator_type;
+
+ typedef typename allocator_traits<OuterAlloc>::size_type size_type;
+ typedef typename allocator_traits<OuterAlloc>::difference_type difference_type;
+ typedef typename allocator_traits<OuterAlloc>::pointer pointer;
+ typedef typename allocator_traits<OuterAlloc>::const_pointer const_pointer;
+ typedef typename allocator_traits<OuterAlloc>::void_pointer void_pointer;
+ typedef typename allocator_traits<OuterAlloc>::const_void_pointer const_void_pointer;
+ typedef typename allocator_traits<OuterAlloc>::value_type value_type;
+
+ template <typename Tp>
+ struct rebind {
+ typedef typename allocator_traits<OuterAlloc>::template rebind_traits<Tp> rebound_traits;
+ typedef typename rebound_traits::allocator_type rebound_outer; // exposition only
+ typedef scoped_allocator_adaptor<rebound_outer, InnerAllocs...> other;
+ };
+
+ scoped_allocator_adaptor();
+ scoped_allocator_adaptor(const scoped_allocator_adaptor& other);
+
+ template <typename OuterA2>
+ scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other);
+ template <typename OuterA2>
+ scoped_allocator_adaptor(scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other);
+
+ template <typename OuterA2>
+ 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 <typename T, typename... Args>
+ void construct(T* p, Args&&... args);
+
+ // Specializations to pass inner_allocator to pair::first and pair::second
+ template <class T1, class T2>
+ void construct(std::pair<T1,T2>* p);
+ template <class T1, class T2, class U, class V>
+ void construct(std::pair<T1,T2>* p, U&& x, V&& y);
+ template <class T1, class T2, class U, class V>
+ void construct(std::pair<T1,T2>* p, const std::pair<U, V>& pr);
+ template <class T1, class T2, class U, class V>
+ void construct(std::pair<T1,T2>* p, std::pair<U, V>&& pr);
+
+ template <typename T>
+ void destroy(T* p);
+};
+
+template <typename OuterA1, typename OuterA2, typename... InnerAllocs>
+inline
+bool operator==(const scoped_allocator_adaptor<OuterA1,InnerAllocs...>& a,
+ const scoped_allocator_adaptor<OuterA2,InnerAllocs...>& b);
+
+template <typename OuterA1, typename OuterA2, typename... InnerAllocs>
+inline
+bool operator!=(const scoped_allocator_adaptor<OuterA1,InnerAllocs...>& a,
+ const scoped_allocator_adaptor<OuterA2,InnerAllocs...>& b);
+
+///////////////////////////////////////////////////////////////////////////////
+// Implementation of scoped_allocator_adaptor_base<OuterAlloc, InnerAllocs...>
+///////////////////////////////////////////////////////////////////////////////
+
+template <typename OuterAlloc, typename... InnerAllocs>
+inline
+scoped_allocator_adaptor_base<OuterAlloc, InnerAllocs...>::
+ scoped_allocator_adaptor_base()
+{
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+ template <typename OuterA2>
+ scoped_allocator_adaptor_base<OuterAlloc, InnerAllocs...>::
+ scoped_allocator_adaptor_base(OuterA2&& outerAlloc,
+ const InnerAllocs&... innerAllocs)
+ : OuterAlloc(std::forward<OuterA2>(outerAlloc))
+ , _M_inner_allocs(innerAllocs...)
+{
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+ template <typename OuterA2>
+ scoped_allocator_adaptor_base<OuterAlloc, InnerAllocs...>::
+ scoped_allocator_adaptor_base(
+ const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other)
+ : OuterAlloc(other.outer_allocator())
+ , _M_inner_allocs(other.inner_allocator())
+{
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+ template <typename OuterA2>
+ scoped_allocator_adaptor_base<OuterAlloc, InnerAllocs...>::
+ scoped_allocator_adaptor_base(
+ scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other)
+ : OuterAlloc(std::move(other.outer_allocator()))
+ , _M_inner_allocs(std::move(other.inner_allocator()))
+{
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+inline
+scoped_allocator_adaptor<OuterAlloc,InnerAllocs...>
+scoped_allocator_adaptor_base<OuterAlloc,InnerAllocs...>::
+ select_on_container_copy_construction() const
+{
+ return scoped_allocator_adaptor<OuterAlloc,InnerAllocs...>(
+ allocator_traits<OuterAlloc>::select_on_container_copy_construction(
+ this->outer_allocator()),
+ allocator_traits<inner_allocator_type>::select_on_container_copy_construction(
+ this->inner_allocator()));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Implementation of scoped_allocator_adaptor_base<OuterAlloc> specialization
+///////////////////////////////////////////////////////////////////////////////
+
+template <typename OuterAlloc>
+inline
+scoped_allocator_adaptor_base<OuterAlloc>::
+ scoped_allocator_adaptor_base()
+{
+}
+
+template <typename OuterAlloc>
+ template <typename OuterA2>
+ scoped_allocator_adaptor_base<OuterAlloc>::
+ scoped_allocator_adaptor_base(OuterA2&& outerAlloc)
+ : OuterAlloc(std::forward<OuterA2>(outerAlloc))
+{
+}
+
+template <typename OuterAlloc>
+ template <typename OuterA2>
+ scoped_allocator_adaptor_base<OuterAlloc>::
+ scoped_allocator_adaptor_base(
+ const scoped_allocator_adaptor<OuterA2>& other)
+ : OuterAlloc(other.outer_allocator())
+{
+}
+
+template <typename OuterAlloc>
+ template <typename OuterA2>
+ scoped_allocator_adaptor_base<OuterAlloc>::
+ scoped_allocator_adaptor_base(
+ scoped_allocator_adaptor<OuterA2>&& other)
+ : OuterAlloc(std::move(other.outer_allocator()))
+{
+}
+
+// template <typename OuterAlloc>
+// inline
+// scoped_allocator_adaptor<OuterAlloc>&
+// scoped_allocator_adaptor_base<OuterAlloc>::inner_allocator()
+// {
+// return *this;
+// }
+
+// template <typename OuterAlloc>
+// inline
+// scoped_allocator_adaptor<OuterAlloc> const&
+// scoped_allocator_adaptor_base<OuterAlloc>::inner_allocator() cosnt
+// {
+// return *this;
+// }
+
+template <typename OuterAlloc>
+inline
+scoped_allocator_adaptor<OuterAlloc>
+scoped_allocator_adaptor_base<OuterAlloc>::
+select_on_container_copy_construction() const
+{
+ return
+ allocator_traits<OuterAlloc>::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 <typename _Tp, typename... _Args>
+ 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 <typename _Tp, typename... _Args>
+ auto __has_ctor(_LowPriorityConversion<int>, _Args&&...) ->
+ std::false_type
+ { return std::false_type(); }
+
+ template <typename _Alloc>
+ struct __is_scoped_allocator_imp {
+ template <typename T>
+ static char test(int, typename T::outer_allocator_type*);
+ template <typename T>
+ static int test(_LowPriorityConversion<int>, void*);
+ static const bool value = (1 == sizeof(test<_Alloc>(0, 0)));
+ };
+
+ template <typename _Alloc>
+ struct __is_scoped_allocator
+ : std::integral_constant<bool, __is_scoped_allocator_imp<_Alloc>::value>
+ {
+ };
+
+#if 0
+ // Called when outer_allocator_type is not a scoped allocator
+ // (recursion stop).
+ template <typename _Alloc>
+ inline
+ auto __outermost_alloc(_LowPriorityConversion<int>, _Alloc& __a) ->
+ _Alloc&
+ {
+ return __a;
+ }
+
+ // Called when outer_allocator_type is a scoped allocator to
+ // return the outermost allocator type.
+ template <typename _Alloc>
+ inline auto __outermost_alloc(int, _Alloc& __a) ->
+ decltype(__outermost_alloc(0,__a.outer_allocator()))
+ {
+ return __a.outer_allocator();
+ }
+#endif
+
+ template <typename _Ignore, typename _OuterAlloc,
+ typename _InnerAlloc, typename _Tp, typename... _Args>
+ 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 <typename _OuterAlloc,
+ typename _InnerAlloc, typename _Tp, typename... _Args>
+ 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 <typename _OuterAlloc,
+ typename _InnerAlloc, typename _Tp, typename... _Args>
+ 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 <typename _OuterAlloc, typename _InnerAlloc,
+ typename _Tp, typename... _Args>
+ 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 <typename _OuterAlloc, typename _InnerAlloc,
+ typename _Tp, typename... _Args>
+ 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<outerouter>(),
+ __outer_alloc.outer_allocator(),
+ __inner_alloc,
+ __p, std::forward<_Args>(__args)...);
+ }
+
+} // end namespace __details
+
+///////////////////////////////////////////////////////////////////////////////
+// Implementation of scoped_allocator_adaptor
+///////////////////////////////////////////////////////////////////////////////
+
+template <typename OuterAlloc, typename... InnerAllocs>
+scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>::
+ scoped_allocator_adaptor()
+{
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>::
+ scoped_allocator_adaptor(const scoped_allocator_adaptor& other)
+ : _Base(other)
+{
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+ template <typename OuterA2>
+ scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>::
+ scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2,
+ InnerAllocs...>& other)
+ : _Base(other)
+{
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+ template <typename OuterA2>
+ scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>::
+ scoped_allocator_adaptor(scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other)
+ : _Base(std::move(other))
+{
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+ template <typename OuterA2>
+ scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>::
+ scoped_allocator_adaptor(OuterA2&& outerAlloc, const InnerAllocs&... innerAllocs)
+ : _Base(std::forward<OuterA2>(outerAlloc), innerAllocs...)
+{
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>::
+ ~scoped_allocator_adaptor()
+{
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+inline typename allocator_traits<OuterAlloc>::pointer
+scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>::
+ allocate(size_type n)
+{
+ return allocator_traits<OuterAlloc>::allocate(outer_allocator(), n);
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+inline typename allocator_traits<OuterAlloc>::pointer
+scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>::
+ allocate(size_type n, const_void_pointer hint)
+{
+ return allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint);
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+inline void scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>::
+ deallocate(pointer p, size_type n)
+{
+ allocator_traits<OuterAlloc>::deallocate(outer_allocator(), p, n);
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+inline typename allocator_traits<OuterAlloc>::size_type
+scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>::max_size() const
+{
+ return allocator_traits<OuterAlloc>::max_size(outer_allocator());
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+ template <typename T>
+ inline void scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>::
+ destroy(T* p)
+{
+ allocator_traits<OuterAlloc>::destroy(outer_allocator(), p);
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+ template <typename T, typename... Args>
+ inline
+ void scoped_allocator_adaptor<OuterAlloc,InnerAllocs...>::construct(T* p,
+ Args&&... args)
+{
+ __do_scoped_construct(__details::__is_scoped_allocator<OuterAlloc>(),
+ this->outer_allocator(), this->inner_allocator(),
+ p, std::forward<Args>(args)...);
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+ template <class T1, class T2>
+ void scoped_allocator_adaptor<OuterAlloc,InnerAllocs...>::construct(
+ std::pair<T1,T2>* p)
+{
+ construct(addressof(p->first));
+ try {
+ construct(addressof(p->second));
+ }
+ catch (...) {
+ destroy(addressof(p->first));
+ throw;
+ }
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+ template <class T1, class T2, class U, class V>
+ void scoped_allocator_adaptor<OuterAlloc,InnerAllocs...>::construct(
+ std::pair<T1,T2>* p, U&& x, V&& y)
+{
+ construct(addressof(p->first), std::forward<U>(x));
+ try {
+ construct(addressof(p->second), std::forward<V>(y));
+ }
+ catch (...) {
+ destroy(addressof(p->first));
+ throw;
+ }
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+ template <class T1, class T2, class U, class V>
+ void scoped_allocator_adaptor<OuterAlloc,InnerAllocs...>::construct(
+ std::pair<T1,T2>* p, const std::pair<U, V>& pr)
+{
+ construct(addressof(p->first), pr.first);
+ try {
+ construct(addressof(p->second), pr.second);
+ }
+ catch (...) {
+ destroy(addressof(p->first));
+ throw;
+ }
+}
+
+template <typename OuterAlloc, typename... InnerAllocs>
+ template <class T1, class T2, class U, class V>
+ void scoped_allocator_adaptor<OuterAlloc,InnerAllocs...>::construct(
+ std::pair<T1,T2>* p, std::pair<U, V>&& 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 <typename OuterA1, typename OuterA2, typename... InnerAllocs>
+inline
+bool operator==(const scoped_allocator_adaptor<OuterA1,InnerAllocs...>& a,
+ const scoped_allocator_adaptor<OuterA2,InnerAllocs...>& b)
+{
+ return a.outer_allocator() == b.outer_allocator()
+ && a.inner_allocator() == b.inner_allocator();
+}
+
+template <typename OuterA1, typename OuterA2>
+inline
+bool operator==(const scoped_allocator_adaptor<OuterA1>& a,
+ const scoped_allocator_adaptor<OuterA2>& b)
+{
+ return a.outer_allocator() == b.outer_allocator();
+}
+
+template <typename OuterA1, typename OuterA2, typename... InnerAllocs>
+inline
+bool operator!=(const scoped_allocator_adaptor<OuterA1,InnerAllocs...>& a,
+ const scoped_allocator_adaptor<OuterA2,InnerAllocs...>& b)
+{
+ return ! (a == b);
+}
+
+}} // namespace boost { namespace container {
+
+#include <boost/container/detail/config_end.hpp>
+
+#endif // BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP

Modified: trunk/boost/container/container_fwd.hpp
==============================================================================
--- trunk/boost/container/container_fwd.hpp (original)
+++ trunk/boost/container/container_fwd.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_CONTAINERS_FWD_HPP
-#define BOOST_CONTAINERS_CONTAINERS_FWD_HPP
+#ifndef BOOST_CONTAINER_CONTAINER_FWD_HPP
+#define BOOST_CONTAINER_CONTAINER_FWD_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -26,7 +26,7 @@
    //Create namespace to avoid compilation errors
 }}
 
-namespace boost{ namespace container{ namespace containers_detail{
+namespace boost{ namespace container{ namespace container_detail{
 
 namespace bi = boost::intrusive;
 
@@ -195,4 +195,4 @@
 
 }} //namespace boost { namespace container {
 
-#endif //#ifndef BOOST_CONTAINERS_CONTAINERS_FWD_HPP
+#endif //#ifndef BOOST_CONTAINER_CONTAINER_FWD_HPP

Modified: trunk/boost/container/deque.hpp
==============================================================================
--- trunk/boost/container/deque.hpp (original)
+++ trunk/boost/container/deque.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -30,8 +30,8 @@
 // representations about the suitability of this software for any
 // purpose. It is provided "as is" without express or implied warranty.
 
-#ifndef BOOST_CONTAINERS_DEQUE_HPP
-#define BOOST_CONTAINERS_DEQUE_HPP
+#ifndef BOOST_CONTAINER_DEQUE_HPP
+#define BOOST_CONTAINER_DEQUE_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -44,6 +44,7 @@
 #include <boost/container/detail/iterators.hpp>
 #include <boost/container/detail/algorithms.hpp>
 #include <boost/container/detail/mpl.hpp>
+#include <boost/container/allocator/allocator_traits.hpp>
 #include <boost/container/container_fwd.hpp>
 #include <cstddef>
 #include <iterator>
@@ -83,8 +84,8 @@
    static const bool trivial_copy = has_trivial_copy<value_type>::value;
    static const bool nothrow_copy = has_nothrow_copy<value_type>::value;
    static const bool trivial_assign = has_trivial_assign<value_type>::value;
- static const bool nothrow_assign = has_nothrow_assign<value_type>::value;
-
+ //static const bool nothrow_assign = has_nothrow_assign<value_type>::value;
+ static const bool nothrow_assign = false;
 };
 
 // Note: this function is simply a kludge to work around several compilers'
@@ -98,31 +99,32 @@
 template <class T, class A>
 class deque_base
 {
+ BOOST_COPYABLE_AND_MOVABLE(deque_base)
    public:
- typedef typename A::value_type val_alloc_val;
- typedef typename A::pointer val_alloc_ptr;
- typedef typename A::const_pointer val_alloc_cptr;
- typedef typename A::reference val_alloc_ref;
- typedef typename A::const_reference val_alloc_cref;
- typedef typename A::difference_type val_alloc_diff;
- typedef typename A::size_type val_alloc_size;
- typedef typename A::template rebind
- <typename A::pointer>::other ptr_alloc_t;
- typedef typename ptr_alloc_t::value_type ptr_alloc_val;
- typedef typename ptr_alloc_t::pointer ptr_alloc_ptr;
- typedef typename ptr_alloc_t::const_pointer ptr_alloc_cptr;
- typedef typename ptr_alloc_t::reference ptr_alloc_ref;
- typedef typename ptr_alloc_t::const_reference ptr_alloc_cref;
- typedef typename A::template
- rebind<T>::other allocator_type;
- typedef allocator_type stored_allocator_type;
- typedef val_alloc_size size_type;
+ typedef allocator_traits<A> val_alloc_traits_type;
+ typedef typename val_alloc_traits_type::value_type val_alloc_val;
+ typedef typename val_alloc_traits_type::pointer val_alloc_ptr;
+ typedef typename val_alloc_traits_type::const_pointer val_alloc_cptr;
+ typedef typename val_alloc_traits_type::reference val_alloc_ref;
+ typedef typename val_alloc_traits_type::const_reference val_alloc_cref;
+ typedef typename val_alloc_traits_type::difference_type val_alloc_diff;
+ typedef typename val_alloc_traits_type::size_type val_alloc_size;
+ typedef typename val_alloc_traits_type::template
+ portable_rebind_alloc<val_alloc_ptr>::type ptr_alloc_t;
+ typedef allocator_traits<ptr_alloc_t> ptr_alloc_traits_type;
+ typedef typename ptr_alloc_traits_type::value_type ptr_alloc_val;
+ typedef typename ptr_alloc_traits_type::pointer ptr_alloc_ptr;
+ typedef typename ptr_alloc_traits_type::const_pointer ptr_alloc_cptr;
+ typedef typename ptr_alloc_traits_type::reference ptr_alloc_ref;
+ typedef typename ptr_alloc_traits_type::const_reference ptr_alloc_cref;
+ typedef A allocator_type;
+ typedef allocator_type stored_allocator_type;
+ typedef val_alloc_size size_type;
 
    protected:
 
- typedef deque_value_traits<T, A> traits_t;
- typedef typename A::template
- rebind<typename A::pointer>::other map_allocator_type;
+ typedef deque_value_traits<T, A> traits_t;
+ typedef ptr_alloc_t map_allocator_type;
 
    static size_type s_buffer_size() { return deque_buf_size(sizeof(T)); }
 
@@ -373,7 +375,7 @@
          { return static_cast<const const_iterator&>(*this) - right; }
    };
 
- deque_base(const allocator_type& a, size_type num_elements)
+ deque_base(size_type num_elements, const allocator_type& a)
       : members_(a)
    { this->priv_initialize_map(num_elements); }
 
@@ -381,6 +383,15 @@
       : members_(a)
    {}
 
+ deque_base()
+ : members_()
+ {}
+
+ explicit deque_base(BOOST_RV_REF(deque_base) x)
+ : members_( boost::move(x.ptr_alloc())
+ , boost::move(x.alloc()) )
+ {}
+
    ~deque_base()
    {
       if (this->members_.m_map) {
@@ -394,12 +405,20 @@
   
    protected:
 
+ void swap_members(deque_base &x)
+ {
+ std::swap(this->members_.m_start, x.members_.m_start);
+ std::swap(this->members_.m_finish, x.members_.m_finish);
+ std::swap(this->members_.m_map, x.members_.m_map);
+ std::swap(this->members_.m_map_size, x.members_.m_map_size);
+ }
+
    void priv_initialize_map(size_type num_elements)
    {
 // if(num_elements){
          size_type num_nodes = num_elements / s_buffer_size() + 1;
 
- this->members_.m_map_size = containers_detail::max_value((size_type) InitialMapSize, num_nodes + 2);
+ this->members_.m_map_size = container_detail::max_value((size_type) InitialMapSize, num_nodes + 2);
          this->members_.m_map = this->priv_allocate_map(this->members_.m_map_size);
 
          ptr_alloc_ptr nstart = this->members_.m_map + (this->members_.m_map_size - num_nodes) / 2;
@@ -463,14 +482,28 @@
       : public ptr_alloc_t
       , public allocator_type
    {
- members_holder(const allocator_type &a)
+ members_holder()
+ : map_allocator_type(), allocator_type()
+ , m_map(0), m_map_size(0)
+ , m_start(), m_finish(m_start)
+ {}
+
+ explicit members_holder(const allocator_type &a)
          : map_allocator_type(a), allocator_type(a)
          , m_map(0), m_map_size(0)
          , m_start(), m_finish(m_start)
       {}
 
+ template<class ValAllocConvertible, class PtrAllocConvertible>
+ members_holder(BOOST_FWD_REF(PtrAllocConvertible) pa, BOOST_FWD_REF(ValAllocConvertible) va)
+ : map_allocator_type(boost::forward<PtrAllocConvertible>(pa))
+ , allocator_type (boost::forward<ValAllocConvertible>(va))
+ , m_map(0), m_map_size(0)
+ , m_start(), m_finish(m_start)
+ {}
+
       ptr_alloc_ptr m_map;
- typename allocator_type::size_type m_map_size;
+ val_alloc_size m_map_size;
       iterator m_start;
       iterator m_finish;
    } members_;
@@ -499,26 +532,25 @@
 class deque : protected deque_base<T, A>
 {
    /// @cond
- typedef deque_base<T, A> Base;
-
- public: // Basic types
- typedef typename A::value_type val_alloc_val;
- typedef typename A::pointer val_alloc_ptr;
- typedef typename A::const_pointer val_alloc_cptr;
- typedef typename A::reference val_alloc_ref;
- typedef typename A::const_reference val_alloc_cref;
- typedef typename A::size_type val_alloc_size;
- typedef typename A::difference_type val_alloc_diff;
-
- typedef typename A::template
- rebind<val_alloc_ptr>::other ptr_alloc_t;
- typedef typename ptr_alloc_t::value_type ptr_alloc_val;
- typedef typename ptr_alloc_t::pointer ptr_alloc_ptr;
- typedef typename ptr_alloc_t::const_pointer ptr_alloc_cptr;
- typedef typename ptr_alloc_t::reference ptr_alloc_ref;
- typedef typename ptr_alloc_t::const_reference ptr_alloc_cref;
+ private:
+ typedef deque_base<T, A> Base;
+ typedef typename Base::val_alloc_val val_alloc_val;
+ typedef typename Base::val_alloc_ptr val_alloc_ptr;
+ typedef typename Base::val_alloc_cptr val_alloc_cptr;
+ typedef typename Base::val_alloc_ref val_alloc_ref;
+ typedef typename Base::val_alloc_cref val_alloc_cref;
+ typedef typename Base::val_alloc_size val_alloc_size;
+ typedef typename Base::val_alloc_diff val_alloc_diff;
+
+ typedef typename Base::ptr_alloc_t ptr_alloc_t;
+ typedef typename Base::ptr_alloc_val ptr_alloc_val;
+ typedef typename Base::ptr_alloc_ptr ptr_alloc_ptr;
+ typedef typename Base::ptr_alloc_cptr ptr_alloc_cptr;
+ typedef typename Base::ptr_alloc_ref ptr_alloc_ref;
+ typedef typename Base::ptr_alloc_cref ptr_alloc_cref;
    /// @endcond
 
+ public: // Basic types
    typedef T value_type;
    typedef val_alloc_ptr pointer;
    typedef val_alloc_cptr const_pointer;
@@ -535,6 +567,8 @@
    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
    typedef std::reverse_iterator<iterator> reverse_iterator;
 
+ typedef allocator_type stored_allocator_type;
+
    /// @cond
 
    private: // Internal typedefs
@@ -542,27 +576,49 @@
    typedef ptr_alloc_ptr index_pointer;
    static size_type s_buffer_size()
       { return Base::s_buffer_size(); }
- typedef containers_detail::advanced_insert_aux_int<value_type, iterator> advanced_insert_aux_int_t;
+ typedef container_detail::advanced_insert_aux_int<iterator> advanced_insert_aux_int_t;
    typedef repeat_iterator<T, difference_type> r_iterator;
- typedef boost::move_iterator<r_iterator> move_it;
+ typedef boost::move_iterator<r_iterator> move_it;
+ typedef allocator_traits<A> allocator_traits_type;
 
    /// @endcond
 
+ public:
+
    //! <b>Effects</b>: Returns a copy of the internal allocator.
    //!
    //! <b>Throws</b>: If allocator's copy constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- allocator_type get_allocator() const { return Base::alloc(); }
+ allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
+ { return Base::alloc(); }
+
+ //! <b>Effects</b>: Returns a reference to the internal allocator.
+ //!
+ //! <b>Throws</b>: Nothing
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
+ //! <b>Note</b>: Non-standard extension.
+ const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+ { return Base::alloc(); }
 
- public: // Basic accessors
+ //! <b>Effects</b>: Returns a reference to the internal allocator.
+ //!
+ //! <b>Throws</b>: Nothing
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
+ //! <b>Note</b>: Non-standard extension.
+ stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
+ { return Base::alloc(); }
 
    //! <b>Effects</b>: Returns an iterator to the first element contained in the deque.
    //!
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- iterator begin()
+ iterator begin() BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_start; }
 
    //! <b>Effects</b>: Returns an iterator to the end of the deque.
@@ -570,7 +626,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- iterator end()
+ iterator end() BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_finish; }
 
    //! <b>Effects</b>: Returns a const_iterator to the first element contained in the deque.
@@ -578,7 +634,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_iterator begin() const
+ const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_start; }
 
    //! <b>Effects</b>: Returns a const_iterator to the end of the deque.
@@ -586,7 +642,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_iterator end() const
+ const_iterator end() const BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_finish; }
 
    //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
@@ -595,7 +651,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- reverse_iterator rbegin()
+ reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
       { return reverse_iterator(this->members_.m_finish); }
 
    //! <b>Effects</b>: Returns a reverse_iterator pointing to the end
@@ -604,7 +660,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- reverse_iterator rend()
+ reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
       { return reverse_iterator(this->members_.m_start); }
 
    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
@@ -613,7 +669,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_reverse_iterator rbegin() const
+ const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
       { return const_reverse_iterator(this->members_.m_finish); }
 
    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
@@ -622,7 +678,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_reverse_iterator rend() const
+ const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
       { return const_reverse_iterator(this->members_.m_start); }
 
    //! <b>Effects</b>: Returns a const_iterator to the first element contained in the deque.
@@ -630,7 +686,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_iterator cbegin() const
+ const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_start; }
 
    //! <b>Effects</b>: Returns a const_iterator to the end of the deque.
@@ -638,7 +694,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_iterator cend() const
+ const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_finish; }
 
    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
@@ -647,7 +703,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_reverse_iterator crbegin() const
+ const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
       { return const_reverse_iterator(this->members_.m_finish); }
 
    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
@@ -656,7 +712,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_reverse_iterator crend() const
+ const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
       { return const_reverse_iterator(this->members_.m_start); }
 
    //! <b>Requires</b>: size() < n.
@@ -667,7 +723,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- reference operator[](size_type n)
+ reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_start[difference_type(n)]; }
 
    //! <b>Requires</b>: size() < n.
@@ -678,7 +734,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_reference operator[](size_type n) const
+ const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_start[difference_type(n)]; }
 
    //! <b>Requires</b>: size() < n.
@@ -711,7 +767,8 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- reference front() { return *this->members_.m_start; }
+ reference front() BOOST_CONTAINER_NOEXCEPT
+ { return *this->members_.m_start; }
 
    //! <b>Requires</b>: !empty()
    //!
@@ -721,7 +778,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_reference front() const
+ const_reference front() const BOOST_CONTAINER_NOEXCEPT
       { return *this->members_.m_start; }
 
    //! <b>Requires</b>: !empty()
@@ -732,7 +789,8 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- reference back() { return *(end()-1); }
+ reference back() BOOST_CONTAINER_NOEXCEPT
+ { return *(end()-1); }
 
    //! <b>Requires</b>: !empty()
    //!
@@ -742,14 +800,15 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_reference back() const { return *(cend()-1); }
+ const_reference back() const BOOST_CONTAINER_NOEXCEPT
+ { return *(cend()-1); }
 
    //! <b>Effects</b>: Returns the number of the elements contained in the deque.
    //!
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- size_type size() const
+ size_type size() const BOOST_CONTAINER_NOEXCEPT
       { return this->members_.m_finish - this->members_.m_start; }
 
    //! <b>Effects</b>: Returns the largest possible size of the deque.
@@ -757,23 +816,32 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- size_type max_size() const
- { return this->alloc().max_size(); }
+ size_type max_size() const BOOST_CONTAINER_NOEXCEPT
+ { return allocator_traits_type::max_size(this->alloc()); }
 
    //! <b>Effects</b>: Returns true if the deque contains no elements.
    //!
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- bool empty() const
+ bool empty() const BOOST_CONTAINER_NOEXCEPT
    { return this->members_.m_finish == this->members_.m_start; }
 
+ //! <b>Effects</b>: Default constructors a deque.
+ //!
+ //! <b>Throws</b>: If allocator_type's default constructor throws.
+ //!
+ //! <b>Complexity</b>: Constant.
+ deque()
+ : Base()
+ {}
+
    //! <b>Effects</b>: Constructs a deque taking the allocator as parameter.
    //!
    //! <b>Throws</b>: If allocator_type's copy constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- explicit deque(const allocator_type& a = allocator_type())
+ explicit deque(const allocator_type& a)
       : Base(a)
    {}
 
@@ -784,10 +852,11 @@
    //! throws or T's default or copy constructor throws.
    //!
    //! <b>Complexity</b>: Linear to n.
- explicit deque(size_type n) : Base(allocator_type(), n)
+ explicit deque(size_type n)
+ : Base(n, allocator_type())
    {
- containers_detail::default_construct_aux_proxy<T, iterator, size_type> proxy(n);
- proxy.uninitialized_copy_all_to(this->begin());
+ container_detail::default_construct_aux_proxy<A, iterator> proxy(this->alloc(), n);
+ proxy.uninitialized_copy_remaining_to(this->begin());
       //deque_base will deallocate in case of exception...
    }
 
@@ -799,7 +868,8 @@
    //!
    //! <b>Complexity</b>: Linear to n.
    deque(size_type n, const value_type& value,
- const allocator_type& a = allocator_type()) : Base(a, n)
+ const allocator_type& a = allocator_type())
+ : Base(n, a)
    { this->priv_fill_initialize(value); }
 
    //! <b>Effects</b>: Copy constructs a deque.
@@ -808,11 +878,12 @@
    //!
    //! <b>Complexity</b>: Linear to the elements x contains.
    deque(const deque& x)
- : Base(x.alloc())
+ : Base(allocator_traits_type::select_on_container_copy_construction(x.alloc()))
    {
       if(x.size()){
          this->priv_initialize_map(x.size());
- std::uninitialized_copy(x.begin(), x.end(), this->members_.m_start);
+ boost::container::uninitialized_copy_alloc
+ (this->alloc(), x.begin(), x.end(), this->members_.m_start);
       }
    }
 
@@ -821,9 +892,9 @@
    //! <b>Throws</b>: If allocator_type's copy constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- deque(BOOST_RV_REF(deque) mx)
- : Base(mx.alloc())
- { this->swap(mx); }
+ deque(BOOST_RV_REF(deque) x)
+ : Base(boost::move(static_cast<Base&>(x)))
+ { this->swap_members(x); }
 
    //! <b>Effects</b>: Constructs a deque that will use a copy of allocator a
    //! and inserts a copy of the range [first, last) in the deque.
@@ -837,8 +908,8 @@
       : Base(a)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
- typedef containers_detail::bool_<aux_boolean> Result;
+ const bool aux_boolean = container_detail::is_convertible<InpIt, size_type>::value;
+ typedef container_detail::bool_<aux_boolean> Result;
       this->priv_initialize_dispatch(first, last, Result());
    }
 
@@ -848,7 +919,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Linear to the number of elements.
- ~deque()
+ ~deque() BOOST_CONTAINER_NOEXCEPT
    {
       priv_destroy_range(this->members_.m_start, this->members_.m_finish);
    }
@@ -863,15 +934,18 @@
    //! <b>Complexity</b>: Linear to the number of elements in x.
    deque& operator= (BOOST_COPY_ASSIGN_REF(deque) x)
    {
- const size_type len = size();
- if (&x != this) {
- if (len >= x.size())
- this->erase(std::copy(x.begin(), x.end(), this->members_.m_start), this->members_.m_finish);
- else {
- const_iterator mid = x.begin() + difference_type(len);
- std::copy(x.begin(), mid, this->members_.m_start);
- this->insert(this->members_.m_finish, mid, x.end());
- }
+ if (&x != this){
+ allocator_type &this_alloc = this->alloc();
+ const allocator_type &x_alloc = x.alloc();
+ container_detail::bool_<allocator_traits_type::
+ propagate_on_container_copy_assignment::value> flag;
+ if(flag && this_alloc != x_alloc){
+ this->clear();
+ this->shrink_to_fit();
+ }
+ container_detail::assign_alloc(this->alloc(), x.alloc(), flag);
+ container_detail::assign_alloc(this->ptr_alloc(), x.ptr_alloc(), flag);
+ this->assign(x.cbegin(), x.cend());
       }
       return *this;
    }
@@ -886,8 +960,27 @@
    //! <b>Complexity</b>: Linear.
    deque& operator= (BOOST_RV_REF(deque) x)
    {
- this->clear();
- this->swap(x);
+ if (&x != this){
+ allocator_type &this_alloc = this->alloc();
+ allocator_type &x_alloc = x.alloc();
+ //If allocators are equal we can just swap pointers
+ if(this_alloc == x_alloc){
+ //Destroy objects but retain memory in case x reuses it in the future
+ this->clear();
+ this->swap_members(x);
+ //Move allocator if needed
+ container_detail::bool_<allocator_traits_type::
+ propagate_on_container_move_assignment::value> flag;
+ container_detail::move_alloc(this_alloc, x_alloc, flag);
+ container_detail::move_alloc(this->ptr_alloc(), x.ptr_alloc(), flag);
+ }
+ //If unequal allocators, then do a one by one move
+ else{
+ typedef typename std::iterator_traits<iterator>::iterator_category ItCat;
+ this->assign( boost::make_move_iterator(x.begin())
+ , boost::make_move_iterator(x.end()));
+ }
+ }
       return *this;
    }
 
@@ -900,10 +993,10 @@
    //! <b>Complexity</b>: Constant.
    void swap(deque &x)
    {
- std::swap(this->members_.m_start, x.members_.m_start);
- std::swap(this->members_.m_finish, x.members_.m_finish);
- std::swap(this->members_.m_map, x.members_.m_map);
- std::swap(this->members_.m_map_size, x.members_.m_map_size);
+ this->swap_members(x);
+ container_detail::bool_<allocator_traits_type::propagate_on_container_swap::value> flag;
+ container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
+ container_detail::swap_alloc(this->ptr_alloc(), x.ptr_alloc(), flag);
    }
 
    //! <b>Effects</b>: Assigns the n copies of val to *this.
@@ -924,8 +1017,8 @@
    void assign(InpIt first, InpIt last)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
- typedef containers_detail::bool_<aux_boolean> Result;
+ const bool aux_boolean = container_detail::is_convertible<InpIt, size_type>::value;
+ typedef container_detail::bool_<aux_boolean> Result;
       this->priv_assign_dispatch(first, last, Result());
    }
 
@@ -974,11 +1067,11 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant time.
- void pop_back()
+ void pop_back() BOOST_CONTAINER_NOEXCEPT
    {
       if (this->members_.m_finish.m_cur != this->members_.m_finish.m_first) {
          --this->members_.m_finish.m_cur;
- containers_detail::get_pointer(this->members_.m_finish.m_cur)->~value_type();
+ container_detail::to_raw_pointer(this->members_.m_finish.m_cur)->~value_type();
       }
       else
          this->priv_pop_back_aux();
@@ -989,10 +1082,10 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant time.
- void pop_front()
+ void pop_front() BOOST_CONTAINER_NOEXCEPT
    {
       if (this->members_.m_start.m_cur != this->members_.m_start.m_last - 1) {
- containers_detail::get_pointer(this->members_.m_start.m_cur)->~value_type();
+ container_detail::to_raw_pointer(this->members_.m_start.m_cur)->~value_type();
          ++this->members_.m_start.m_cur;
       }
       else
@@ -1046,12 +1139,12 @@
    void insert(const_iterator pos, InpIt first, InpIt last)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
- typedef containers_detail::bool_<aux_boolean> Result;
+ const bool aux_boolean = container_detail::is_convertible<InpIt, size_type>::value;
+ typedef container_detail::bool_<aux_boolean> Result;
       this->priv_insert_dispatch(pos, first, last, Result());
    }
 
- #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... in the end of the deque.
@@ -1063,13 +1156,16 @@
    void emplace_back(Args&&... args)
    {
       if(this->priv_push_back_simple_available()){
- new(this->priv_push_back_simple_pos())value_type(boost::forward<Args>(args)...);
+ allocator_traits_type::construct
+ ( this->alloc()
+ , this->priv_push_back_simple_pos()
+ , boost::forward<Args>(args)...);
          this->priv_push_back_simple_commit();
       }
       else{
- typedef containers_detail::advanced_insert_aux_emplace<T, iterator, Args...> type;
- type &&proxy = type(boost::forward<Args>(args)...);
- this->priv_insert_aux_impl(this->cend(), 1, proxy);
+ typedef container_detail::advanced_insert_aux_non_movable_emplace<A, iterator, Args...> type;
+ type &&proxy = type(this->alloc(), boost::forward<Args>(args)...);
+ this->priv_insert_back_aux_impl(1, proxy);
       }
    }
 
@@ -1083,13 +1179,16 @@
    void emplace_front(Args&&... args)
    {
       if(this->priv_push_front_simple_available()){
- new(this->priv_push_front_simple_pos())value_type(boost::forward<Args>(args)...);
+ allocator_traits_type::construct
+ ( this->alloc()
+ , this->priv_push_front_simple_pos()
+ , boost::forward<Args>(args)...);
          this->priv_push_front_simple_commit();
       }
       else{
- typedef containers_detail::advanced_insert_aux_emplace<T, iterator, Args...> type;
- type &&proxy = type(boost::forward<Args>(args)...);
- this->priv_insert_aux_impl(this->cbegin(), 1, proxy);
+ typedef container_detail::advanced_insert_aux_non_movable_emplace<A, iterator, Args...> type;
+ type &&proxy = type(this->alloc(), boost::forward<Args>(args)...);
+ this->priv_insert_front_aux_impl(1, proxy);
       }
    }
 
@@ -1115,117 +1214,81 @@
       }
       else{
          size_type n = p - this->cbegin();
- typedef containers_detail::advanced_insert_aux_emplace<T, iterator, Args...> type;
- type &&proxy = type(boost::forward<Args>(args)...);
+ typedef container_detail::advanced_insert_aux_emplace<A, iterator, Args...> type;
+ type &&proxy = type(this->alloc(), boost::forward<Args>(args)...);
          this->priv_insert_aux_impl(p, 1, proxy);
          return iterator(this->begin() + n);
       }
    }
 
- #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
- //0 args
- void emplace_back()
- {
- if(priv_push_front_simple_available()){
- new(priv_push_front_simple_pos())value_type();
- priv_push_front_simple_commit();
- }
- else{
- containers_detail::advanced_insert_aux_emplace<T, iterator> proxy;
- priv_insert_aux_impl(cend(), 1, proxy);
- }
- }
-
- void emplace_front()
- {
- if(priv_push_front_simple_available()){
- new(priv_push_front_simple_pos())value_type();
- priv_push_front_simple_commit();
- }
- else{
- containers_detail::advanced_insert_aux_emplace<T, iterator> proxy;
- priv_insert_aux_impl(cbegin(), 1, proxy);
- }
- }
-
- iterator emplace(const_iterator p)
- {
- if(p == cbegin()){
- emplace_front();
- return begin();
- }
- else if(p == cend()){
- emplace_back();
- return (end()-1);
- }
- else{
- size_type n = p - cbegin();
- containers_detail::advanced_insert_aux_emplace<T, iterator> proxy;
- priv_insert_aux_impl(p, 1, proxy);
- return iterator(this->begin() + n);
- }
- }
+ #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //advanced_insert_int.hpp includes all necessary preprocessor machinery...
    #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
       if(priv_push_back_simple_available()){ \
- new(priv_push_back_simple_pos())value_type \
- (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ allocator_traits_type::construct \
+ ( this->alloc() \
+ , this->priv_push_back_simple_pos() \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
          priv_push_back_simple_commit(); \
       } \
       else{ \
- containers_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
- <value_type, iterator, BOOST_PP_ENUM_PARAMS(n, P)> \
- proxy(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
- priv_insert_aux_impl(cend(), 1, proxy); \
+ container_detail::BOOST_PP_CAT(BOOST_PP_CAT( \
+ advanced_insert_aux_non_movable_emplace, n), arg) \
+ <A, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> proxy \
+ (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
+ priv_insert_back_aux_impl(1, proxy); \
       } \
    } \
                                                                                              \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- void emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, > ) \
+ void emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
       if(priv_push_front_simple_available()){ \
- new(priv_push_front_simple_pos())value_type \
- (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ allocator_traits_type::construct \
+ ( this->alloc() \
+ , this->priv_push_front_simple_pos() \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
          priv_push_front_simple_commit(); \
       } \
       else{ \
- containers_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
- <value_type, iterator, BOOST_PP_ENUM_PARAMS(n, P)> \
- proxy(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
- priv_insert_aux_impl(cbegin(), 1, proxy); \
+ container_detail::BOOST_PP_CAT(BOOST_PP_CAT \
+ (advanced_insert_aux_non_movable_emplace, n), arg) \
+ <A, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> proxy \
+ (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
+ priv_insert_front_aux_impl(1, proxy); \
       } \
    } \
                                                                                              \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace(const_iterator p, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace(const_iterator p \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
       if(p == this->cbegin()){ \
- this->emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ this->emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
          return this->begin(); \
       } \
       else if(p == cend()){ \
- this->emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ this->emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
          return (this->end()-1); \
       } \
       else{ \
          size_type pos_num = p - this->cbegin(); \
- containers_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
- <value_type, iterator, BOOST_PP_ENUM_PARAMS(n, P)> \
- proxy(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ container_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
+ <A, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> proxy \
+ (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
          this->priv_insert_aux_impl(p, 1, proxy); \
          return iterator(this->begin() + pos_num); \
       } \
    } \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! <b>Effects</b>: Inserts or erases elements at the end such that
    //! the size becomes n. New elements are copy constructed from x.
@@ -1252,11 +1315,11 @@
    {
       const size_type len = size();
       if (new_size < len)
- this->erase(this->members_.m_start + new_size, this->members_.m_finish);
+ this->priv_erase_last_n(len - new_size);
       else{
          size_type n = new_size - this->size();
- containers_detail::default_construct_aux_proxy<T, iterator, size_type> proxy(n);
- priv_insert_aux_impl(this->cend(), n, proxy);
+ container_detail::default_construct_aux_proxy<A, iterator> proxy(this->alloc(), n);
+ priv_insert_back_aux_impl(n, proxy);
       }
    }
 
@@ -1268,7 +1331,7 @@
    //! last element (if pos is near the end) or the first element
    //! if(pos is near the beginning).
    //! Constant if pos is the first or the last element.
- iterator erase(const_iterator pos)
+ iterator erase(const_iterator pos) BOOST_CONTAINER_NOEXCEPT
    {
       const_iterator next = pos;
       ++next;
@@ -1292,7 +1355,7 @@
    //! last plus the elements between pos and the
    //! last element (if pos is near the end) or the first element
    //! if(pos is near the beginning).
- iterator erase(const_iterator first, const_iterator last)
+ iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
    {
       if (first == this->members_.m_start && last == this->members_.m_finish) {
          this->clear();
@@ -1321,12 +1384,26 @@
       }
    }
 
+ void priv_erase_last_n(size_type n)
+ {
+ if(n == this->size()) {
+ this->clear();
+ }
+ else {
+ iterator new_finish = this->members_.m_finish - n;
+ if(!Base::traits_t::trivial_dctr_after_move)
+ this->priv_destroy_range(new_finish, this->members_.m_finish);
+ this->priv_destroy_nodes(new_finish.m_node + 1, this->members_.m_finish.m_node + 1);
+ this->members_.m_finish = new_finish;
+ }
+ }
+
    //! <b>Effects</b>: Erases all the elements of the deque.
    //!
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Linear to the number of elements in the deque.
- void clear()
+ void clear() BOOST_CONTAINER_NOEXCEPT
    {
       for (index_pointer node = this->members_.m_start.m_node + 1;
             node < this->members_.m_finish.m_node;
@@ -1365,7 +1442,6 @@
 
    /// @cond
    private:
-
    void priv_range_check(size_type n) const
       { if (n >= this->size()) BOOST_RETHROW std::out_of_range("deque"); }
 
@@ -1407,7 +1483,8 @@
    void priv_push_front(const value_type &t)
    {
       if(this->priv_push_front_simple_available()){
- new(this->priv_push_front_simple_pos())value_type(t);
+ allocator_traits_type::construct
+ ( this->alloc(), this->priv_push_front_simple_pos(), t);
          this->priv_push_front_simple_commit();
       }
       else{
@@ -1418,7 +1495,8 @@
    void priv_push_front(BOOST_RV_REF(value_type) t)
    {
       if(this->priv_push_front_simple_available()){
- new(this->priv_push_front_simple_pos())value_type(boost::move(t));
+ allocator_traits_type::construct
+ ( this->alloc(), this->priv_push_front_simple_pos(), boost::move(t));
          this->priv_push_front_simple_commit();
       }
       else{
@@ -1429,7 +1507,8 @@
    void priv_push_back(const value_type &t)
    {
       if(this->priv_push_back_simple_available()){
- new(this->priv_push_back_simple_pos())value_type(t);
+ allocator_traits_type::construct
+ ( this->alloc(), this->priv_push_back_simple_pos(), t);
          this->priv_push_back_simple_commit();
       }
       else{
@@ -1440,7 +1519,8 @@
    void priv_push_back(BOOST_RV_REF(T) t)
    {
       if(this->priv_push_back_simple_available()){
- new(this->priv_push_back_simple_pos())value_type(boost::move(t));
+ allocator_traits_type::construct
+ ( this->alloc(), this->priv_push_back_simple_pos(), boost::move(t));
          this->priv_push_back_simple_commit();
       }
       else{
@@ -1454,9 +1534,9 @@
          (this->members_.m_finish.m_cur != (this->members_.m_finish.m_last - 1));
    }
 
- void *priv_push_back_simple_pos() const
+ T *priv_push_back_simple_pos() const
    {
- return static_cast<void*>(containers_detail::get_pointer(this->members_.m_finish.m_cur));
+ return container_detail::to_raw_pointer(this->members_.m_finish.m_cur);
    }
 
    void priv_push_back_simple_commit()
@@ -1470,8 +1550,8 @@
          (this->members_.m_start.m_cur != this->members_.m_start.m_first);
    }
 
- void *priv_push_front_simple_pos() const
- { return static_cast<void*>(containers_detail::get_pointer(this->members_.m_start.m_cur) - 1); }
+ T *priv_push_front_simple_pos() const
+ { return container_detail::to_raw_pointer(this->members_.m_start.m_cur) - 1; }
 
    void priv_push_front_simple_commit()
    { --this->members_.m_start.m_cur; }
@@ -1505,14 +1585,14 @@
    }
 
    template <class Integer>
- void priv_initialize_dispatch(Integer n, Integer x, containers_detail::true_)
+ void priv_initialize_dispatch(Integer n, Integer x, container_detail::true_)
    {
       this->priv_initialize_map(n);
       this->priv_fill_initialize(x);
    }
 
    template <class InpIt>
- void priv_initialize_dispatch(InpIt first, InpIt last, containers_detail::false_)
+ void priv_initialize_dispatch(InpIt first, InpIt last, container_detail::false_)
    {
       typedef typename std::iterator_traits<InpIt>::iterator_category ItCat;
       this->priv_range_initialize(first, last, ItCat());
@@ -1521,21 +1601,21 @@
    void priv_destroy_range(iterator p, iterator p2)
    {
       for(;p != p2; ++p)
- containers_detail::get_pointer(&*p)->~value_type();
+ container_detail::to_raw_pointer(&*p)->~value_type();
    }
 
    void priv_destroy_range(pointer p, pointer p2)
    {
       for(;p != p2; ++p)
- containers_detail::get_pointer(&*p)->~value_type();
+ container_detail::to_raw_pointer(&*p)->~value_type();
    }
 
    template <class Integer>
- void priv_assign_dispatch(Integer n, Integer val, containers_detail::true_)
+ void priv_assign_dispatch(Integer n, Integer val, container_detail::true_)
       { this->priv_fill_assign((size_type) n, (value_type)val); }
 
    template <class InpIt>
- void priv_assign_dispatch(InpIt first, InpIt last, containers_detail::false_)
+ void priv_assign_dispatch(InpIt first, InpIt last, container_detail::false_)
    {
       typedef typename std::iterator_traits<InpIt>::iterator_category ItCat;
       this->priv_assign_aux(first, last, ItCat());
@@ -1560,19 +1640,19 @@
       if (len > size()) {
          FwdIt mid = first;
          std::advance(mid, size());
- std::copy(first, mid, begin());
+ boost::copy_or_move(first, mid, begin());
          this->insert(cend(), mid, last);
       }
       else
- this->erase(std::copy(first, last, begin()), cend());
+ this->erase(boost::copy_or_move(first, last, begin()), cend());
    }
 
    template <class Integer>
- void priv_insert_dispatch(const_iterator pos, Integer n, Integer x, containers_detail::true_)
+ void priv_insert_dispatch(const_iterator pos, Integer n, Integer x, container_detail::true_)
    { this->priv_fill_insert(pos, (size_type) n, (value_type)x); }
 
    template <class InpIt>
- void priv_insert_dispatch(const_iterator pos,InpIt first, InpIt last, containers_detail::false_)
+ void priv_insert_dispatch(const_iterator pos,InpIt first, InpIt last, container_detail::false_)
    {
       typedef typename std::iterator_traits<InpIt>::iterator_category ItCat;
       this->priv_insert_aux(pos, first, last, ItCat());
@@ -1588,7 +1668,7 @@
    template <class FwdIt>
    void priv_insert_aux(const_iterator p, FwdIt first, FwdIt last)
    {
- containers_detail::advanced_insert_aux_proxy<T, FwdIt, iterator> proxy(first, last);
+ container_detail::advanced_insert_aux_proxy<A, FwdIt, iterator> proxy(this->alloc(), first, last);
       priv_insert_aux_impl(p, (size_type)std::distance(first, last), proxy);
    }
 
@@ -1608,19 +1688,21 @@
          pos = this->members_.m_start + elemsbefore;
          if (elemsbefore >= difference_type(n)) {
             iterator start_n = this->members_.m_start + difference_type(n);
- ::boost::uninitialized_move(this->members_.m_start, start_n, new_start);
+ ::boost::container::uninitialized_move_alloc
+ (this->alloc(), this->members_.m_start, start_n, new_start);
             this->members_.m_start = new_start;
             boost::move(start_n, pos, old_start);
- interf.copy_all_to(pos - difference_type(n));
+ interf.copy_remaining_to(pos - difference_type(n));
          }
          else {
             difference_type mid_count = (difference_type(n) - elemsbefore);
             iterator mid_start = old_start - mid_count;
             interf.uninitialized_copy_some_and_update(mid_start, mid_count, true);
             this->members_.m_start = mid_start;
- ::boost::uninitialized_move(old_start, pos, new_start);
+ ::boost::container::uninitialized_move_alloc
+ (this->alloc(), old_start, pos, new_start);
             this->members_.m_start = new_start;
- interf.copy_all_to(old_start);
+ interf.copy_remaining_to(old_start);
          }
       }
       else {
@@ -1631,21 +1713,47 @@
          pos = this->members_.m_finish - elemsafter;
          if (elemsafter >= difference_type(n)) {
             iterator finish_n = this->members_.m_finish - difference_type(n);
- ::boost::uninitialized_move(finish_n, this->members_.m_finish, this->members_.m_finish);
+ ::boost::container::uninitialized_move_alloc
+ (this->alloc(), finish_n, this->members_.m_finish, this->members_.m_finish);
             this->members_.m_finish = new_finish;
             boost::move_backward(pos, finish_n, old_finish);
- interf.copy_all_to(pos);
+ interf.copy_remaining_to(pos);
          }
          else {
             interf.uninitialized_copy_some_and_update(old_finish, elemsafter, false);
             this->members_.m_finish += n-elemsafter;
- ::boost::uninitialized_move(pos, old_finish, this->members_.m_finish);
+ ::boost::container::uninitialized_move_alloc
+ (this->alloc(), pos, old_finish, this->members_.m_finish);
             this->members_.m_finish = new_finish;
- interf.copy_all_to(pos);
+ interf.copy_remaining_to(pos);
          }
       }
    }
 
+ void priv_insert_back_aux_impl(size_type n, advanced_insert_aux_int_t &interf)
+ {
+ if(!this->members_.m_map){
+ this->priv_initialize_map(0);
+ }
+
+ iterator new_finish = this->priv_reserve_elements_at_back(n);
+ iterator old_finish = this->members_.m_finish;
+ interf.uninitialized_copy_some_and_update(old_finish, n, true);
+ this->members_.m_finish = new_finish;
+ }
+
+ void priv_insert_front_aux_impl(size_type n, advanced_insert_aux_int_t &interf)
+ {
+ if(!this->members_.m_map){
+ this->priv_initialize_map(0);
+ }
+
+ iterator new_start = this->priv_reserve_elements_at_front(n);
+ interf.uninitialized_copy_some_and_update(new_start, difference_type(n), true);
+ this->members_.m_start = new_start;
+ }
+
+
    void priv_fill_insert(const_iterator pos, size_type n, const value_type& x)
    {
       typedef constant_iterator<value_type, difference_type> c_it;
@@ -1659,9 +1767,11 @@
       index_pointer cur;
       BOOST_TRY {
          for (cur = this->members_.m_start.m_node; cur < this->members_.m_finish.m_node; ++cur){
- std::uninitialized_fill(*cur, *cur + this->s_buffer_size(), value);
+ boost::container::uninitialized_fill_alloc
+ (this->alloc(), *cur, *cur + this->s_buffer_size(), value);
          }
- std::uninitialized_fill(this->members_.m_finish.m_first, this->members_.m_finish.m_cur, value);
+ boost::container::uninitialized_fill_alloc
+ (this->alloc(), this->members_.m_finish.m_first, this->members_.m_finish.m_cur, value);
       }
       BOOST_CATCH(...){
          this->priv_destroy_range(this->members_.m_start, iterator(*cur, cur));
@@ -1699,10 +1809,12 @@
                ++cur_node) {
             FwdIt mid = first;
             std::advance(mid, this->s_buffer_size());
- ::boost::uninitialized_copy_or_move(first, mid, *cur_node);
+ ::boost::container::uninitialized_copy_or_move_alloc
+ (this->alloc(), first, mid, *cur_node);
             first = mid;
          }
- ::boost::uninitialized_copy_or_move(first, last, this->members_.m_finish.m_first);
+ ::boost::container::uninitialized_copy_or_move_alloc
+ (this->alloc(), first, last, this->members_.m_finish.m_first);
       }
       BOOST_CATCH(...){
          this->priv_destroy_range(this->members_.m_start, iterator(*cur_node, cur_node));
@@ -1717,7 +1829,7 @@
       this->priv_deallocate_node(this->members_.m_finish.m_first);
       this->members_.m_finish.priv_set_node(this->members_.m_finish.m_node - 1);
       this->members_.m_finish.m_cur = this->members_.m_finish.m_last - 1;
- containers_detail::get_pointer(this->members_.m_finish.m_cur)->~value_type();
+ container_detail::to_raw_pointer(this->members_.m_finish.m_cur)->~value_type();
    }
 
    // Called only if this->members_.m_start.m_cur == this->members_.m_start.m_last - 1. Note that
@@ -1726,7 +1838,7 @@
    // must have at least two nodes.
    void priv_pop_front_aux()
    {
- containers_detail::get_pointer(this->members_.m_start.m_cur)->~value_type();
+ container_detail::to_raw_pointer(this->members_.m_start.m_cur)->~value_type();
       this->priv_deallocate_node(this->members_.m_start.m_first);
       this->members_.m_start.priv_set_node(this->members_.m_start.m_node + 1);
       this->members_.m_start.m_cur = this->members_.m_start.m_first;
@@ -1800,7 +1912,7 @@
       }
       else {
          size_type new_map_size =
- this->members_.m_map_size + containers_detail::max_value(this->members_.m_map_size, nodes_to_add) + 2;
+ this->members_.m_map_size + container_detail::max_value(this->members_.m_map_size, nodes_to_add) + 2;
 
          index_pointer new_map = this->priv_allocate_map(new_map_size);
          new_nstart = new_map + (new_map_size - new_num_nodes) / 2
@@ -1878,4 +1990,4 @@
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif // #ifndef BOOST_CONTAINERS_DEQUE_HPP
+#endif // #ifndef BOOST_CONTAINER_DEQUE_HPP

Modified: trunk/boost/container/detail/adaptive_node_pool_impl.hpp
==============================================================================
--- trunk/boost/container/detail/adaptive_node_pool_impl.hpp (original)
+++ trunk/boost/container/detail/adaptive_node_pool_impl.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -19,7 +19,7 @@
 #include <boost/container/container_fwd.hpp>
 #include <boost/container/detail/workaround.hpp>
 #include <boost/container/detail/utilities.hpp>
-#include <boost/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/set.hpp>
 #include <boost/intrusive/slist.hpp>
 #include <boost/container/detail/type_traits.hpp>
@@ -31,7 +31,7 @@
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 template<class size_type>
 struct hdr_offset_holder_t
@@ -221,7 +221,7 @@
 
    //!Returns the segment manager. Never throws
    segment_manager_base_type* get_segment_manager_base()const
- { return containers_detail::get_pointer(mp_segment_mngr_base); }
+ { return container_detail::to_raw_pointer(mp_segment_mngr_base); }
 
    //!Allocates array of count elements. Can throw
    void *allocate_node()
@@ -348,7 +348,7 @@
    {
       block_iterator block_it(m_block_multiset.end());
       while(n--){
- void *pElem = containers_detail::get_pointer(chain.front());
+ void *pElem = container_detail::to_raw_pointer(chain.front());
          chain.pop_front();
          priv_invariants();
          block_info_t *block_info = this->priv_block_from_node(pElem);
@@ -434,7 +434,7 @@
          (void)free_nodes;
          BOOST_ASSERT(free_nodes == mp_impl->m_real_num_node);
          BOOST_ASSERT(0 == to_deallocate->hdr_offset);
- hdr_offset_holder *hdr_off_holder = mp_impl->priv_first_subblock_from_block(containers_detail::get_pointer(to_deallocate));
+ hdr_offset_holder *hdr_off_holder = mp_impl->priv_first_subblock_from_block(container_detail::to_raw_pointer(to_deallocate));
          mp_impl->mp_segment_mngr_base->deallocate(hdr_off_holder);
       }
 
@@ -557,7 +557,7 @@
             (mp_segment_mngr_base->allocate_aligned(real_block_size, m_real_block_alignment));
          if(!mem_address) throw std::bad_alloc();
          ++m_totally_free_blocks;
- block_info_t *c_info = new(mem_address)block_info_t;
+ block_info_t *c_info = new(mem_address)block_info_t();
          m_block_multiset.insert(m_block_multiset.end(), *c_info);
          
          mem_address += HdrSize;
@@ -587,7 +587,7 @@
 
          //First initialize header information on the last subblock
          char *hdr_addr = mem_address + m_real_block_alignment*(m_num_subblocks-1);
- block_info_t *c_info = new(hdr_addr)block_info_t;
+ block_info_t *c_info = new(hdr_addr)block_info_t();
          //Some structural checks
          BOOST_ASSERT(static_cast<void*>(&static_cast<hdr_offset_holder*>(c_info)->hdr_offset) ==
                 static_cast<void*>(c_info));
@@ -622,8 +622,8 @@
    { return priv_alloc_block(n, IsAlignOnly()); }
 
    private:
- typedef typename boost::pointer_to_other
- <void_pointer, segment_manager_base_type>::type segment_mngr_base_ptr_t;
+ typedef typename boost::intrusive::pointer_traits
+ <void_pointer>::template rebind_pointer<segment_manager_base_type>::type segment_mngr_base_ptr_t;
    const size_type m_max_free_blocks;
    const size_type m_real_node_size;
    //Round the size to a power of two value.
@@ -639,7 +639,7 @@
    size_type m_totally_free_blocks; //Free blocks
 };
 
-} //namespace containers_detail {
+} //namespace container_detail {
 } //namespace container {
 } //namespace boost {
 

Modified: trunk/boost/container/detail/advanced_insert_int.hpp
==============================================================================
--- trunk/boost/container/detail/advanced_insert_int.hpp (original)
+++ trunk/boost/container/detail/advanced_insert_int.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_ADVANCED_INSERT_INT_HPP
-#define BOOST_CONTAINERS_ADVANCED_INSERT_INT_HPP
+#ifndef BOOST_CONTAINER_ADVANCED_INSERT_INT_HPP
+#define BOOST_CONTAINER_ADVANCED_INSERT_INT_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -17,54 +17,58 @@
 
 #include "config_begin.hpp"
 #include <boost/container/detail/workaround.hpp>
+#include <boost/container/allocator/allocator_traits.hpp>
 #include <boost/move/move.hpp>
 #include <iterator> //std::iterator_traits
-#include <new> //placement new
 #include <boost/assert.hpp>
 
-namespace boost { namespace container { namespace containers_detail {
+namespace boost { namespace container { namespace container_detail {
 
 //This class will be interface for operations dependent on FwdIt types used advanced_insert_aux_impl
-template<class T, class Iterator>
+template<class Iterator>
 struct advanced_insert_aux_int
 {
    typedef typename std::iterator_traits<Iterator>::difference_type difference_type;
- virtual void copy_all_to(Iterator p) = 0;
- virtual void uninitialized_copy_all_to(Iterator p) = 0;
+ virtual void copy_remaining_to(Iterator p) = 0;
+ virtual void uninitialized_copy_remaining_to(Iterator p) = 0;
    virtual void uninitialized_copy_some_and_update(Iterator pos, difference_type division_count, bool first) = 0;
    virtual void copy_some_and_update(Iterator pos, difference_type division_count, bool first) = 0;
    virtual ~advanced_insert_aux_int() {}
 };
 
 //This class template will adapt each FwIt types to advanced_insert_aux_int
-template<class T, class FwdIt, class Iterator>
+template<class A, class FwdIt, class Iterator>
 struct advanced_insert_aux_proxy
- : public advanced_insert_aux_int<T, Iterator>
+ : public advanced_insert_aux_int<Iterator>
 {
- typedef typename advanced_insert_aux_int<T, Iterator>::difference_type difference_type;
- advanced_insert_aux_proxy(FwdIt first, FwdIt last)
- : first_(first), last_(last)
+ typedef boost::container::allocator_traits<A> alloc_traits;
+ typedef typename allocator_traits<A>::size_type size_type;
+ typedef typename allocator_traits<A>::value_type value_type;
+ typedef typename advanced_insert_aux_int<Iterator>::difference_type difference_type;
+
+ advanced_insert_aux_proxy(A& a, FwdIt first, FwdIt last)
+ : a_(a), first_(first), last_(last)
    {}
 
    virtual ~advanced_insert_aux_proxy()
    {}
 
- virtual void copy_all_to(Iterator p)
+ virtual void copy_remaining_to(Iterator p)
    { ::boost::copy_or_move(first_, last_, p); }
 
- virtual void uninitialized_copy_all_to(Iterator p)
- { ::boost::uninitialized_copy_or_move(first_, last_, p); }
+ virtual void uninitialized_copy_remaining_to(Iterator p)
+ { ::boost::container::uninitialized_copy_or_move_alloc(a_, first_, last_, p); }
 
    virtual void uninitialized_copy_some_and_update(Iterator pos, difference_type division_count, bool first_n)
    {
       FwdIt mid = first_;
       std::advance(mid, division_count);
       if(first_n){
- ::boost::uninitialized_copy_or_move(first_, mid, pos);
+ ::boost::container::uninitialized_copy_or_move_alloc(a_, first_, mid, pos);
          first_ = mid;
       }
       else{
- ::boost::uninitialized_copy_or_move(mid, last_, pos);
+ ::boost::container::uninitialized_copy_or_move_alloc(a_, mid, last_, pos);
          last_ = mid;
       }
    }
@@ -82,53 +86,38 @@
          last_ = mid;
       }
    }
-
+ A &a_;
    FwdIt first_, last_;
 };
 
-//This class template will adapt each FwIt types to advanced_insert_aux_int
-template<class T, class Iterator, class SizeType>
+//This class template will adapt default construction insertions to advanced_insert_aux_int
+template<class A, class Iterator>
 struct default_construct_aux_proxy
- : public advanced_insert_aux_int<T, Iterator>
+ : public advanced_insert_aux_int<Iterator>
 {
- typedef typename advanced_insert_aux_int<T, Iterator>::difference_type difference_type;
- default_construct_aux_proxy(SizeType count)
- : count_(count)
- {}
+ typedef boost::container::allocator_traits<A> alloc_traits;
+ typedef typename allocator_traits<A>::size_type size_type;
+ typedef typename allocator_traits<A>::value_type value_type;
+ typedef typename advanced_insert_aux_int<Iterator>::difference_type difference_type;
 
- void uninitialized_copy_impl(Iterator p, const SizeType n)
- {
- BOOST_ASSERT(n <= count_);
- Iterator orig_p = p;
- SizeType i = 0;
- try{
- for(; i < n; ++i, ++p){
- new(containers_detail::get_pointer(&*p))T();
- }
- }
- catch(...){
- while(i--){
- containers_detail::get_pointer(&*orig_p++)->~T();
- }
- throw;
- }
- count_ -= n;
- }
+ default_construct_aux_proxy(A &a, size_type count)
+ : a_(a), count_(count)
+ {}
 
    virtual ~default_construct_aux_proxy()
    {}
 
- virtual void copy_all_to(Iterator)
+ virtual void copy_remaining_to(Iterator)
    { //This should never be called with any count
       BOOST_ASSERT(count_ == 0);
    }
 
- virtual void uninitialized_copy_all_to(Iterator p)
- { this->uninitialized_copy_impl(p, count_); }
+ virtual void uninitialized_copy_remaining_to(Iterator p)
+ { this->priv_uninitialized_copy(p, count_); }
 
    virtual void uninitialized_copy_some_and_update(Iterator pos, difference_type division_count, bool first_n)
    {
- SizeType new_count;
+ size_type new_count;
       if(first_n){
          new_count = division_count;
       }
@@ -136,13 +125,13 @@
          BOOST_ASSERT(difference_type(count_)>= division_count);
          new_count = count_ - division_count;
       }
- this->uninitialized_copy_impl(pos, new_count);
+ this->priv_uninitialized_copy(pos, new_count);
    }
 
    virtual void copy_some_and_update(Iterator , difference_type division_count, bool first_n)
    {
       BOOST_ASSERT(count_ == 0);
- SizeType new_count;
+ size_type new_count;
       if(first_n){
          new_count = division_count;
       }
@@ -155,12 +144,32 @@
       (void)new_count;
    }
 
- SizeType count_;
+ private:
+ void priv_uninitialized_copy(Iterator p, const size_type n)
+ {
+ BOOST_ASSERT(n <= count_);
+ Iterator orig_p = p;
+ size_type i = 0;
+ try{
+ for(; i < n; ++i, ++p){
+ alloc_traits::construct(a_, container_detail::to_raw_pointer(&*p));
+ }
+ }
+ catch(...){
+ while(i--){
+ alloc_traits::destroy(a_, container_detail::to_raw_pointer(&*orig_p++));
+ }
+ throw;
+ }
+ count_ -= n;
+ }
+ A &a_;
+ size_type count_;
 };
 
-}}} //namespace boost { namespace container { namespace containers_detail {
+}}} //namespace boost { namespace container { namespace container_detail {
 
-#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
 #include <boost/container/detail/variadic_templates_tools.hpp>
 #include <boost/container/detail/stored_ref.hpp>
@@ -169,217 +178,251 @@
 //#include <iostream> //For debugging purposes
 
 namespace boost {
-namespace container {
-namespace containers_detail {
+namespace container {
+namespace container_detail {
 
-//This class template will adapt each FwIt types to advanced_insert_aux_int
-template<class T, class Iterator, class ...Args>
-struct advanced_insert_aux_emplace
- : public advanced_insert_aux_int<T, Iterator>
+
+//This class template will adapt emplace construction insertions of movable types
+//to advanced_insert_aux_int
+template<class A, class Iterator, class ...Args>
+struct advanced_insert_aux_non_movable_emplace
+ : public advanced_insert_aux_int<Iterator>
 {
- typedef typename advanced_insert_aux_int<T, Iterator>::difference_type difference_type;
+ typedef boost::container::allocator_traits<A> alloc_traits;
+ typedef typename allocator_traits<A>::size_type size_type;
+ typedef typename allocator_traits<A>::value_type value_type;
+ typedef typename advanced_insert_aux_int<Iterator>::difference_type difference_type;
    typedef typename build_number_seq<sizeof...(Args)>::type index_tuple_t;
 
- explicit advanced_insert_aux_emplace(Args&&... args)
- : args_(args...)
+ explicit advanced_insert_aux_non_movable_emplace(A &a, Args&&... args)
+ : a_(a)
+ , args_(args...)
       , used_(false)
    {}
 
- ~advanced_insert_aux_emplace()
+ ~advanced_insert_aux_non_movable_emplace()
    {}
 
- virtual void copy_all_to(Iterator p)
- { this->priv_copy_all_to(index_tuple_t(), p); }
+ virtual void copy_remaining_to(Iterator)
+ //This code can't be called since value_type is not movable or copyable
+ { BOOST_ASSERT(false); }
 
- virtual void uninitialized_copy_all_to(Iterator p)
- { this->priv_uninitialized_copy_all_to(index_tuple_t(), p); }
+ virtual void uninitialized_copy_remaining_to(Iterator p)
+ { this->priv_uninitialized_copy_remaining_to(index_tuple_t(), p); }
 
    virtual void uninitialized_copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
    { this->priv_uninitialized_copy_some_and_update(index_tuple_t(), p, division_count, first_n); }
 
- virtual void copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
- { this->priv_copy_some_and_update(index_tuple_t(), p, division_count, first_n); }
+ virtual void copy_some_and_update(Iterator, difference_type, bool )
+ //This code can't be called since value_type is not movable or copyable
+ { BOOST_ASSERT(false); }
 
    private:
    template<int ...IdxPack>
- void priv_copy_all_to(const index_tuple<IdxPack...>&, Iterator p)
- {
- if(!used_){
- *p = boost::move(T (::boost::container::containers_detail::stored_ref<Args>::forward(get<IdxPack>(args_))...));
- used_ = true;
- }
- }
-
- template<int ...IdxPack>
- void priv_uninitialized_copy_all_to(const index_tuple<IdxPack...>&, Iterator p)
- {
- if(!used_){
- new(containers_detail::get_pointer(&*p))T(::boost::container::containers_detail::stored_ref<Args>::forward(get<IdxPack>(args_))...);
- used_ = true;
- }
- }
-
- template<int ...IdxPack>
    void priv_uninitialized_copy_some_and_update(const index_tuple<IdxPack...>&, Iterator p, difference_type division_count, bool first_n)
    {
       BOOST_ASSERT(division_count <=1);
       if((first_n && division_count == 1) || (!first_n && division_count == 0)){
          if(!used_){
- new(containers_detail::get_pointer(&*p))T(::boost::container::containers_detail::stored_ref<Args>::forward(get<IdxPack>(args_))...);
+ alloc_traits::construct( a_
+ , container_detail::to_raw_pointer(&*p)
+ , ::boost::container::container_detail::
+ stored_ref<Args>::forward(get<IdxPack>(args_))...
+ );
             used_ = true;
          }
       }
    }
 
    template<int ...IdxPack>
- void priv_copy_some_and_update(const index_tuple<IdxPack...>&, Iterator p, difference_type division_count, bool first_n)
+ void priv_uninitialized_copy_remaining_to(const index_tuple<IdxPack...>&, Iterator p)
    {
- BOOST_ASSERT(division_count <=1);
- if((first_n && division_count == 1) || (!first_n && division_count == 0)){
- if(!used_){
- *p = boost::move(T(::boost::container::containers_detail::stored_ref<Args>::forward(get<IdxPack>(args_))...));
- used_ = true;
- }
+ if(!used_){
+ alloc_traits::construct( a_
+ , container_detail::to_raw_pointer(&*p)
+ , ::boost::container::container_detail::
+ stored_ref<Args>::forward(get<IdxPack>(args_))...
+ );
+ used_ = true;
       }
    }
+
+ protected:
+ A &a_;
    tuple<Args&...> args_;
    bool used_;
 };
 
-}}} //namespace boost { namespace container { namespace containers_detail {
-
-#else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
-#include <boost/container/detail/preprocessor.hpp>
-#include <boost/container/detail/value_init.hpp>
-
-namespace boost {
-namespace container {
-namespace containers_detail {
-
-//This class template will adapt each FwIt types to advanced_insert_aux_int
-template<class T, class Iterator>
+//This class template will adapt emplace construction insertions of movable types
+//to advanced_insert_aux_int
+template<class A, class Iterator, class ...Args>
 struct advanced_insert_aux_emplace
- : public advanced_insert_aux_int<T, Iterator>
+ : public advanced_insert_aux_non_movable_emplace<A, Iterator, Args...>
 {
- typedef typename advanced_insert_aux_int<T, Iterator>::difference_type difference_type;
- advanced_insert_aux_emplace()
- : used_(false)
+ typedef advanced_insert_aux_non_movable_emplace<A, Iterator, Args...> base_t;
+ typedef typename base_t::value_type value_type;
+ typedef typename base_t::difference_type difference_type;
+ typedef typename base_t::index_tuple_t index_tuple_t;
+
+ explicit advanced_insert_aux_emplace(A &a, Args&&... args)
+ : base_t(a, boost::forward<Args>(args)...)
    {}
 
    ~advanced_insert_aux_emplace()
    {}
 
- virtual void copy_all_to(Iterator p)
- {
- if(!used_){
- value_init<T>v;
- *p = boost::move(v.m_t);
- used_ = true;
- }
- }
+ //Override only needed functions
+ virtual void copy_remaining_to(Iterator p)
+ { this->priv_copy_remaining_to(index_tuple_t(), p); }
 
- virtual void uninitialized_copy_all_to(Iterator p)
- {
- if(!used_){
- new(containers_detail::get_pointer(&*p))T();
- used_ = true;
- }
- }
+ virtual void copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
+ { this->priv_copy_some_and_update(index_tuple_t(), p, division_count, first_n); }
 
- virtual void uninitialized_copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
+ private:
+ template<int ...IdxPack>
+ void priv_copy_remaining_to(const index_tuple<IdxPack...>&, Iterator p)
    {
- BOOST_ASSERT(division_count <=1);
- if((first_n && division_count == 1) || (!first_n && division_count == 0)){
- if(!used_){
- new(containers_detail::get_pointer(&*p))T();
- used_ = true;
- }
+ if(!this->used_){
+ *p = boost::move(value_type (
+ ::boost::container::container_detail::stored_ref<Args>::forward(get<IdxPack>(this->args_))...));
+ this->used_ = true;
       }
    }
 
- virtual void copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
+ template<int ...IdxPack>
+ void priv_copy_some_and_update(const index_tuple<IdxPack...>&, Iterator p, difference_type division_count, bool first_n)
    {
       BOOST_ASSERT(division_count <=1);
       if((first_n && division_count == 1) || (!first_n && division_count == 0)){
- if(!used_){
- value_init<T>v;
- *p = boost::move(v.m_t);
- used_ = true;
+ if(!this->used_){
+ *p = boost::move(value_type(
+ ::boost::container::container_detail::stored_ref<Args>::forward(get<IdxPack>(this->args_))...));
+ this->used_ = true;
          }
       }
    }
- private:
- bool used_;
 };
 
- #define BOOST_PP_LOCAL_MACRO(n) \
- template<class T, class Iterator, BOOST_PP_ENUM_PARAMS(n, class P) > \
- struct BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
- : public advanced_insert_aux_int<T, Iterator> \
- { \
- typedef typename advanced_insert_aux_int<T, Iterator>::difference_type difference_type; \
- \
- BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
- ( BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _) ) \
- : used_(false), BOOST_PP_ENUM(n, BOOST_CONTAINERS_AUX_PARAM_INIT, _) {} \
- \
- virtual void copy_all_to(Iterator p) \
- { \
- if(!used_){ \
- T v(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_MEMBER_FORWARD, _)); \
- *p = boost::move(v); \
- used_ = true; \
- } \
- } \
- \
- virtual void uninitialized_copy_all_to(Iterator p) \
- { \
- if(!used_){ \
- new(containers_detail::get_pointer(&*p))T \
- (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_MEMBER_FORWARD, _)); \
- used_ = true; \
- } \
- } \
- \
- virtual void uninitialized_copy_some_and_update \
- (Iterator p, difference_type division_count, bool first_n) \
- { \
- BOOST_ASSERT(division_count <=1); \
- if((first_n && division_count == 1) || (!first_n && division_count == 0)){ \
- if(!used_){ \
- new(containers_detail::get_pointer(&*p))T \
- (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_MEMBER_FORWARD, _)); \
- used_ = true; \
- } \
- } \
- } \
- \
- virtual void copy_some_and_update \
- (Iterator p, difference_type division_count, bool first_n) \
- { \
- BOOST_ASSERT(division_count <=1); \
- if((first_n && division_count == 1) || (!first_n && division_count == 0)){ \
- if(!used_){ \
- T v(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_MEMBER_FORWARD, _)); \
- *p = boost::move(v); \
- used_ = true; \
- } \
- } \
- } \
- \
- bool used_; \
- BOOST_PP_REPEAT(n, BOOST_CONTAINERS_AUX_PARAM_DEFINE, _) \
- }; \
+}}} //namespace boost { namespace container { namespace container_detail {
+
+#else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+
+#include <boost/container/detail/preprocessor.hpp>
+#include <boost/container/detail/value_init.hpp>
+
+namespace boost {
+namespace container {
+namespace container_detail {
+
+#define BOOST_PP_LOCAL_MACRO(n) \
+template<class A, class Iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \
+struct BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_non_movable_emplace, n), arg) \
+ : public advanced_insert_aux_int<Iterator> \
+{ \
+ typedef boost::container::allocator_traits<A> alloc_traits; \
+ typedef typename allocator_traits<A>::size_type size_type; \
+ typedef typename allocator_traits<A>::value_type value_type; \
+ typedef typename advanced_insert_aux_int<Iterator>::difference_type \
+ difference_type; \
+ \
+ BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_non_movable_emplace, n), arg) \
+ ( A &a BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _) ) \
+ : a_(a) \
+ , used_(false) \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_INIT, _) \
+ {} \
+ \
+ virtual void copy_remaining_to(Iterator) \
+ { BOOST_ASSERT(false); } \
+ \
+ virtual void uninitialized_copy_remaining_to(Iterator p) \
+ { \
+ if(!used_){ \
+ alloc_traits::construct \
+ ( a_ \
+ , container_detail::to_raw_pointer(&*p) \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _) \
+ ); \
+ used_ = true; \
+ } \
+ } \
+ \
+ virtual void uninitialized_copy_some_and_update \
+ (Iterator p, difference_type division_count, bool first_n) \
+ { \
+ BOOST_ASSERT(division_count <=1); \
+ if((first_n && division_count == 1) || (!first_n && division_count == 0)){ \
+ if(!used_){ \
+ alloc_traits::construct \
+ ( a_ \
+ , container_detail::to_raw_pointer(&*p) \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _) \
+ ); \
+ used_ = true; \
+ } \
+ } \
+ } \
+ \
+ virtual void copy_some_and_update(Iterator, difference_type, bool) \
+ { BOOST_ASSERT(false); } \
+ \
+ A &a_; \
+ bool used_; \
+ BOOST_PP_REPEAT(n, BOOST_CONTAINER_PP_PARAM_DEFINE, _) \
+}; \
+ \
+template<class A, class Iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \
+struct BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
+ : BOOST_PP_CAT(BOOST_PP_CAT( \
+ advanced_insert_aux_non_movable_emplace, n), arg) \
+ < A, Iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P) > \
+{ \
+ typedef BOOST_PP_CAT(BOOST_PP_CAT( \
+ advanced_insert_aux_non_movable_emplace, n), arg) \
+ <A, Iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P) > base_t; \
+ typedef typename base_t::value_type value_type; \
+ typedef typename base_t::difference_type difference_type; \
+ \
+ BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
+ ( A &a BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _) ) \
+ : base_t(a BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ) \
+ {} \
+ \
+ virtual void copy_remaining_to(Iterator p) \
+ { \
+ if(!this->used_){ \
+ value_type v BOOST_PP_LPAREN_IF(n) \
+ BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _) \
+ BOOST_PP_RPAREN_IF(n); \
+ *p = boost::move(v); \
+ this->used_ = true; \
+ } \
+ } \
+ \
+ virtual void copy_some_and_update \
+ (Iterator p, difference_type division_count, bool first_n) \
+ { \
+ BOOST_ASSERT(division_count <=1); \
+ if((first_n && division_count == 1) || (!first_n && division_count == 0)){ \
+ if(!this->used_){ \
+ value_type v BOOST_PP_LPAREN_IF(n) \
+ BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _) \
+ BOOST_PP_RPAREN_IF(n); \
+ *p = boost::move(v); \
+ this->used_ = true; \
+ } \
+ } \
+ } \
+}; \
 //!
 
-#define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
 #include BOOST_PP_LOCAL_ITERATE()
 
-}}} //namespace boost { namespace container { namespace containers_detail {
+}}} //namespace boost { namespace container { namespace container_detail {
 
-#endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+#endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif //#ifndef BOOST_CONTAINERS_ADVANCED_INSERT_INT_HPP
+#endif //#ifndef BOOST_CONTAINER_ADVANCED_INSERT_INT_HPP

Modified: trunk/boost/container/detail/algorithms.hpp
==============================================================================
--- trunk/boost/container/detail/algorithms.hpp (original)
+++ trunk/boost/container/detail/algorithms.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -10,8 +10,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_ALGORITHMS_HPP
-#define BOOST_CONTAINERS_DETAIL_ALGORITHMS_HPP
+#ifndef BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP
+#define BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -23,7 +23,6 @@
 #include <boost/type_traits/has_trivial_copy.hpp>
 #include <boost/type_traits/has_trivial_assign.hpp>
 #include <boost/detail/no_exceptions_support.hpp>
-#include <boost/get_pointer.hpp>
 
 #include <boost/container/detail/type_traits.hpp>
 #include <boost/container/detail/mpl.hpp>
@@ -33,56 +32,25 @@
 #include <cstring>
 
 namespace boost {
-namespace container {
+namespace container {
 
-#if defined(BOOST_NO_RVALUE_REFERENCES)
-template<class T>
-struct has_own_construct_from_it
-{
- static const bool value = false;
-};
-
-namespace containers_detail {
+template<class A, class T, class InpIt>
+inline void construct_in_place(A &a, T* dest, InpIt source)
+{ boost::container::allocator_traits<A>::construct(a, dest, *source); }
+//#endif
 
-template<class T, class InpIt>
-inline void construct_in_place_impl(T* dest, const InpIt &source, containers_detail::true_)
+template<class A, class T, class U, class D>
+inline void construct_in_place(A &a, T *dest, default_construct_iterator<U, D>)
 {
- T::construct(dest, *source);
+ boost::container::allocator_traits<A>::construct(a, dest);
 }
 
-template<class T, class InpIt>
-inline void construct_in_place_impl(T* dest, const InpIt &source, containers_detail::false_)
+template<class A, class T, class U, class EF, class D>
+inline void construct_in_place(A &a, T *dest, emplace_iterator<U, EF, D> ei)
 {
- new((void*)dest)T(*source);
+ ei.construct_in_place(a, dest);
 }
-
-} //namespace containers_detail {
-
-template<class T, class InpIt>
-inline void construct_in_place(T* dest, InpIt source)
-{
- typedef containers_detail::bool_<has_own_construct_from_it<T>::value> boolean_t;
- containers_detail::construct_in_place_impl(dest, source, boolean_t());
-}
-
-#else
-template<class T, class InpIt>
-inline void construct_in_place(T* dest, InpIt source)
-{ ::new((void*)dest)T(*source); }
-#endif
-
-template<class T, class U, class D>
-inline void construct_in_place(T *dest, default_construct_iterator<U, D>)
-{
- ::new((void*)dest)T();
-}
-
-template<class T, class U, class E, class D>
-inline void construct_in_place(T *dest, emplace_iterator<U, E, D> ei)
-{
- ei.construct_in_place(dest);
-}
-
+/*
 template<class InIt, class OutIt>
 struct optimize_assign
 {
@@ -118,7 +86,7 @@
 {};
 
 template<class InIt, class OutIt> inline
-OutIt copy_n_dispatch(InIt first, typename std::iterator_traits<InIt>::difference_type length, OutIt dest, containers_detail::bool_<false>)
+OutIt copy_n_dispatch(InIt first, typename std::iterator_traits<InIt>::difference_type length, OutIt dest, container_detail::bool_<false>)
 {
    for (; length--; ++dest, ++first)
       *dest = *first;
@@ -126,7 +94,7 @@
 }
 
 template<class T> inline
-T *copy_n_dispatch(const T *first, typename std::iterator_traits<const T*>::difference_type length, T *dest, containers_detail::bool_<true>)
+T *copy_n_dispatch(const T *first, typename std::iterator_traits<const T*>::difference_type length, T *dest, container_detail::bool_<true>)
 {
    std::size_t size = length*sizeof(T);
    return (static_cast<T*>(std::memmove(dest, first, size))) + size;
@@ -136,14 +104,14 @@
 OutIt copy_n(InIt first, typename std::iterator_traits<InIt>::difference_type length, OutIt dest)
 {
    const bool do_optimized_assign = optimize_assign<InIt, OutIt>::value;
- return copy_n_dispatch(first, length, dest, containers_detail::bool_<do_optimized_assign>());
+ return copy_n_dispatch(first, length, dest, container_detail::bool_<do_optimized_assign>());
 }
 
 template<class InIt, class FwdIt> inline
 FwdIt uninitialized_copy_n_dispatch
    (InIt first,
     typename std::iterator_traits<InIt>::difference_type count,
- FwdIt dest, containers_detail::bool_<false>)
+ FwdIt dest, container_detail::bool_<false>)
 {
    typedef typename std::iterator_traits<FwdIt>::value_type value_type;
    //Save initial destination position
@@ -153,14 +121,14 @@
    BOOST_TRY{
       //Try to build objects
       for (; --new_count; ++dest, ++first){
- construct_in_place(containers_detail::get_pointer(&*dest), first);
+ construct_in_place(container_detail::to_raw_pointer(&*dest), first);
       }
    }
    BOOST_CATCH(...){
       //Call destructors
       new_count = count - new_count;
       for (; new_count--; ++dest_init){
- containers_detail::get_pointer(&*dest_init)->~value_type();
+ container_detail::to_raw_pointer(&*dest_init)->~value_type();
       }
       BOOST_RETHROW
    }
@@ -168,7 +136,7 @@
    return dest;
 }
 template<class T> inline
-T *uninitialized_copy_n_dispatch(const T *first, typename std::iterator_traits<const T*>::difference_type length, T *dest, containers_detail::bool_<true>)
+T *uninitialized_copy_n_dispatch(const T *first, typename std::iterator_traits<const T*>::difference_type length, T *dest, container_detail::bool_<true>)
 {
    std::size_t size = length*sizeof(T);
    return (static_cast<T*>(std::memmove(dest, first, size))) + size;
@@ -181,7 +149,7 @@
     FwdIt dest)
 {
    const bool do_optimized_copy = optimize_copy<InIt, FwdIt>::value;
- return uninitialized_copy_n_dispatch(first, count, dest, containers_detail::bool_<do_optimized_copy>());
+ return uninitialized_copy_n_dispatch(first, count, dest, container_detail::bool_<do_optimized_copy>());
 }
 
 // uninitialized_copy_copy
@@ -199,17 +167,17 @@
    }
    BOOST_CATCH(...){
       for(;result != mid; ++result){
- containers_detail::get_pointer(&*result)->~value_type();
+ container_detail::to_raw_pointer(&*result)->~value_type();
       }
       BOOST_RETHROW
    }
    BOOST_CATCH_END
 }
-
+*/
 } //namespace container {
 } //namespace boost {
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif //#ifndef BOOST_CONTAINERS_DETAIL_ALGORITHMS_HPP
+#endif //#ifndef BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP
 

Modified: trunk/boost/container/detail/allocation_type.hpp
==============================================================================
--- trunk/boost/container/detail/allocation_type.hpp (original)
+++ trunk/boost/container/detail/allocation_type.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,8 +8,8 @@
 //
 ///////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_ALLOCATION_TYPE_HPP
-#define BOOST_CONTAINERS_ALLOCATION_TYPE_HPP
+#ifndef BOOST_CONTAINER_ALLOCATION_TYPE_HPP
+#define BOOST_CONTAINER_ALLOCATION_TYPE_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -51,4 +51,4 @@
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif //BOOST_CONTAINERS_ALLOCATION_TYPE_HPP
+#endif //BOOST_CONTAINER_ALLOCATION_TYPE_HPP

Modified: trunk/boost/container/detail/config_begin.hpp
==============================================================================
--- trunk/boost/container/detail/config_begin.hpp (original)
+++ trunk/boost/container/detail/config_begin.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -7,15 +7,15 @@
 // See http://www.boost.org/libs/container for documentation.
 //
 //////////////////////////////////////////////////////////////////////////////
-#ifndef BOOST_CONTAINERS_CONTAINER_DETAIL_CONFIG_INCLUDED
-#define BOOST_CONTAINERS_CONTAINER_DETAIL_CONFIG_INCLUDED
+#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED
+#define BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED
 #include <boost/config.hpp>
 
-#endif //BOOST_CONTAINERS_CONTAINER_DETAIL_CONFIG_INCLUDED
+#endif //BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED
 
 #ifdef BOOST_MSVC
    #ifndef _CRT_SECURE_NO_DEPRECATE
- #define BOOST_CONTAINERS_DETAIL_CRT_SECURE_NO_DEPRECATE
+ #define BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE
    #define _CRT_SECURE_NO_DEPRECATE
    #endif
    #pragma warning (push)

Modified: trunk/boost/container/detail/config_end.hpp
==============================================================================
--- trunk/boost/container/detail/config_end.hpp (original)
+++ trunk/boost/container/detail/config_end.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -9,8 +9,8 @@
 //////////////////////////////////////////////////////////////////////////////
 #if defined BOOST_MSVC
    #pragma warning (pop)
- #ifdef BOOST_CONTAINERS_DETAIL_CRT_SECURE_NO_DEPRECATE
- #undef BOOST_CONTAINERS_DETAIL_CRT_SECURE_NO_DEPRECATE
+ #ifdef BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE
+ #undef BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE
    #undef _CRT_SECURE_NO_DEPRECATE
    #endif
 #endif

Modified: trunk/boost/container/detail/destroyers.hpp
==============================================================================
--- trunk/boost/container/detail/destroyers.hpp (original)
+++ trunk/boost/container/detail/destroyers.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -10,8 +10,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DESTROYERS_HPP
-#define BOOST_CONTAINERS_DESTROYERS_HPP
+#ifndef BOOST_CONTAINER_DESTROYERS_HPP
+#define BOOST_CONTAINER_DESTROYERS_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -21,18 +21,20 @@
 #include <boost/container/detail/workaround.hpp>
 #include <boost/container/detail/version_type.hpp>
 #include <boost/container/detail/utilities.hpp>
+#include <boost/container/allocator/allocator_traits.hpp>
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 //!A deleter for scoped_ptr that deallocates the memory
 //!allocated for an array of objects using a STL allocator.
 template <class Allocator>
 struct scoped_array_deallocator
 {
- typedef typename Allocator::pointer pointer;
- typedef typename Allocator::size_type size_type;
+ typedef boost::container::allocator_traits<Allocator> AllocTraits;
+ typedef typename AllocTraits::pointer pointer;
+ typedef typename AllocTraits::size_type size_type;
 
    scoped_array_deallocator(pointer p, Allocator& a, size_type length)
       : m_ptr(p), m_alloc(a), m_length(length) {}
@@ -52,8 +54,9 @@
 template <class Allocator>
 struct null_scoped_array_deallocator
 {
- typedef typename Allocator::pointer pointer;
- typedef typename Allocator::size_type size_type;
+ typedef boost::container::allocator_traits<Allocator> AllocTraits;
+ typedef typename AllocTraits::pointer pointer;
+ typedef typename AllocTraits::size_type size_type;
 
    null_scoped_array_deallocator(pointer, Allocator&, size_type)
    {}
@@ -68,15 +71,13 @@
 template <class Allocator>
 struct scoped_destructor_n
 {
- typedef typename Allocator::pointer pointer;
- typedef typename Allocator::value_type value_type;
- typedef typename Allocator::size_type size_type;
+ typedef boost::container::allocator_traits<Allocator> AllocTraits;
+ typedef typename AllocTraits::pointer pointer;
+ typedef typename AllocTraits::value_type value_type;
+ typedef typename AllocTraits::size_type size_type;
 
- pointer m_p;
- size_type m_n;
-
- scoped_destructor_n(pointer p, size_type n)
- : m_p(p), m_n(n)
+ scoped_destructor_n(pointer p, Allocator& a, size_type n)
+ : m_p(p), m_a(a), m_n(n)
    {}
 
    void release()
@@ -88,10 +89,15 @@
    ~scoped_destructor_n()
    {
       if(!m_p) return;
- value_type *raw_ptr = containers_detail::get_pointer(m_p);
+ value_type *raw_ptr = container_detail::to_raw_pointer(m_p);
       for(size_type i = 0; i < m_n; ++i, ++raw_ptr)
- raw_ptr->~value_type();
+ AllocTraits::destroy(m_a, raw_ptr);
    }
+
+ private:
+ pointer m_p;
+ Allocator & m_a;
+ size_type m_n;
 };
 
 //!A deleter for scoped_ptr that destroys
@@ -99,10 +105,11 @@
 template <class Allocator>
 struct null_scoped_destructor_n
 {
- typedef typename Allocator::pointer pointer;
- typedef typename Allocator::size_type size_type;
+ typedef boost::container::allocator_traits<Allocator> AllocTraits;
+ typedef typename AllocTraits::pointer pointer;
+ typedef typename AllocTraits::size_type size_type;
 
- null_scoped_destructor_n(pointer, size_type)
+ null_scoped_destructor_n(pointer, Allocator&, size_type)
    {}
 
    void increment_size(size_type)
@@ -112,43 +119,45 @@
    {}
 };
 
-template <class A>
+template <class Allocator>
 class allocator_destroyer
 {
- typedef typename A::value_type value_type;
- typedef containers_detail::integral_constant<unsigned,
- boost::container::containers_detail::
- version<A>::value> alloc_version;
- typedef containers_detail::integral_constant<unsigned, 1> allocator_v1;
- typedef containers_detail::integral_constant<unsigned, 2> allocator_v2;
+ typedef boost::container::allocator_traits<Allocator> AllocTraits;
+ typedef typename AllocTraits::value_type value_type;
+ typedef typename AllocTraits::pointer pointer;
+ typedef container_detail::integral_constant<unsigned,
+ boost::container::container_detail::
+ version<Allocator>::value> alloc_version;
+ typedef container_detail::integral_constant<unsigned, 1> allocator_v1;
+ typedef container_detail::integral_constant<unsigned, 2> allocator_v2;
 
    private:
- A & a_;
+ Allocator & a_;
 
    private:
- void priv_deallocate(const typename A::pointer &p, allocator_v1)
- { a_.deallocate(p, 1); }
+ void priv_deallocate(const pointer &p, allocator_v1)
+ { AllocTraits::deallocate(a_,p, 1); }
 
- void priv_deallocate(const typename A::pointer &p, allocator_v2)
+ void priv_deallocate(const pointer &p, allocator_v2)
    { a_.deallocate_one(p); }
 
    public:
- allocator_destroyer(A &a)
- : a_(a)
+ allocator_destroyer(Allocator &a)
+ : a_(a)
    {}
 
- void operator()(const typename A::pointer &p)
- {
- containers_detail::get_pointer(p)->~value_type();
+ void operator()(const pointer &p)
+ {
+ AllocTraits::destroy(a_, container_detail::to_raw_pointer(p));
       priv_deallocate(p, alloc_version());
    }
 };
 
 
-} //namespace containers_detail {
+} //namespace container_detail {
 } //namespace container {
 } //namespace boost {
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif //#ifndef BOOST_CONTAINERS_DESTROYERS_HPP
+#endif //#ifndef BOOST_CONTAINER_DESTROYERS_HPP

Modified: trunk/boost/container/detail/flat_tree.hpp
==============================================================================
--- trunk/boost/container/detail/flat_tree.hpp (original)
+++ trunk/boost/container/detail/flat_tree.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,8 +8,8 @@
 //
 ////////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_FLAT_TREE_HPP
-#define BOOST_CONTAINERS_FLAT_TREE_HPP
+#ifndef BOOST_CONTAINER_FLAT_TREE_HPP
+#define BOOST_CONTAINER_FLAT_TREE_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -37,7 +37,7 @@
 
 namespace container {
 
-namespace containers_detail {
+namespace container_detail {
 
 template<class Compare, class Value, class KeyOfValue>
 class flat_tree_value_compare
@@ -47,6 +47,10 @@
    typedef Value second_argument_type;
    typedef bool return_type;
    public:
+ flat_tree_value_compare()
+ : Compare()
+ {}
+
    flat_tree_value_compare(const Compare &pred)
       : Compare(pred)
    {}
@@ -67,9 +71,9 @@
 template<class Pointer>
 struct get_flat_tree_iterators
 {
- typedef typename containers_detail::
+ typedef typename container_detail::
       vector_iterator<Pointer> iterator;
- typedef typename containers_detail::
+ typedef typename container_detail::
       vector_const_iterator<Pointer> const_iterator;
    typedef std::reverse_iterator<iterator> reverse_iterator;
    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
@@ -90,23 +94,29 @@
       //Inherit from value_compare to do EBO
       : public value_compare
    {
- private:
       BOOST_COPYABLE_AND_MOVABLE(Data)
+
       public:
+ Data()
+ : value_compare(), m_vect()
+ {}
+
       Data(const Data &d)
          : value_compare(d), m_vect(d.m_vect)
       {}
- Data(const Compare &comp,
- const vector_t &vect)
- : value_compare(comp), m_vect(vect){}
 
- Data(const value_compare &comp,
- const vector_t &vect)
- : value_compare(comp), m_vect(vect){}
+ Data(BOOST_RV_REF(Data) d)
+ : value_compare(boost::move(d)), m_vect(boost::move(d.m_vect))
+ {}
+
+ Data(const Compare &comp)
+ : value_compare(comp), m_vect()
+ {}
 
       Data(const Compare &comp,
            const allocator_t &alloc)
- : value_compare(comp), m_vect(alloc){}
+ : value_compare(comp), m_vect(alloc)
+ {}
 
       Data& operator=(BOOST_COPY_ASSIGN_REF(Data) d)
       {
@@ -122,6 +132,13 @@
          return *this;
       }
 
+ void swap(Data &d)
+ {
+ value_compare& mycomp = *this, & othercomp = d;
+ container_detail::do_swap(mycomp, othercomp);
+ this->m_vect.swap(d.m_vect);
+ }
+
       vector_t m_vect;
    };
 
@@ -138,23 +155,30 @@
    typedef Key key_type;
    typedef Compare key_compare;
    typedef typename vector_t::allocator_type allocator_type;
- typedef allocator_type stored_allocator_type;
- typedef typename allocator_type::size_type size_type;
- typedef typename allocator_type::difference_type difference_type;
+ typedef typename vector_t::size_type size_type;
+ typedef typename vector_t::difference_type difference_type;
    typedef typename vector_t::iterator iterator;
    typedef typename vector_t::const_iterator const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-
+ typedef typename vector_t::reverse_iterator reverse_iterator;
+ typedef typename vector_t::const_reverse_iterator const_reverse_iterator;
+
+ //!Standard extension
+ typedef allocator_type stored_allocator_type;
+
+ flat_tree()
+ : m_data()
+ { }
+
+ explicit flat_tree(const Compare& comp)
+ : m_data(comp)
+ { }
 
- // allocation/deallocation
- flat_tree(const Compare& comp = Compare(),
- const allocator_type& a = allocator_type())
+ flat_tree(const Compare& comp, const allocator_type& a)
       : m_data(comp, a)
    { }
 
    flat_tree(const flat_tree& x)
- : m_data(x.m_data, x.m_data.m_vect)
+ : m_data(x.m_data)
    { }
 
    flat_tree(BOOST_RV_REF(flat_tree) x)
@@ -237,14 +261,7 @@
    { return this->m_data.m_vect.max_size(); }
 
    void swap(flat_tree& other)
- {
- value_compare& mycomp = this->m_data;
- value_compare& othercomp = other.m_data;
- containers_detail::do_swap(mycomp, othercomp);
- vector_t & myvect = this->m_data.m_vect;
- vector_t & othervect = other.m_data.m_vect;
- myvect.swap(othervect);
- }
+ { this->m_data.swap(other.m_data); }
 
    public:
    // insert/erase
@@ -332,7 +349,7 @@
       priv_insert_equal(first, last, ItCat());
    }
 
- #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    template <class... Args>
    iterator emplace_unique(Args&&... args)
@@ -377,100 +394,69 @@
       return priv_insert_commit(data, boost::move(val));
    }
 
- #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
- iterator emplace_unique()
- {
- containers_detail::value_init<value_type> vval;
- value_type &val = vval.m_t;
- insert_commit_data data;
- std::pair<iterator,bool> ret =
- priv_insert_unique_prepare(val, data);
- if(ret.second){
- ret.first = priv_insert_commit(data, boost::move(val));
- }
- return ret.first;
- }
-
- iterator emplace_hint_unique(const_iterator hint)
- {
- containers_detail::value_init<value_type> vval;
- value_type &val = vval.m_t;
- insert_commit_data data;
- std::pair<iterator,bool> ret = priv_insert_unique_prepare(hint, val, data);
- if(ret.second){
- ret.first = priv_insert_commit(data, boost::move(val));
- }
- return ret.first;
- }
-
- iterator emplace_equal()
- {
- containers_detail::value_init<value_type> vval;
- value_type &val = vval.m_t;
- iterator i = this->upper_bound(KeyOfValue()(val));
- i = this->m_data.m_vect.insert(i, boost::move(val));
- return i;
- }
-
- iterator emplace_hint_equal(const_iterator hint)
- {
- containers_detail::value_init<value_type> vval;
- value_type &val = vval.m_t;
- insert_commit_data data;
- priv_insert_equal_prepare(hint, val, data);
- return priv_insert_commit(data, boost::move(val));
- }
+ #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
- value_type val(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type \
+ BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n) \
+ BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n); \
+ value_type &val = vval; \
       insert_commit_data data; \
       std::pair<iterator,bool> ret = priv_insert_unique_prepare(val, data); \
       if(ret.second){ \
- ret.first = priv_insert_commit(data, boost::move(val)); \
+ ret.first = priv_insert_commit(data, boost::move(val)); \
       } \
       return ret.first; \
    } \
                                                                                           \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace_hint_unique(const_iterator hint, \
- BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace_hint_unique(const_iterator hint \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
- value_type val(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type \
+ BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n) \
+ BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n); \
+ value_type &val = vval; \
       insert_commit_data data; \
       std::pair<iterator,bool> ret = priv_insert_unique_prepare(hint, val, data); \
       if(ret.second){ \
- ret.first = priv_insert_commit(data, boost::move(val)); \
+ ret.first = priv_insert_commit(data, boost::move(val)); \
       } \
       return ret.first; \
    } \
                                                                                           \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
- value_type val(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type \
+ BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n) \
+ BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n); \
+ value_type &val = vval; \
       iterator i = this->upper_bound(KeyOfValue()(val)); \
- i = this->m_data.m_vect.insert(i, boost::move(val)); \
+ i = this->m_data.m_vect.insert(i, boost::move(val)); \
       return i; \
    } \
                                                                                           \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace_hint_equal(const_iterator hint, \
- BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace_hint_equal(const_iterator hint \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
- value_type val(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type \
+ BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n) \
+ BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n); \
+ value_type &val = vval; \
       insert_commit_data data; \
       priv_insert_equal_prepare(hint, val, data); \
- return priv_insert_commit(data, boost::move(val)); \
+ return priv_insert_commit(data, boost::move(val)); \
    } \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    iterator erase(const_iterator position)
    { return this->m_data.m_vect.erase(position); }
@@ -571,8 +557,6 @@
       // insert val before pos
       // else
       // insert val before upper_bound(val)
- // else if pos+1 == end || val <= *(pos+1)
- // insert val after pos
       // else
       // insert val before lower_bound(val)
       const value_compare &value_comp = this->m_data;
@@ -586,10 +570,6 @@
                this->priv_upper_bound(this->cbegin(), pos, KeyOfValue()(val));
          }
       }
- //Works, but increases code complexity
- //else if (++pos == this->end() || !value_comp(*pos, val)){
- // return this->m_data.m_vect.insert(pos, val);
- //}
       else{
          data.position =
             this->priv_lower_bound(pos, this->cend(), KeyOfValue()(val));
@@ -838,7 +818,7 @@
      flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
    { x.swap(y); }
 
-} //namespace containers_detail {
+} //namespace container_detail {
 
 } //namespace container {
 /*
@@ -846,7 +826,7 @@
 //!specialization for optimizations
 template <class K, class V, class KOV,
 class C, class A>
-struct has_trivial_destructor_after_move<boost::container::containers_detail::flat_tree<K, V, KOV, C, A> >
+struct has_trivial_destructor_after_move<boost::container::container_detail::flat_tree<K, V, KOV, C, A> >
 {
    static const bool value = has_trivial_destructor<A>::value && has_trivial_destructor<C>::value;
 };
@@ -855,4 +835,4 @@
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif // BOOST_CONTAINERS_FLAT_TREE_HPP
+#endif // BOOST_CONTAINER_FLAT_TREE_HPP

Added: trunk/boost/container/detail/function_detector.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/container/detail/function_detector.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,88 @@
+/////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2009-2011.
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/container for documentation.
+//
+/////////////////////////////////////////////////////////////////////////////
+// This code was modified from the code posted by Alexandre Courpron in his
+// article "Interface Detection" in The Code Project:
+// http://www.codeproject.com/KB/architecture/Detector.aspx
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2007 Alexandre Courpron
+//
+// Permission to use, copy, modify, redistribute and sell this software,
+// provided that this copyright notice appears on all copies of the software.
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONTAINER_DETAIL_FUNCTION_DETECTOR_HPP
+#define BOOST_CONTAINER_DETAIL_FUNCTION_DETECTOR_HPP
+
+#include <boost/container/detail/config_begin.hpp>
+
+namespace boost {
+namespace container {
+namespace function_detector {
+
+ typedef char NotFoundType;
+ struct StaticFunctionType { NotFoundType x [2]; };
+ struct NonStaticFunctionType { NotFoundType x [3]; };
+
+ enum
+ { NotFound = 0,
+ StaticFunction = sizeof( StaticFunctionType ) - sizeof( NotFoundType ),
+ NonStaticFunction = sizeof( NonStaticFunctionType ) - sizeof( NotFoundType )
+ };
+
+} //namespace boost {
+} //namespace container {
+} //namespace function_detector {
+
+#define BOOST_CONTAINER_CREATE_FUNCTION_DETECTOR(Identifier, InstantiationKey) \
+ namespace boost { \
+ namespace container { \
+ namespace function_detector { \
+ template < class T, \
+ class NonStaticType, \
+ class NonStaticConstType, \
+ class StaticType > \
+ class DetectMember_##InstantiationKey_##Identifier { \
+ template < NonStaticType > \
+ struct TestNonStaticNonConst ; \
+ \
+ template < NonStaticConstType > \
+ struct TestNonStaticConst ; \
+ \
+ template < StaticType > \
+ struct TestStatic ; \
+ \
+ template <class U > \
+ static NonStaticFunctionType Test( TestNonStaticNonConst<&U::Identifier>*, int ); \
+ \
+ template <class U > \
+ static NonStaticFunctionType Test( TestNonStaticConst<&U::Identifier>*, int ); \
+ \
+ template <class U> \
+ static StaticFunctionType Test( TestStatic<&U::Identifier>*, int ); \
+ \
+ template <class U> \
+ static NotFoundType Test( ... ); \
+ public : \
+ static const int check = NotFound + (sizeof(Test<T>(0, 0)) - sizeof(NotFoundType));\
+ };\
+}}} //namespace boost::container::function_detector {
+
+#define BOOST_CONTAINER_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \
+ ::boost::container::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\
+ ReturnType (Class::*)Params,\
+ ReturnType (Class::*)Params const,\
+ ReturnType (*)Params \
+ >::check
+
+#include <boost/container/detail/config_end.hpp>
+
+#endif //@ifndef BOOST_CONTAINER_DETAIL_FUNCTION_DETECTOR_HPP

Modified: trunk/boost/container/detail/iterators.hpp
==============================================================================
--- trunk/boost/container/detail/iterators.hpp (original)
+++ trunk/boost/container/detail/iterators.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -11,8 +11,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_ITERATORS_HPP
-#define BOOST_CONTAINERS_DETAIL_ITERATORS_HPP
+#ifndef BOOST_CONTAINER_DETAIL_ITERATORS_HPP
+#define BOOST_CONTAINER_DETAIL_ITERATORS_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -21,8 +21,9 @@
 #include "config_begin.hpp"
 #include <boost/container/detail/workaround.hpp>
 #include <boost/move/move.hpp>
+#include <boost/container/allocator/allocator_traits.hpp>
 
-#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 #include <boost/container/detail/variadic_templates_tools.hpp>
 #include <boost/container/detail/stored_ref.hpp>
 #else
@@ -368,7 +369,7 @@
    { return m_num - other.m_num; }
 };
 
-template <class T, class E, class Difference /*= std::ptrdiff_t*/>
+template <class T, class EmplaceFunctor, class Difference /*= std::ptrdiff_t*/>
 class emplace_iterator
   : public std::iterator
       <std::random_access_iterator_tag, T, Difference, const T*, const T &>
@@ -377,7 +378,7 @@
 
    public:
    typedef Difference difference_type;
- explicit emplace_iterator(E&e)
+ explicit emplace_iterator(EmplaceFunctor&e)
       : m_num(1), m_pe(&e){}
 
    emplace_iterator()
@@ -453,12 +454,13 @@
    const T* operator->() const
    { return &(dereference()); }
 
- void construct_in_place(T* ptr)
- { (*m_pe)(ptr); }
+ template<class A>
+ void construct_in_place(A &a, T* ptr)
+ { (*m_pe)(a, ptr); }
 
    private:
    difference_type m_num;
- E * m_pe;
+ EmplaceFunctor * m_pe;
 
    void increment()
    { --m_num; }
@@ -485,54 +487,54 @@
    { return difference_type(m_num - other.m_num); }
 };
 
-#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
-template<class T, class ...Args>
+template<class ...Args>
 struct emplace_functor
 {
- typedef typename containers_detail::build_number_seq<sizeof...(Args)>::type index_tuple_t;
+ typedef typename container_detail::build_number_seq<sizeof...(Args)>::type index_tuple_t;
 
    emplace_functor(Args&&... args)
       : args_(args...)
    {}
 
- void operator()(T *ptr)
- { emplace_functor::inplace_impl(ptr, index_tuple_t()); }
+ template<class A, class T>
+ void operator()(A &a, T *ptr)
+ { emplace_functor::inplace_impl(a, ptr, index_tuple_t()); }
 
- template<int ...IdxPack>
- void inplace_impl(T* ptr, const containers_detail::index_tuple<IdxPack...>&)
- { ::new(ptr) T(containers_detail::stored_ref<Args>::forward(containers_detail::get<IdxPack>(args_))...); }
+ template<class A, class T, int ...IdxPack>
+ void inplace_impl(A &a, T* ptr, const container_detail::index_tuple<IdxPack...>&)
+ {
+ allocator_traits<A>::construct
+ (a, ptr, container_detail::stored_ref<Args>::forward
+ (container_detail::get<IdxPack>(args_))...);
+ }
 
- containers_detail::tuple<Args&...> args_;
+ container_detail::tuple<Args&...> args_;
 };
 
 #else
 
-template<class T>
-struct emplace_functor
-{
- emplace_functor()
- {}
- void operator()(T *ptr)
- { new(ptr) T(); }
-};
-
 #define BOOST_PP_LOCAL_MACRO(n) \
- template <class T, BOOST_PP_ENUM_PARAMS(n, class P) > \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS(n, class P) \
+ BOOST_PP_EXPR_IF(n, >) \
    struct BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg) \
    { \
       BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg) \
- ( BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _) ) \
- : BOOST_PP_ENUM(n, BOOST_CONTAINERS_AUX_PARAM_INIT, _) {} \
+ ( BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _) ) \
+ BOOST_PP_EXPR_IF(n, :) BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_INIT, _){} \
                                                                                        \
- void operator()(T *ptr) \
+ template<class A, class T> \
+ void operator()(A &a, T *ptr) \
       { \
- new(ptr)T (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_MEMBER_FORWARD, _)); \
+ allocator_traits<A>::construct \
+ (a, ptr BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _) );\
       } \
- BOOST_PP_REPEAT(n, BOOST_CONTAINERS_AUX_PARAM_DEFINE, _) \
+ BOOST_PP_REPEAT(n, BOOST_CONTAINER_PP_PARAM_DEFINE, _) \
    }; \
    //!
-#define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
 #include BOOST_PP_LOCAL_ITERATE()
 
 #endif
@@ -542,5 +544,5 @@
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif //#ifndef BOOST_CONTAINERS_DETAIL_ITERATORS_HPP
+#endif //#ifndef BOOST_CONTAINER_DETAIL_ITERATORS_HPP
 

Modified: trunk/boost/container/detail/math_functions.hpp
==============================================================================
--- trunk/boost/container/detail/math_functions.hpp (original)
+++ trunk/boost/container/detail/math_functions.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -22,7 +22,7 @@
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 // Greatest common divisor and least common multiple
 
@@ -104,7 +104,7 @@
    return log2;
 }
 
-} // namespace containers_detail
+} // namespace container_detail
 } // namespace container
 } // namespace boost
 

Modified: trunk/boost/container/detail/mpl.hpp
==============================================================================
--- trunk/boost/container/detail/mpl.hpp (original)
+++ trunk/boost/container/detail/mpl.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -10,8 +10,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_CONTAINER_DETAIL_MPL_HPP
-#define BOOST_CONTAINERS_CONTAINER_DETAIL_MPL_HPP
+#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
+#define BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -21,7 +21,7 @@
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 template <class T, T val>
 struct integral_constant
@@ -34,6 +34,7 @@
 struct bool_ : integral_constant<bool, C_>
 {
    static const bool value = C_;
+ operator bool() const { return bool_::value; }
 };
 
 typedef bool_<true> true_;
@@ -147,9 +148,9 @@
    static const std::size_t value = 0;
 };
 
-} //namespace containers_detail {
+} //namespace container_detail {
 } //namespace container {
 } //namespace boost {
 
-#endif //#ifndef BOOST_CONTAINERS_CONTAINER_DETAIL_MPL_HPP
+#endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
 

Modified: trunk/boost/container/detail/multiallocation_chain.hpp
==============================================================================
--- trunk/boost/container/detail/multiallocation_chain.hpp (original)
+++ trunk/boost/container/detail/multiallocation_chain.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_MULTIALLOCATION_CHAIN_HPP
-#define BOOST_CONTAINERS_DETAIL_MULTIALLOCATION_CHAIN_HPP
+#ifndef BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP
+#define BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP
 
 #include "config_begin.hpp"
 #include <boost/container/container_fwd.hpp>
@@ -17,13 +17,13 @@
 #include <boost/container/detail/type_traits.hpp>
 #include <boost/container/detail/transform_iterator.hpp>
 #include <boost/intrusive/slist.hpp>
-#include <boost/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/type_traits/make_unsigned.hpp>
 #include <boost/move/move.hpp>
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 template<class VoidPointer>
 class basic_multiallocation_chain
@@ -33,8 +33,10 @@
                         ,bi::link_mode<bi::normal_link>
> node;
 
- typedef typename boost::pointer_to_other<VoidPointer, char>::type char_ptr;
- typedef typename std::iterator_traits<char_ptr>::difference_type difference_type;
+ typedef typename boost::intrusive::pointer_traits
+ <VoidPointer>::template rebind_pointer<char>::type char_ptr;
+ typedef typename boost::intrusive::
+ pointer_traits<char_ptr>::difference_type difference_type;
 
    typedef bi::slist< node
                     , bi::linear<true>
@@ -44,7 +46,7 @@
    slist_impl_t slist_impl_;
 
    static node & to_node(VoidPointer p)
- { return *static_cast<node*>(static_cast<void*>(containers_detail::get_pointer(p))); }
+ { return *static_cast<node*>(static_cast<void*>(container_detail::to_raw_pointer(p))); }
 
    BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain)
 
@@ -140,7 +142,7 @@
 template<class T>
 struct cast_functor
 {
- typedef typename containers_detail::add_reference<T>::type result_type;
+ typedef typename container_detail::add_reference<T>::type result_type;
    template<class U>
    result_type operator()(U &ptr) const
    { return *static_cast<T*>(static_cast<void*>(&ptr)); }
@@ -154,18 +156,18 @@
 
    MultiallocationChain holder_;
    typedef typename MultiallocationChain::void_pointer void_pointer;
- typedef typename boost::pointer_to_other
- <void_pointer, T>::type pointer;
+ typedef typename boost::intrusive::pointer_traits
+ <void_pointer>::template rebind_pointer<T>::type pointer;
 
    static pointer cast(void_pointer p)
    {
- return pointer(static_cast<T*>(containers_detail::get_pointer(p)));
+ return pointer(static_cast<T*>(container_detail::to_raw_pointer(p)));
    }
 
    public:
    typedef transform_iterator
       < typename MultiallocationChain::iterator
- , containers_detail::cast_functor <T> > iterator;
+ , container_detail::cast_functor <T> > iterator;
    typedef typename MultiallocationChain::size_type size_type;
 
    transform_multiallocation_chain()
@@ -243,10 +245,10 @@
 
 }}}
 
-// namespace containers_detail {
+// namespace container_detail {
 // namespace container {
 // namespace boost {
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif //BOOST_CONTAINERS_DETAIL_MULTIALLOCATION_CHAIN_HPP
+#endif //BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP

Modified: trunk/boost/container/detail/node_alloc_holder.hpp
==============================================================================
--- trunk/boost/container/detail/node_alloc_holder.hpp (original)
+++ trunk/boost/container/detail/node_alloc_holder.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_NODE_ALLOC_HPP_
-#define BOOST_CONTAINERS_DETAIL_NODE_ALLOC_HPP_
+#ifndef BOOST_CONTAINER_DETAIL_NODE_ALLOC_HPP_
+#define BOOST_CONTAINER_DETAIL_NODE_ALLOC_HPP_
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -27,10 +27,11 @@
 #include <boost/container/detail/version_type.hpp>
 #include <boost/container/detail/type_traits.hpp>
 #include <boost/container/detail/utilities.hpp>
+#include <boost/container/allocator/allocator_traits.hpp>
 #include <boost/container/detail/mpl.hpp>
 #include <boost/container/detail/destroyers.hpp>
 
-#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
+#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 #include <boost/container/detail/preprocessor.hpp>
 #endif
 
@@ -39,19 +40,20 @@
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 //!A deleter for scoped_ptr that deallocates the memory
 //!allocated for an object using a STL allocator.
-template <class Allocator>
+template <class A>
 struct scoped_deallocator
 {
- typedef typename Allocator::pointer pointer;
- typedef containers_detail::integral_constant<unsigned,
- boost::container::containers_detail::
- version<Allocator>::value> alloc_version;
- typedef containers_detail::integral_constant<unsigned, 1> allocator_v1;
- typedef containers_detail::integral_constant<unsigned, 2> allocator_v2;
+ typedef allocator_traits<A> allocator_traits_type;
+ typedef typename allocator_traits_type::pointer pointer;
+ typedef container_detail::integral_constant<unsigned,
+ boost::container::container_detail::
+ version<A>::value> alloc_version;
+ typedef container_detail::integral_constant<unsigned, 1> allocator_v1;
+ typedef container_detail::integral_constant<unsigned, 2> allocator_v2;
 
    private:
    void priv_deallocate(allocator_v1)
@@ -65,9 +67,9 @@
    public:
 
    pointer m_ptr;
- Allocator& m_alloc;
+ A& m_alloc;
 
- scoped_deallocator(pointer p, Allocator& a)
+ scoped_deallocator(pointer p, A& a)
       : m_ptr(p), m_alloc(a)
    {}
 
@@ -88,7 +90,8 @@
 template <class A>
 class allocator_destroyer_and_chain_builder
 {
- typedef typename A::value_type value_type;
+ typedef allocator_traits<A> allocator_traits_type;
+ typedef typename allocator_traits_type::value_type value_type;
    typedef typename A::multiallocation_chain multiallocation_chain;
 
    A & a_;
@@ -100,17 +103,17 @@
    {}
 
    void operator()(const typename A::pointer &p)
- {
- value_type *vp = containers_detail::get_pointer(p);
- vp->~value_type();
- c_.push_front(vp);
+ {
+ allocator_traits<A>::destroy(a_, container_detail::to_raw_pointer(p));
+ c_.push_front(p);
    }
 };
 
 template <class A>
 class allocator_multialloc_chain_node_deallocator
 {
- typedef typename A::value_type value_type;
+ typedef allocator_traits<A> allocator_traits_type;
+ typedef typename allocator_traits_type::value_type value_type;
    typedef typename A::multiallocation_chain multiallocation_chain;
    typedef allocator_destroyer_and_chain_builder<A> chain_builder;
 
@@ -132,7 +135,6 @@
    }
 };
 
-
 template<class ValueCompare, class Node>
 struct node_compare
    : private ValueCompare
@@ -155,70 +157,90 @@
    { return ValueCompare::operator()(a.get_data(), b.get_data()); }
 };
 
-template<class A, class ICont>
+template<class A, class ICont, class Pred = container_detail::nat>
 struct node_alloc_holder
 {
- typedef node_alloc_holder<A, ICont> self_t;
- typedef typename A::value_type value_type;
- typedef typename ICont::value_type Node;
- typedef typename A::template rebind<Node>::other NodeAlloc;
- typedef A ValAlloc;
- typedef typename NodeAlloc::pointer NodePtr;
- typedef containers_detail::scoped_deallocator<NodeAlloc> Deallocator;
- typedef typename NodeAlloc::size_type size_type;
- typedef typename NodeAlloc::difference_type difference_type;
- typedef containers_detail::integral_constant<unsigned, 1> allocator_v1;
- typedef containers_detail::integral_constant<unsigned, 2> allocator_v2;
- typedef containers_detail::integral_constant<unsigned,
- boost::container::containers_detail::
+ typedef allocator_traits<A> allocator_traits_type;
+ typedef node_alloc_holder<A, ICont> self_t;
+ typedef typename allocator_traits_type::value_type value_type;
+ typedef typename ICont::value_type Node;
+ typedef typename allocator_traits_type::template
+ portable_rebind_alloc<Node>::type NodeAlloc;
+ typedef allocator_traits<NodeAlloc> node_allocator_traits_type;
+ typedef A ValAlloc;
+ typedef typename node_allocator_traits_type::pointer NodePtr;
+ typedef container_detail::scoped_deallocator<NodeAlloc> Deallocator;
+ typedef typename node_allocator_traits_type::size_type size_type;
+ typedef typename node_allocator_traits_type::difference_type difference_type;
+ typedef container_detail::integral_constant<unsigned, 1> allocator_v1;
+ typedef container_detail::integral_constant<unsigned, 2> allocator_v2;
+ typedef container_detail::integral_constant<unsigned,
+ boost::container::container_detail::
          version<NodeAlloc>::value> alloc_version;
    typedef typename ICont::iterator icont_iterator;
    typedef typename ICont::const_iterator icont_citerator;
    typedef allocator_destroyer<NodeAlloc> Destroyer;
+ typedef allocator_traits<NodeAlloc> NodeAllocTraits;
 
    private:
    BOOST_COPYABLE_AND_MOVABLE(node_alloc_holder)
 
    public:
 
- node_alloc_holder(const ValAlloc &a)
+ //Constructors for sequence containers
+ node_alloc_holder()
+ : members_()
+ {}
+
+ explicit node_alloc_holder(const ValAlloc &a)
       : members_(a)
    {}
 
- node_alloc_holder(const node_alloc_holder &other)
- : members_(other.node_alloc())
+ explicit node_alloc_holder(const node_alloc_holder &x)
+ : members_(NodeAllocTraits::select_on_container_copy_construction(x.node_alloc()))
    {}
 
- node_alloc_holder(BOOST_RV_REF(node_alloc_holder) other)
- : members_(boost::move(other.node_alloc()))
- { this->swap(other); }
-
- node_alloc_holder & operator=(BOOST_COPY_ASSIGN_REF(node_alloc_holder) other)
- { members_.assign(other.node_alloc()); }
-
- node_alloc_holder & operator=(BOOST_RV_REF(node_alloc_holder) other)
- { members_.assign(other.node_alloc()); }
-
- template<class Pred>
- node_alloc_holder(const ValAlloc &a, const Pred &c)
- : members_(a, typename ICont::value_compare(c))
+ explicit node_alloc_holder(BOOST_RV_REF(node_alloc_holder) x)
+ : members_(boost::move(x.node_alloc()))
+ { this->icont().swap(x.icont()); }
+
+ //Constructors for associative containers
+ explicit node_alloc_holder(const ValAlloc &a, const Pred &c)
+ : members_(a, c)
    {}
 
- template<class Pred>
- node_alloc_holder(BOOST_RV_REF(ValAlloc) a, const Pred &c)
- : members_(a, typename ICont::value_compare(c))
+ explicit node_alloc_holder(const node_alloc_holder &x, const Pred &c)
+ : members_(NodeAllocTraits::select_on_container_copy_construction(x.node_alloc()), c)
    {}
 
- template<class Pred>
- node_alloc_holder(const node_alloc_holder &other, const Pred &c)
- : members_(other.node_alloc(), typename ICont::value_compare(c))
+ explicit node_alloc_holder(const Pred &c)
+ : members_(c)
    {}
 
+ //helpers for move assignments
+ explicit node_alloc_holder(BOOST_RV_REF(node_alloc_holder) x, const Pred &c)
+ : members_(boost::move(x.node_alloc()), c)
+ { this->icont().swap(x.icont()); }
+
+ void copy_assign_alloc(const node_alloc_holder &x)
+ {
+ container_detail::bool_<allocator_traits_type::propagate_on_container_copy_assignment::value> flag;
+ container_detail::assign_alloc( static_cast<NodeAlloc &>(this->members_)
+ , static_cast<const NodeAlloc &>(x.members_), flag);
+ }
+
+ void move_assign_alloc( node_alloc_holder &x)
+ {
+ container_detail::bool_<allocator_traits_type::propagate_on_container_move_assignment::value> flag;
+ container_detail::move_alloc( static_cast<NodeAlloc &>(this->members_)
+ , static_cast<NodeAlloc &>(x.members_), flag);
+ }
+
    ~node_alloc_holder()
    { this->clear(alloc_version()); }
 
    size_type max_size() const
- { return this->node_alloc().max_size(); }
+ { return allocator_traits_type::max_size(this->node_alloc()); }
 
    NodePtr allocate_one()
    { return this->allocate_one(alloc_version()); }
@@ -229,131 +251,100 @@
    NodePtr allocate_one(allocator_v2)
    { return this->node_alloc().allocate_one(); }
 
- void deallocate_one(NodePtr p)
+ void deallocate_one(const NodePtr &p)
    { return this->deallocate_one(p, alloc_version()); }
 
- void deallocate_one(NodePtr p, allocator_v1)
+ void deallocate_one(const NodePtr &p, allocator_v1)
    { this->node_alloc().deallocate(p, 1); }
 
- void deallocate_one(NodePtr p, allocator_v2)
+ void deallocate_one(const NodePtr &p, allocator_v2)
    { this->node_alloc().deallocate_one(p); }
-
- template<class Convertible1, class Convertible2>
- static void construct(const NodePtr &ptr,
+/*
+ template<class A, class Convertible1, class Convertible2>
+ static void construct(A &a, const NodePtr &ptr,
       BOOST_RV_REF_2_TEMPL_ARGS(std::pair, Convertible1, Convertible2) value)
- {
+ {
       typedef typename Node::hook_type hook_type;
       typedef typename Node::value_type::first_type first_type;
       typedef typename Node::value_type::second_type second_type;
- Node *nodeptr = containers_detail::get_pointer(ptr);
+ Node *nodeptr = container_detail::to_raw_pointer(ptr);
 
       //Hook constructor does not throw
- new(static_cast<hook_type*>(nodeptr))hook_type();
+ allocator_traits<A>::construct(a, static_cast<hook_type*>(nodeptr));
+
       //Now construct pair members_holder
       value_type *valueptr = &nodeptr->get_data();
- new((void*)&valueptr->first) first_type(boost::move(value.first));
+ allocator_traits<A>::construct(a, &valueptr->first, boost::move(value.first));
       BOOST_TRY{
- new((void*)&valueptr->second) second_type(boost::move(value.second));
+ allocator_traits<A>::construct(a, &valueptr->second, boost::move(value.second));
       }
       BOOST_CATCH(...){
- valueptr->first.~first_type();
- static_cast<hook_type*>(nodeptr)->~hook_type();
+ allocator_traits<A>::destroy(a, &valueptr->first);
          BOOST_RETHROW
       }
       BOOST_CATCH_END
    }
-
- static void destroy(const NodePtr &ptr)
- { containers_detail::get_pointer(ptr)->~Node(); }
-
- Deallocator create_node_and_deallocator()
- {
- return Deallocator(this->allocate_one(), this->node_alloc());
+*/
+ #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+/*
+ template<class A, class ...Args>
+ static void construct(A &a, const NodePtr &ptr, Args &&...args)
+ {
    }
-
- #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
- template<class ...Args>
- static void construct(const NodePtr &ptr, Args &&...args)
- { new((void*)containers_detail::get_pointer(ptr)) Node(boost::forward<Args>(args)...); }
-
+*/
    template<class ...Args>
    NodePtr create_node(Args &&...args)
    {
       NodePtr p = this->allocate_one();
       Deallocator node_deallocator(p, this->node_alloc());
- self_t::construct(p, boost::forward<Args>(args)...);
+ allocator_traits<NodeAlloc>::construct
+ (this->node_alloc(), container_detail::to_raw_pointer(p), boost::forward<Args>(args)...);
       node_deallocator.release();
       return (p);
    }
 
- #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
- static void construct(const NodePtr &ptr)
- { new((void*)containers_detail::get_pointer(ptr)) Node(); }
-
- NodePtr create_node()
- {
- NodePtr p = this->allocate_one();
- Deallocator node_deallocator(p, this->node_alloc());
- self_t::construct(p);
- node_deallocator.release();
- return (p);
- }
-
- #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- void construct(const NodePtr &ptr, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { \
- new((void*)containers_detail::get_pointer(ptr)) \
- Node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
- } \
- //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
- #include BOOST_PP_LOCAL_ITERATE()
+ #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- NodePtr create_node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ NodePtr create_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
       NodePtr p = this->allocate_one(); \
       Deallocator node_deallocator(p, this->node_alloc()); \
- self_t::construct(p, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ allocator_traits<NodeAlloc>::construct \
+ (this->node_alloc(), container_detail::to_raw_pointer(p) \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
       node_deallocator.release(); \
       return (p); \
    } \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    template<class It>
- NodePtr create_node_from_it(It it)
+ NodePtr create_node_from_it(const It &it)
    {
       NodePtr p = this->allocate_one();
       Deallocator node_deallocator(p, this->node_alloc());
- ::boost::container::construct_in_place(containers_detail::get_pointer(p), it);
+ ::boost::container::construct_in_place(this->node_alloc(), container_detail::to_raw_pointer(p), it);
       node_deallocator.release();
       return (p);
    }
 
- void destroy_node(NodePtr node)
+ void destroy_node(const NodePtr &nodep)
    {
- self_t::destroy(node);
- this->deallocate_one(node);
+ allocator_traits<NodeAlloc>::destroy(this->node_alloc(), container_detail::to_raw_pointer(nodep));
+ this->deallocate_one(nodep);
    }
 
    void swap(node_alloc_holder &x)
    {
- NodeAlloc& this_alloc = this->node_alloc();
- NodeAlloc& other_alloc = x.node_alloc();
-
- if (this_alloc != other_alloc){
- containers_detail::do_swap(this_alloc, other_alloc);
- }
-
       this->icont().swap(x.icont());
+ container_detail::bool_<allocator_traits_type::propagate_on_container_swap::value> flag;
+ container_detail::swap_alloc(this->node_alloc(), x.node_alloc(), flag);
    }
 
    template<class FwdIterator, class Inserter>
@@ -369,11 +360,11 @@
          Node *p = 0;
          BOOST_TRY{
                for(difference_type i = 0; i < n; ++i, ++beg, --constructed){
- p = containers_detail::get_pointer(mem.front());
+ p = container_detail::to_raw_pointer(mem.front());
                mem.pop_front();
                //This can throw
                constructed = 0;
- boost::container::construct_in_place(p, beg);
+ boost::container::construct_in_place(this->node_alloc(), p, beg);
                ++constructed;
                //This can throw in some containers (predicate might throw)
                inserter(*p);
@@ -381,7 +372,7 @@
          }
          BOOST_CATCH(...){
             if(constructed){
- this->destroy(p);
+ allocator_traits<NodeAlloc>::destroy(this->node_alloc(), container_detail::to_raw_pointer(p));
             }
             this->node_alloc().deallocate_individual(boost::move(mem));
             BOOST_RETHROW
@@ -404,10 +395,10 @@
          this->node_alloc().deallocate_individual(boost::move(chain));
    }
 
- icont_iterator erase_range(icont_iterator first, icont_iterator last, allocator_v1)
+ icont_iterator erase_range(const icont_iterator &first, const icont_iterator &last, allocator_v1)
    { return this->icont().erase_and_dispose(first, last, Destroyer(this->node_alloc())); }
 
- icont_iterator erase_range(icont_iterator first, icont_iterator last, allocator_v2)
+ icont_iterator erase_range(const icont_iterator &first, const icont_iterator &last, allocator_v2)
    {
       allocator_multialloc_chain_node_deallocator<NodeAlloc> chain_holder(this->node_alloc());
       return this->icont().erase_and_dispose(first, last, chain_holder.get_chain_builder());
@@ -437,44 +428,38 @@
       node_alloc_holder &m_holder;
    };
 
- struct destroyer
- {
- destroyer(node_alloc_holder &holder)
- : m_holder(holder)
- {}
-
- void operator()(NodePtr n) const
- { m_holder.destroy_node(n); }
-
- node_alloc_holder &m_holder;
- };
-
    struct members_holder
       : public NodeAlloc
    {
       private:
       members_holder(const members_holder&);
+ members_holder & operator=(const members_holder&);
 
       public:
- template<class ConvertibleToAlloc>
- members_holder(const ConvertibleToAlloc &c2alloc)
- : NodeAlloc(c2alloc)
+ members_holder()
+ : NodeAlloc(), m_icont()
       {}
 
- template<class ConvertibleToAlloc, class Pred>
- members_holder(const ConvertibleToAlloc &c2alloc, const Pred &c)
- : NodeAlloc(c2alloc), m_icont(c)
+ template<class ConvertibleToAlloc>
+ explicit members_holder(BOOST_FWD_REF(ConvertibleToAlloc) c2alloc)
+ : NodeAlloc(boost::forward<ConvertibleToAlloc>(c2alloc))
+ , m_icont()
       {}
 
       template<class ConvertibleToAlloc>
- void assign (const ConvertibleToAlloc &c2alloc)
- {
- NodeAlloc::operator=(c2alloc);
- }
+ members_holder(BOOST_FWD_REF(ConvertibleToAlloc) c2alloc, const Pred &c)
+ : NodeAlloc(boost::forward<ConvertibleToAlloc>(c2alloc))
+ , m_icont(typename ICont::value_compare(c))
+ {}
+
+ explicit members_holder(const Pred &c)
+ : NodeAlloc()
+ , m_icont(typename ICont::value_compare(c))
+ {}
 
       //The intrusive container
       ICont m_icont;
- } members_;
+ };
 
    ICont &non_const_icont() const
    { return const_cast<ICont&>(this->members_.m_icont); }
@@ -490,12 +475,14 @@
 
    const NodeAlloc &node_alloc() const
    { return static_cast<const NodeAlloc &>(this->members_); }
+
+ members_holder members_;
 };
 
-} //namespace containers_detail {
+} //namespace container_detail {
 } //namespace container {
 } //namespace boost {
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif // BOOST_CONTAINERS_DETAIL_NODE_ALLOC_HPP_
+#endif // BOOST_CONTAINER_DETAIL_NODE_ALLOC_HPP_

Modified: trunk/boost/container/detail/node_pool_impl.hpp
==============================================================================
--- trunk/boost/container/detail/node_pool_impl.hpp (original)
+++ trunk/boost/container/detail/node_pool_impl.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -19,7 +19,7 @@
 #include <boost/container/container_fwd.hpp>
 #include <boost/container/detail/workaround.hpp>
 #include <boost/container/detail/utilities.hpp>
-#include <boost/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/set.hpp>
 #include <boost/intrusive/slist.hpp>
 #include <boost/container/detail/type_traits.hpp>
@@ -32,7 +32,7 @@
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 template<class SegmentManagerBase>
 class private_node_pool_impl
@@ -82,7 +82,7 @@
 
    //!Returns the segment manager. Never throws
    segment_manager_base_type* get_segment_manager_base()const
- { return containers_detail::get_pointer(mp_segment_mngr_base); }
+ { return container_detail::to_raw_pointer(mp_segment_mngr_base); }
 
    void *allocate_node()
    { return priv_alloc_node(); }
@@ -346,8 +346,8 @@
    }
 
    private:
- typedef typename boost::pointer_to_other
- <void_pointer, segment_manager_base_type>::type segment_mngr_base_ptr_t;
+ typedef typename boost::intrusive::pointer_traits
+ <void_pointer>::template rebind_pointer<segment_manager_base_type>::type segment_mngr_base_ptr_t;
 
    const size_type m_nodes_per_block;
    const size_type m_real_node_size;
@@ -358,7 +358,7 @@
 };
 
 
-} //namespace containers_detail {
+} //namespace container_detail {
 } //namespace container {
 } //namespace boost {
 

Modified: trunk/boost/container/detail/pair.hpp
==============================================================================
--- trunk/boost/container/detail/pair.hpp (original)
+++ trunk/boost/container/detail/pair.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -10,8 +10,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_CONTAINERS_DETAIL_PAIR_HPP
-#define BOOST_CONTAINERS_CONTAINERS_DETAIL_PAIR_HPP
+#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_PAIR_HPP
+#define BOOST_CONTAINER_CONTAINER_DETAIL_PAIR_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -28,13 +28,13 @@
 #include <boost/move/move.hpp>
 #include <boost/type_traits/is_class.hpp>
 
-#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
+#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 #include <boost/container/detail/preprocessor.hpp>
 #endif
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 template <class T1, class T2>
 struct pair;
@@ -143,13 +143,13 @@
 /*
    //Variadic versions
    template<class U>
- pair(BOOST_CONTAINERS_PARAM(U, u), typename containers_detail::disable_if
- < containers_detail::is_pair< typename containers_detail::remove_ref_const<U>::type >, pair_nat>::type* = 0)
+ pair(BOOST_CONTAINER_PP_PARAM(U, u), typename container_detail::disable_if
+ < container_detail::is_pair< typename container_detail::remove_ref_const<U>::type >, pair_nat>::type* = 0)
       : first(::boost::forward<U>(u))
       , second()
    {}
 
- #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    template<class U, class V, class ...Args>
    pair(U &&u, V &&v)
@@ -161,13 +161,13 @@
 
    #define BOOST_PP_LOCAL_MACRO(n) \
    template<class U, BOOST_PP_ENUM_PARAMS(n, class P)> \
- pair(BOOST_CONTAINERS_PARAM(U, u) \
- ,BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ pair(BOOST_CONTAINER_PP_PARAM(U, u) \
+ ,BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
       : first(::boost::forward<U>(u)) \
- , second(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)) \
+ , second(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)) \
    {} \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
    #endif
 */
@@ -280,7 +280,7 @@
    swap(x.second, y.second);
 }
 
-} //namespace containers_detail {
+} //namespace container_detail {
 } //namespace container {
 
 
@@ -291,7 +291,7 @@
 struct is_enum;
 
 template<class T, class U>
-struct is_enum< ::boost::container::containers_detail::pair<T, U> >
+struct is_enum< ::boost::container::container_detail::pair<T, U> >
 {
    static const bool value = false;
 };
@@ -299,14 +299,14 @@
 //This specialization is needed to avoid instantiation of pair in
 //is_class, and allow recursive maps.
 template <class T1, class T2>
-struct is_class< ::boost::container::containers_detail::pair<T1, T2> >
+struct is_class< ::boost::container::container_detail::pair<T1, T2> >
    : public ::boost::true_type
 {};
 
 #ifdef BOOST_NO_RVALUE_REFERENCES
 
 template<class T1, class T2>
-struct has_move_emulation_enabled< ::boost::container::containers_detail::pair<T1, T2> >
+struct has_move_emulation_enabled< ::boost::container::container_detail::pair<T1, T2> >
    : ::boost::true_type
 {};
 
@@ -317,4 +317,4 @@
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif //#ifndef BOOST_CONTAINERS_DETAIL_PAIR_HPP
+#endif //#ifndef BOOST_CONTAINER_DETAIL_PAIR_HPP

Modified: trunk/boost/container/detail/pool_common.hpp
==============================================================================
--- trunk/boost/container/detail/pool_common.hpp (original)
+++ trunk/boost/container/detail/pool_common.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -21,7 +21,7 @@
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 template<class VoidPointer>
 struct node_slist
@@ -43,7 +43,7 @@
    static const bool value = false;
 };
 
-} //namespace containers_detail {
+} //namespace container_detail {
 } //namespace container {
 } //namespace boost {
 

Modified: trunk/boost/container/detail/preprocessor.hpp
==============================================================================
--- trunk/boost/container/detail/preprocessor.hpp (original)
+++ trunk/boost/container/detail/preprocessor.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,32 +8,43 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_PREPROCESSOR_HPP
-#define BOOST_CONTAINERS_DETAIL_PREPROCESSOR_HPP
+#ifndef BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP
+#define BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
 #endif
 
-#include "config_begin.hpp"
+#include <boost/container/detail/config_begin.hpp>
 
 #ifndef BOOST_NO_RVALUE_REFERENCES
 #include <boost/container/detail/stored_ref.hpp>
-#endif
+#endif //#ifndef BOOST_NO_RVALUE_REFERENCES
 
 #include <boost/container/detail/workaround.hpp>
 
-#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-#error "This file is not needed when perfect forwarding is available"
-#endif
+#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+//#error "This file is not needed when perfect forwarding is available"
+#endif //BOOST_CONTAINER_PERFECT_FORWARDING
 
 #include <boost/preprocessor/iteration/local.hpp>
-#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/punctuation/paren_if.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/control/expr_if.hpp>
 #include <boost/preprocessor/cat.hpp>
 #include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+#include <boost/preprocessor/repetition/enum_trailing.hpp>
+#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
+#include <boost/preprocessor/repetition/enum_shifted.hpp>
 #include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/logical/not.hpp>
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/arithmetic/add.hpp>
+#include <boost/preprocessor/iteration/iterate.hpp>
 
-#define BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS 10
+#define BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS 10
 
 //Note:
 //We define template parameters as const references to
@@ -42,100 +53,126 @@
 //is achieved in C++0x. Meanwhile, if we want to be able to
 //bind rvalues with non-const references, we have to be ugly
 #ifndef BOOST_NO_RVALUE_REFERENCES
- #define BOOST_CONTAINERS_PP_PARAM_LIST(z, n, data) \
+ #define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \
    BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \
    //!
 #else
- #define BOOST_CONTAINERS_PP_PARAM_LIST(z, n, data) \
+ #define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \
    const BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n) \
    //!
-#endif
+#endif //#ifndef BOOST_NO_RVALUE_REFERENCES
 
 #ifndef BOOST_NO_RVALUE_REFERENCES
- #define BOOST_CONTAINERS_PARAM(U, u) \
+ #define BOOST_CONTAINER_PP_PARAM(U, u) \
    U && u \
    //!
 #else
- #define BOOST_CONTAINERS_PARAM(U, u) \
+ #define BOOST_CONTAINER_PP_PARAM(U, u) \
    const U & u \
    //!
-#endif
+#endif //#ifndef BOOST_NO_RVALUE_REFERENCES
 
 #ifndef BOOST_NO_RVALUE_REFERENCES
 
-#ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
+ #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
 
-#define BOOST_CONTAINERS_AUX_PARAM_INIT(z, n, data) \
- BOOST_PP_CAT(m_p, n) (boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \
-//!
+ #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \
+ BOOST_PP_CAT(m_p, n) (boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \
+ //!
 
-#else
+ #else //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
 
-#define BOOST_CONTAINERS_AUX_PARAM_INIT(z, n, data) \
- BOOST_PP_CAT(m_p, n) (static_cast<BOOST_PP_CAT(P, n)>( BOOST_PP_CAT(p, n) )) \
-//!
+ #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \
+ BOOST_PP_CAT(m_p, n) (static_cast<BOOST_PP_CAT(P, n)>( BOOST_PP_CAT(p, n) )) \
+ //!
 
-#endif
+ #endif //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
 
-#else
-#define BOOST_CONTAINERS_AUX_PARAM_INIT(z, n, data) \
- BOOST_PP_CAT(m_p, n) (const_cast<BOOST_PP_CAT(P, n) &>(BOOST_PP_CAT(p, n))) \
-//!
-#endif
+#else //BOOST_NO_RVALUE_REFERENCES
 
-#define BOOST_CONTAINERS_AUX_PARAM_INC(z, n, data) \
- BOOST_PP_CAT(++m_p, n) \
-//!
+ #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \
+ BOOST_PP_CAT(m_p, n) (const_cast<BOOST_PP_CAT(P, n) &>(BOOST_PP_CAT(p, n))) \
+ //!
+#endif //#ifndef BOOST_NO_RVALUE_REFERENCES
 
 #ifndef BOOST_NO_RVALUE_REFERENCES
 
-#if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+ #if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
 
-#define BOOST_CONTAINERS_AUX_PARAM_DEFINE(z, n, data) \
- BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \
-//!
+ #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data) \
+ BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \
+ //!
 
-#else
+ #else //BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG
 
-#define BOOST_CONTAINERS_AUX_PARAM_DEFINE(z, n, data) \
- BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n); \
-//!
+ #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data) \
+ BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n); \
+ //!
 
-#endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+ #endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
 
+#else //BOOST_NO_RVALUE_REFERENCES
 
-#else
-#define BOOST_CONTAINERS_AUX_PARAM_DEFINE(z, n, data) \
- BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \
+ #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data) \
+ BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \
+ //!
+#endif //#ifndef BOOST_NO_RVALUE_REFERENCES
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+
+ #define BOOST_CONTAINER_PP_MEMBER_FORWARD(z, n, data) \
+ ::boost::container::container_detail::stored_ref< BOOST_PP_CAT(P, n) >::forward( BOOST_PP_CAT(this->m_p, n) ) \
+ //!
+
+#else //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+
+ #define BOOST_CONTAINER_PP_MEMBER_FORWARD(z, n, data) \
+ boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(this->m_p, n) ) \
+ //!
+
+#endif //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+
+#define BOOST_CONTAINER_PP_PARAM_INC(z, n, data) \
+ BOOST_PP_CAT(++this->m_p, n) \
 //!
-#endif
 
-#define BOOST_CONTAINERS_PP_PARAM_FORWARD(z, n, data) \
+#define BOOST_CONTAINER_PP_IDENTITY(z, n, data) data
+
+
+#define BOOST_CONTAINER_PP_PARAM_FORWARD(z, n, data) \
 boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \
 //!
 
-#if !defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+#define BOOST_CONTAINER_PP_DECLVAL(z, n, data) \
+boost::move_detail::declval< BOOST_PP_CAT(P, n) >() \
+//!
 
-#define BOOST_CONTAINERS_PP_MEMBER_FORWARD(z, n, data) \
-::boost::container::containers_detail::stored_ref< BOOST_PP_CAT(P, n) >::forward( BOOST_PP_CAT(m_p, n) ) \
+#define BOOST_CONTAINER_PP_MEMBER_IT_FORWARD(z, n, data) \
+BOOST_PP_CAT(*this->m_p, n) \
 //!
 
-#else
+#define BOOST_CONTAINER_PP_TEMPLATE_PARAM_VOID_DEFAULT(z, n, data) \
+ BOOST_PP_CAT(class P, n) = void \
+//!
 
-#define BOOST_CONTAINERS_PP_MEMBER_FORWARD(z, n, data) \
-boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \
+#define BOOST_CONTAINER_PP_STATIC_PARAM_REF_DECLARE(z, n, data) \
+ static BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n); \
 //!
 
-#endif //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+#define BOOST_CONTAINER_PP_PARAM_PASS(z, n, data) \
+ BOOST_PP_CAT(p, n) \
+//!
 
-#define BOOST_CONTAINERS_PP_MEMBER_IT_FORWARD(z, n, data) \
-BOOST_PP_CAT(*m_p, n) \
+#define BOOST_CONTAINER_PP_FWD_TYPE(z, n, data) \
+ typename ::boost::move_detail::forward_type< BOOST_PP_CAT(P, n) >::type \
 //!
 
 #include <boost/container/detail/config_end.hpp>
 
-#else
-#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-#error "This file is not needed when perfect forwarding is available"
-#endif
-#endif //#ifndef BOOST_CONTAINERS_DETAIL_PREPROCESSOR_HPP
+//#else
+
+//#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+//#error "This file is not needed when perfect forwarding is available"
+//#endif //BOOST_CONTAINER_PERFECT_FORWARDING
+
+#endif //#ifndef BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP

Modified: trunk/boost/container/detail/stored_ref.hpp
==============================================================================
--- trunk/boost/container/detail/stored_ref.hpp (original)
+++ trunk/boost/container/detail/stored_ref.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_STORED_REF_HPP
-#define BOOST_CONTAINERS_DETAIL_STORED_REF_HPP
+#ifndef BOOST_CONTAINER_DETAIL_STORED_REF_HPP
+#define BOOST_CONTAINER_DETAIL_STORED_REF_HPP
 
 #include "config_begin.hpp"
 #include <boost/container/detail/workaround.hpp>
@@ -18,7 +18,7 @@
 
 namespace boost{
 namespace container{
-namespace containers_detail{
+namespace container_detail{
 
 template<class T>
 struct stored_ref
@@ -79,7 +79,7 @@
    { return t; }
 };
 
-} //namespace containers_detail{
+} //namespace container_detail{
 } //namespace container{
 } //namespace boost{
 
@@ -89,4 +89,4 @@
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif //BOOST_CONTAINERS_DETAIL_STORED_REF_HPP
+#endif //BOOST_CONTAINER_DETAIL_STORED_REF_HPP

Modified: trunk/boost/container/detail/transform_iterator.hpp
==============================================================================
--- trunk/boost/container/detail/transform_iterator.hpp (original)
+++ trunk/boost/container/detail/transform_iterator.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -11,8 +11,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_TRANSFORM_ITERATORS_HPP
-#define BOOST_CONTAINERS_DETAIL_TRANSFORM_ITERATORS_HPP
+#ifndef BOOST_CONTAINER_DETAIL_TRANSFORM_ITERATORS_HPP
+#define BOOST_CONTAINER_DETAIL_TRANSFORM_ITERATORS_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -59,7 +59,7 @@
    : public UnaryFunction
    , public std::iterator
       < typename Iterator::iterator_category
- , typename containers_detail::remove_reference<typename UnaryFunction::result_type>::type
+ , typename container_detail::remove_reference<typename UnaryFunction::result_type>::type
       , typename Iterator::difference_type
       , operator_arrow_proxy<typename UnaryFunction::result_type>
       , typename UnaryFunction::result_type>
@@ -173,4 +173,4 @@
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif //#ifndef BOOST_CONTAINERS_DETAIL_TRANSFORM_ITERATORS_HPP
+#endif //#ifndef BOOST_CONTAINER_DETAIL_TRANSFORM_ITERATORS_HPP

Modified: trunk/boost/container/detail/tree.hpp
==============================================================================
--- trunk/boost/container/detail/tree.hpp (original)
+++ trunk/boost/container/detail/tree.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,15 +8,15 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_TREE_HPP
-#define BOOST_CONTAINERS_TREE_HPP
+#ifndef BOOST_CONTAINER_TREE_HPP
+#define BOOST_CONTAINER_TREE_HPP
 
 #include "config_begin.hpp"
 #include <boost/container/detail/workaround.hpp>
 #include <boost/container/container_fwd.hpp>
 
 #include <boost/move/move.hpp>
-#include <boost/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/type_traits/has_trivial_destructor.hpp>
 #include <boost/detail/no_exceptions_support.hpp>
 #include <boost/intrusive/rbtree.hpp>
@@ -27,7 +27,8 @@
 #include <boost/container/detail/destroyers.hpp>
 #include <boost/container/detail/pair.hpp>
 #include <boost/container/detail/type_traits.hpp>
-#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
+#include <boost/container/allocator/allocator_traits.hpp>
+#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 #include <boost/container/detail/preprocessor.hpp>
 #endif
 
@@ -37,7 +38,7 @@
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 template<class Key, class Value, class KeyCompare, class KeyOfValue>
 struct value_compare_impl
@@ -82,10 +83,10 @@
 template<class VoidPointer>
 struct rbtree_hook
 {
- typedef typename containers_detail::bi::make_set_base_hook
- < containers_detail::bi::void_pointer<VoidPointer>
- , containers_detail::bi::link_mode<containers_detail::bi::normal_link>
- , containers_detail::bi::optimize_size<true>
+ typedef typename container_detail::bi::make_set_base_hook
+ < container_detail::bi::void_pointer<VoidPointer>
+ , container_detail::bi::link_mode<container_detail::bi::normal_link>
+ , container_detail::bi::optimize_size<true>
>::type type;
 };
 
@@ -105,6 +106,10 @@
 struct rbtree_node
    : public rbtree_hook<VoidPointer>::type
 {
+ private:
+ BOOST_COPYABLE_AND_MOVABLE(rbtree_node)
+
+ public:
    typedef typename rbtree_hook<VoidPointer>::type hook_type;
 
    typedef T value_type;
@@ -112,8 +117,6 @@
 
    typedef rbtree_node<T, VoidPointer> node_type;
 
- #ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
-
    rbtree_node()
       : m_data()
    {}
@@ -122,30 +125,35 @@
       : m_data(other.m_data)
    {}
 
- #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- rbtree_node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)) \
- {} \
+ rbtree_node(BOOST_RV_REF(rbtree_node) other)
+ : m_data(boost::move(other.m_data))
+ {}
+
+ #ifndef BOOST_CONTAINER_PERFECT_FORWARDING
+
+ #define BOOST_PP_LOCAL_MACRO(n) \
+ template<BOOST_PP_ENUM_PARAMS(n, class P)> \
+ rbtree_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)) \
+ {} \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #else //#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
-
- rbtree_node()
- : m_data()
- {}
+ #else //#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 
    template<class ...Args>
    rbtree_node(Args &&...args)
       : m_data(boost::forward<Args>(args)...)
    {}
- #endif//#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif//#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 
    rbtree_node &operator=(const rbtree_node &other)
    { do_assign(other.m_data); return *this; }
 
+ rbtree_node &operator=(BOOST_RV_REF(rbtree_node) other)
+ { do_move(other.m_data); return *this; }
+
    T &get_data()
    {
       T* ptr = reinterpret_cast<T*>(&this->m_data);
@@ -179,76 +187,88 @@
    void do_assign(const V &v)
    { m_data = v; }
 
- public:
- template<class Convertible>
- static void construct(node_type *ptr, BOOST_FWD_REF(Convertible) convertible)
- { new(ptr) node_type(boost::forward<Convertible>(convertible)); }
-};
+ template<class A, class B>
+ void do_move(std::pair<const A, B> &p)
+ {
+ const_cast<A&>(m_data.first) = boost::move(p.first);
+ m_data.second = boost::move(p.second);
+ }
 
-}//namespace containers_detail {
-#if defined(BOOST_NO_RVALUE_REFERENCES)
-template<class T, class VoidPointer>
-struct has_own_construct_from_it
- < boost::container::containers_detail::rbtree_node<T, VoidPointer> >
-{
- static const bool value = true;
+ template<class A, class B>
+ void do_move(pair<const A, B> &p)
+ {
+ const_cast<A&>(m_data.first) = boost::move(p.first);
+ m_data.second = boost::move(p.second);
+ }
+
+ template<class V>
+ void do_move(V &v)
+ { m_data = boost::move(v); }
 };
-#endif
-namespace containers_detail {
+
+}//namespace container_detail {
+
+namespace container_detail {
 
 template<class A, class ValueCompare>
 struct intrusive_rbtree_type
 {
- typedef typename A::value_type value_type;
- typedef typename boost::pointer_to_other
- <typename A::pointer, void>::type void_pointer;
- typedef typename containers_detail::rbtree_node
+ typedef typename boost::container::
+ allocator_traits<A>::value_type value_type;
+ typedef typename boost::container::
+ allocator_traits<A>::void_pointer void_pointer;
+ typedef typename boost::container::
+ allocator_traits<A>::size_type size_type;
+ typedef typename container_detail::rbtree_node
          <value_type, void_pointer> node_type;
    typedef node_compare<ValueCompare, node_type> node_compare_type;
- typedef typename containers_detail::bi::make_rbtree
+ typedef typename container_detail::bi::make_rbtree
       <node_type
- ,containers_detail::bi::compare<node_compare_type>
- ,containers_detail::bi::base_hook<typename rbtree_hook<void_pointer>::type>
- ,containers_detail::bi::constant_time_size<true>
- ,containers_detail::bi::size_type<typename A::size_type>
+ ,container_detail::bi::compare<node_compare_type>
+ ,container_detail::bi::base_hook<typename rbtree_hook<void_pointer>::type>
+ ,container_detail::bi::constant_time_size<true>
+ ,container_detail::bi::size_type<size_type>
>::type container_type;
    typedef container_type type ;
 };
 
-} //namespace containers_detail {
+} //namespace container_detail {
 
-namespace containers_detail {
+namespace container_detail {
 
 template <class Key, class Value, class KeyOfValue,
           class KeyCompare, class A>
 class rbtree
- : protected containers_detail::node_alloc_holder
- <A, typename containers_detail::intrusive_rbtree_type
+ : protected container_detail::node_alloc_holder
+ < A
+ , typename container_detail::intrusive_rbtree_type
          <A, value_compare_impl<Key, Value, KeyCompare, KeyOfValue>
>::type
+ , KeyCompare
>
 {
- typedef typename containers_detail::intrusive_rbtree_type
- <A, value_compare_impl
+ typedef typename container_detail::intrusive_rbtree_type
+ < A, value_compare_impl
             <Key, Value, KeyCompare, KeyOfValue>
- >::type Icont;
- typedef containers_detail::node_alloc_holder<A, Icont> AllocHolder;
- typedef typename AllocHolder::NodePtr NodePtr;
+ >::type Icont;
+ typedef container_detail::node_alloc_holder
+ <A, Icont, KeyCompare> AllocHolder;
+ typedef typename AllocHolder::NodePtr NodePtr;
    typedef rbtree < Key, Value, KeyOfValue
- , KeyCompare, A> ThisType;
- typedef typename AllocHolder::NodeAlloc NodeAlloc;
- typedef typename AllocHolder::ValAlloc ValAlloc;
- typedef typename AllocHolder::Node Node;
- typedef typename Icont::iterator iiterator;
- typedef typename Icont::const_iterator iconst_iterator;
- typedef containers_detail::allocator_destroyer<NodeAlloc> Destroyer;
- typedef typename AllocHolder::allocator_v1 allocator_v1;
- typedef typename AllocHolder::allocator_v2 allocator_v2;
- typedef typename AllocHolder::alloc_version alloc_version;
+ , KeyCompare, A> ThisType;
+ typedef typename AllocHolder::NodeAlloc NodeAlloc;
+ typedef typename AllocHolder::ValAlloc ValAlloc;
+ typedef typename AllocHolder::Node Node;
+ typedef typename Icont::iterator iiterator;
+ typedef typename Icont::const_iterator iconst_iterator;
+ typedef container_detail::allocator_destroyer<NodeAlloc> Destroyer;
+ typedef typename AllocHolder::allocator_v1 allocator_v1;
+ typedef typename AllocHolder::allocator_v2 allocator_v2;
+ typedef typename AllocHolder::alloc_version alloc_version;
 
    class RecyclingCloner;
    friend class RecyclingCloner;
-
+
    class RecyclingCloner
    {
       public:
@@ -258,10 +278,8 @@
 
       NodePtr operator()(const Node &other) const
       {
-// if(!m_icont.empty()){
          if(NodePtr p = m_icont.unlink_leftmost_without_rebalance()){
             //First recycle a node (this can't throw)
- //NodePtr p = m_icont.unlink_leftmost_without_rebalance();
             try{
                //This can throw
                *p = other;
@@ -284,6 +302,44 @@
       AllocHolder &m_holder;
       Icont &m_icont;
    };
+
+ class RecyclingMoveCloner;
+ friend class RecyclingMoveCloner;
+
+ class RecyclingMoveCloner
+ {
+ public:
+ RecyclingMoveCloner(AllocHolder &holder, Icont &irbtree)
+ : m_holder(holder), m_icont(irbtree)
+ {}
+
+ NodePtr operator()(const Node &other) const
+ {
+ if(NodePtr p = m_icont.unlink_leftmost_without_rebalance()){
+ //First recycle a node (this can't throw)
+ try{
+ //This can throw
+ *p = boost::move(other);
+ return p;
+ }
+ catch(...){
+ //If there is an exception destroy the whole source
+ m_holder.destroy_node(p);
+ while((p = m_icont.unlink_leftmost_without_rebalance())){
+ m_holder.destroy_node(p);
+ }
+ throw;
+ }
+ }
+ else{
+ return m_holder.create_node(other);
+ }
+ }
+
+ AllocHolder &m_holder;
+ Icont &m_icont;
+ };
+
    BOOST_COPYABLE_AND_MOVABLE(rbtree)
 
    public:
@@ -294,12 +350,18 @@
    typedef KeyCompare key_compare;
    typedef value_compare_impl< Key, Value
                         , KeyCompare, KeyOfValue> value_compare;
- typedef typename A::pointer pointer;
- typedef typename A::const_pointer const_pointer;
- typedef typename A::reference reference;
- typedef typename A::const_reference const_reference;
- typedef typename A::size_type size_type;
- typedef typename A::difference_type difference_type;
+ typedef typename boost::container::
+ allocator_traits<A>::pointer pointer;
+ typedef typename boost::container::
+ allocator_traits<A>::const_pointer const_pointer;
+ typedef typename boost::container::
+ allocator_traits<A>::reference reference;
+ typedef typename boost::container::
+ allocator_traits<A>::const_reference const_reference;
+ typedef typename boost::container::
+ allocator_traits<A>::size_type size_type;
+ typedef typename boost::container::
+ allocator_traits<A>::difference_type difference_type;
    typedef difference_type rbtree_difference_type;
    typedef pointer rbtree_pointer;
    typedef const_pointer rbtree_const_pointer;
@@ -436,8 +498,11 @@
    typedef std::reverse_iterator<iterator> reverse_iterator;
    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
 
- rbtree(const key_compare& comp = key_compare(),
- const allocator_type& a = allocator_type())
+ rbtree()
+ : AllocHolder(key_compare())
+ {}
+
+ rbtree(const key_compare& comp, const allocator_type& a = allocator_type())
       : AllocHolder(a, comp)
    {}
 
@@ -467,26 +532,32 @@
    }
 
    rbtree(BOOST_RV_REF(rbtree) x)
- : AllocHolder(x, x.key_comp())
- { this->swap(x); }
+ : AllocHolder(boost::move(static_cast<AllocHolder&>(x)), x.key_comp())
+ {}
 
    ~rbtree()
    {} //AllocHolder clears the tree
 
    rbtree& operator=(BOOST_COPY_ASSIGN_REF(rbtree) x)
    {
- if (this != &x) {
+ if (&x != this){
+ NodeAlloc &this_alloc = this->get_stored_allocator();
+ const NodeAlloc &x_alloc = x.get_stored_allocator();
+ container_detail::bool_<allocator_traits<NodeAlloc>::
+ propagate_on_container_copy_assignment::value> flag;
+ if(flag && this_alloc != x_alloc){
+ this->clear();
+ }
+ this->AllocHolder::copy_assign_alloc(x);
          //Transfer all the nodes to a temporary tree
          //If anything goes wrong, all the nodes will be destroyed
          //automatically
- Icont other_tree(this->icont().value_comp());
- other_tree.swap(this->icont());
+ Icont other_tree(boost::move(this->icont()));
 
          //Now recreate the source tree reusing nodes stored by other_tree
          this->icont().clone_from
             (x.icont()
             , RecyclingCloner(*this, other_tree)
- //, AllocHolder::cloner(*this)
             , Destroyer(this->node_alloc()));
 
          //If there are remaining nodes, destroy them
@@ -498,8 +569,41 @@
       return *this;
    }
 
- rbtree& operator=(BOOST_RV_REF(rbtree) mx)
- { this->clear(); this->swap(mx); return *this; }
+ rbtree& operator=(BOOST_RV_REF(rbtree) x)
+ {
+ if (&x != this){
+ NodeAlloc &this_alloc = this->node_alloc();
+ NodeAlloc &x_alloc = x.node_alloc();
+ //If allocators are equal we can just swap pointers
+ if(this_alloc == x_alloc){
+ //Destroy and swap pointers
+ this->clear();
+ this->icont() = boost::move(x.icont());
+ //Move allocator if needed
+ this->AllocHolder::move_assign_alloc(x);
+ }
+ //If unequal allocators, then do a one by one move
+ else{
+ //Transfer all the nodes to a temporary tree
+ //If anything goes wrong, all the nodes will be destroyed
+ //automatically
+ Icont other_tree(boost::move(this->icont()));
+
+ //Now recreate the source tree reusing nodes stored by other_tree
+ this->icont().clone_from
+ (x.icont()
+ , RecyclingMoveCloner(*this, other_tree)
+ , Destroyer(this->node_alloc()));
+
+ //If there are remaining nodes, destroy them
+ NodePtr p;
+ while((p = other_tree.unlink_leftmost_without_rebalance())){
+ AllocHolder::destroy_node(p);
+ }
+ }
+ }
+ return *this;
+ }
 
    public:
    // accessors:
@@ -677,7 +781,7 @@
 
    public:
 
- #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    template <class... Args>
    iterator emplace_unique(Args&&... args)
@@ -701,59 +805,43 @@
       return iterator(this->icont().insert_equal(hint.get(), *p));
    }
 
- #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
- iterator emplace_unique()
- { return this->emplace_unique_impl(AllocHolder::create_node()); }
-
- iterator emplace_hint_unique(const_iterator hint)
- { return this->emplace_unique_hint_impl(hint, AllocHolder::create_node()); }
-
- iterator emplace_equal()
- {
- NodePtr p(AllocHolder::create_node());
- return iterator(this->icont().insert_equal(this->icont().end(), *p));
- }
-
- iterator emplace_hint_equal(const_iterator hint)
- {
- NodePtr p(AllocHolder::create_node());
- return iterator(this->icont().insert_equal(hint.get(), *p));
- }
+ #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
       return this->emplace_unique_impl \
- (AllocHolder::create_node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _))); \
+ (AllocHolder::create_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); \
    } \
                                                                                                             \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace_hint_unique(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace_hint_unique(const_iterator hint \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
       return this->emplace_unique_hint_impl \
- (hint, AllocHolder::create_node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _))); \
+ (hint, AllocHolder::create_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); \
    } \
                                                                                                             \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
- NodePtr p(AllocHolder::create_node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _))); \
+ NodePtr p(AllocHolder::create_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); \
       return iterator(this->icont().insert_equal(this->icont().end(), *p)); \
    } \
                                                                                                             \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace_hint_equal(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace_hint_equal(const_iterator hint \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
- NodePtr p(AllocHolder::create_node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _))); \
+ NodePtr p(AllocHolder::create_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); \
       return iterator(this->icont().insert_equal(hint.get(), *p)); \
    } \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    iterator insert_unique(const_iterator hint, const value_type& v)
    {
@@ -1044,7 +1132,7 @@
   x.swap(y);
 }
 
-} //namespace containers_detail {
+} //namespace container_detail {
 } //namespace container {
 /*
 //!has_trivial_destructor_after_move<> == true_type
@@ -1052,7 +1140,7 @@
 template <class K, class V, class KOV,
 class C, class A>
 struct has_trivial_destructor_after_move
- <boost::container::containers_detail::rbtree<K, V, KOV, C, A> >
+ <boost::container::container_detail::rbtree<K, V, KOV, C, A> >
 {
    static const bool value = has_trivial_destructor<A>::value && has_trivial_destructor<C>::value;
 };
@@ -1061,4 +1149,4 @@
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif //BOOST_CONTAINERS_TREE_HPP
+#endif //BOOST_CONTAINER_TREE_HPP

Modified: trunk/boost/container/detail/type_traits.hpp
==============================================================================
--- trunk/boost/container/detail/type_traits.hpp (original)
+++ trunk/boost/container/detail/type_traits.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -12,8 +12,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_CONTAINER_DETAIL_TYPE_TRAITS_HPP
-#define BOOST_CONTAINERS_CONTAINER_DETAIL_TYPE_TRAITS_HPP
+#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP
+#define BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -25,7 +25,7 @@
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 struct nat{};
 
@@ -194,10 +194,10 @@
    typedef typename remove_const< typename remove_reference<T>::type >::type type;
 };
 
-} // namespace containers_detail
+} // namespace container_detail
 } //namespace container {
 } //namespace boost {
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif //#ifndef BOOST_CONTAINERS_CONTAINER_DETAIL_TYPE_TRAITS_HPP
+#endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP

Modified: trunk/boost/container/detail/utilities.hpp
==============================================================================
--- trunk/boost/container/detail/utilities.hpp (original)
+++ trunk/boost/container/detail/utilities.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_UTILITIES_HPP
-#define BOOST_CONTAINERS_DETAIL_UTILITIES_HPP
+#ifndef BOOST_CONTAINER_DETAIL_UTILITIES_HPP
+#define BOOST_CONTAINER_DETAIL_UTILITIES_HPP
 
 #include "config_begin.hpp"
 #include <cstdio>
@@ -21,11 +21,12 @@
 #include <boost/move/move.hpp>
 #include <boost/container/detail/mpl.hpp>
 #include <boost/container/detail/type_traits.hpp>
+#include <boost/container/allocator/allocator_traits.hpp>
 #include <algorithm>
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 template<class T>
 const T &max_value(const T &a, const T &b)
@@ -55,29 +56,14 @@
    return max_size;
 }
 
-template<class SmartPtr>
-struct smart_ptr_type
-{
- typedef typename SmartPtr::value_type value_type;
- typedef value_type *pointer;
- static pointer get (const SmartPtr &smartptr)
- { return smartptr.get();}
-};
-
-template<class T>
-struct smart_ptr_type<T*>
-{
- typedef T value_type;
- typedef value_type *pointer;
- static pointer get (pointer ptr)
- { return ptr;}
-};
+template <class T>
+inline T* to_raw_pointer(T* p)
+{ return p; }
 
-//!Overload for smart pointers to avoid ADL problems with get_pointer
-template<class Ptr>
-inline typename smart_ptr_type<Ptr>::pointer
-get_pointer(const Ptr &ptr)
-{ return smart_ptr_type<Ptr>::get(ptr); }
+template <class Pointer>
+inline typename Pointer::element_type*
+ to_raw_pointer(const Pointer &p)
+{ return boost::container::container_detail::to_raw_pointer(p.operator->()); }
 
 //!To avoid ADL problems with swap
 template <class T>
@@ -87,6 +73,33 @@
    swap(x, y);
 }
 
+template<class AllocatorType>
+inline void swap_alloc(AllocatorType &, AllocatorType &, container_detail::false_type)
+ BOOST_CONTAINER_NOEXCEPT
+{}
+
+template<class AllocatorType>
+inline void swap_alloc(AllocatorType &l, AllocatorType &r, container_detail::true_type)
+{ container_detail::do_swap(l, r); }
+
+template<class AllocatorType>
+inline void assign_alloc(AllocatorType &, const AllocatorType &, container_detail::false_type)
+ BOOST_CONTAINER_NOEXCEPT
+{}
+
+template<class AllocatorType>
+inline void assign_alloc(AllocatorType &l, const AllocatorType &r, container_detail::true_type)
+{ l = r; }
+
+template<class AllocatorType>
+inline void move_alloc(AllocatorType &, AllocatorType &, container_detail::false_type)
+ BOOST_CONTAINER_NOEXCEPT
+{}
+
+template<class AllocatorType>
+inline void move_alloc(AllocatorType &l, AllocatorType &r, container_detail::true_type)
+{ l = ::boost::move(r); }
+
 //Rounds "orig_size" by excess to round_to bytes
 template<class SizeType>
 inline SizeType get_rounded_size(SizeType orig_size, SizeType round_to)
@@ -99,36 +112,36 @@
 {
    enum { value = ((OrigSize-1)/RoundTo+1)*RoundTo };
 };
-
+/*
 template <class _TypeT>
 struct __rw_is_enum
 {
-struct _C_no { };
-struct _C_yes { int _C_dummy [2]; };
+ struct _C_no { };
+ struct _C_yes { int _C_dummy [2]; };
 
-struct _C_indirect {
-// prevent classes with user-defined conversions from matching
+ struct _C_indirect {
+ // prevent classes with user-defined conversions from matching
 
-// use double to prevent float->int gcc conversion warnings
-_C_indirect (double);
+ // use double to prevent float->int gcc conversion warnings
+ _C_indirect (double);
 };
 
 // nested struct gets rid of bogus gcc errors
 struct _C_nest {
-// supply first argument to prevent HP aCC warnings
-static _C_no _C_is (int, ...);
-static _C_yes _C_is (int, _C_indirect);
+ // supply first argument to prevent HP aCC warnings
+ static _C_no _C_is (int, ...);
+ static _C_yes _C_is (int, _C_indirect);
 
-static _TypeT _C_make_T ();
+ static _TypeT _C_make_T ();
 };
 
 enum {
-_C_val = sizeof (_C_yes)
-== sizeof (_C_nest::_C_is (0, _C_nest::_C_make_T ()))
-&& !::boost::is_fundamental<_TypeT>::value
+ _C_val = sizeof (_C_yes) == sizeof (_C_nest::_C_is (0, _C_nest::_C_make_T ()))
+ && !::boost::is_fundamental<_TypeT>::value
 };
 
 };
+*/
 
 template<class T>
 struct move_const_ref_type
@@ -140,11 +153,119 @@
>
 {};
 
-} //namespace containers_detail {
+} //namespace container_detail {
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// uninitialized_move_alloc
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! <b>Effects</b>:
+//! \code
+//! for (; first != last; ++result, ++first)
+//! allocator_traits::construct(a, &*result, boost::move(*first));
+//! \endcode
+//!
+//! <b>Returns</b>: result
+template
+ <typename A,
+ typename I, // I models InputIterator
+ typename F> // F models ForwardIterator
+F uninitialized_move_alloc(A &a, I f, I l, F r)
+{
+ while (f != l) {
+ allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*r), boost::move(*f));
+ ++f; ++r;
+ }
+ return r;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// uninitialized_copy_alloc
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! <b>Effects</b>:
+//! \code
+//! for (; first != last; ++result, ++first)
+//! allocator_traits::construct(a, &*result, *first);
+//! \endcode
+//!
+//! <b>Returns</b>: result
+template
+ <typename A,
+ typename I, // I models InputIterator
+ typename F> // F models ForwardIterator
+F uninitialized_copy_alloc(A &a, I f, I l, F r)
+{
+ while (f != l) {
+ allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*r), *f);
+ ++f; ++r;
+ }
+ return r;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// uninitialized_copy_alloc
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! <b>Effects</b>:
+//! \code
+//! for (; first != last; ++result, ++first)
+//! allocator_traits::construct(a, &*result, *first);
+//! \endcode
+//!
+//! <b>Returns</b>: result
+template
+ <typename A,
+ typename F, // F models ForwardIterator
+ typename T>
+void uninitialized_fill_alloc(A &a, F f, F l, const T &t)
+{
+ while (f != l) {
+ allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*f), t);
+ ++f;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// uninitialized_copy_or_move_alloc
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+<typename A
+,typename I // I models InputIterator
+,typename F> // F models ForwardIterator
+F uninitialized_copy_or_move_alloc
+ (A &a, I f, I l, F r
+ ,typename boost::container::container_detail::enable_if
+ < boost::move_detail::is_move_iterator<I> >::type* = 0)
+{
+ return ::boost::container::uninitialized_move_alloc(a, f, l, r);
+}
+
+template
+<typename A
+,typename I // I models InputIterator
+,typename F> // F models ForwardIterator
+F uninitialized_copy_or_move_alloc
+ (A &a, I f, I l, F r
+ ,typename boost::container::container_detail::disable_if
+ < boost::move_detail::is_move_iterator<I> >::type* = 0)
+{
+ return ::boost::container::uninitialized_copy_alloc(a, f, l, r);
+}
+
 } //namespace container {
 } //namespace boost {
 
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif //#ifndef BOOST_CONTAINERS_DETAIL_UTILITIES_HPP
+#endif //#ifndef BOOST_CONTAINER_DETAIL_UTILITIES_HPP

Modified: trunk/boost/container/detail/value_init.hpp
==============================================================================
--- trunk/boost/container/detail/value_init.hpp (original)
+++ trunk/boost/container/detail/value_init.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -10,8 +10,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_VALUE_INIT_HPP
-#define BOOST_CONTAINERS_DETAIL_VALUE_INIT_HPP
+#ifndef BOOST_CONTAINER_DETAIL_VALUE_INIT_HPP
+#define BOOST_CONTAINER_DETAIL_VALUE_INIT_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -22,7 +22,7 @@
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 template<class T>
 struct value_init
@@ -31,13 +31,15 @@
       : m_t()
    {}
 
+ operator T &() { return m_t; }
+
    T m_t;
 };
 
-} //namespace containers_detail {
+} //namespace container_detail {
 } //namespace container {
 } //namespace boost {
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif //#ifndef BOOST_CONTAINERS_DETAIL_VALUE_INIT_HPP
+#endif //#ifndef BOOST_CONTAINER_DETAIL_VALUE_INIT_HPP

Modified: trunk/boost/container/detail/variadic_templates_tools.hpp
==============================================================================
--- trunk/boost/container/detail/variadic_templates_tools.hpp (original)
+++ trunk/boost/container/detail/variadic_templates_tools.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
-#define BOOST_CONTAINERS_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
+#ifndef BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
+#define BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -22,7 +22,7 @@
 
 namespace boost {
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 template<typename... Values>
 class tuple;
@@ -146,8 +146,8 @@
 { typedef index_tuple<Indexes...> type; };
 
 
-}}} //namespace boost { namespace container { namespace containers_detail {
+}}} //namespace boost { namespace container { namespace container_detail {
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif //#ifndef BOOST_CONTAINERS_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
+#endif //#ifndef BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP

Modified: trunk/boost/container/detail/version_type.hpp
==============================================================================
--- trunk/boost/container/detail/version_type.hpp (original)
+++ trunk/boost/container/detail/version_type.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -13,8 +13,8 @@
 //////////////////////////////////////////////////////////////////////////////
 
 
-#ifndef BOOST_CONTAINERS_DETAIL_VERSION_TYPE_HPP
-#define BOOST_CONTAINERS_DETAIL_VERSION_TYPE_HPP
+#ifndef BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
+#define BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
 
 #include "config_begin.hpp"
 
@@ -23,13 +23,13 @@
 
 namespace boost{
 namespace container {
-namespace containers_detail {
+namespace container_detail {
 
 //using namespace boost;
 
 template <class T, unsigned V>
 struct version_type
- : public containers_detail::integral_constant<unsigned, V>
+ : public container_detail::integral_constant<unsigned, V>
 {
     typedef T type;
 
@@ -39,7 +39,7 @@
 namespace impl{
 
 template <class T,
- bool = containers_detail::is_convertible<version_type<T, 0>, typename T::version>::value>
+ bool = container_detail::is_convertible<version_type<T, 0>, typename T::version>::value>
 struct extract_version
 {
    static const unsigned value = 1;
@@ -79,14 +79,14 @@
 
 template <class T>
 struct version
- : public containers_detail::integral_constant<unsigned, impl::version<T>::value>
+ : public container_detail::integral_constant<unsigned, impl::version<T>::value>
 {
 };
 
-} //namespace containers_detail {
+} //namespace container_detail {
 } //namespace container {
 } //namespace boost{
 
 #include "config_end.hpp"
 
-#endif //#define BOOST_CONTAINERS_DETAIL_VERSION_TYPE_HPP
+#endif //#define BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP

Modified: trunk/boost/container/detail/workaround.hpp
==============================================================================
--- trunk/boost/container/detail/workaround.hpp (original)
+++ trunk/boost/container/detail/workaround.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,17 +8,24 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_DETAIL_WORKAROUND_HPP
-#define BOOST_CONTAINERS_DETAIL_WORKAROUND_HPP
+#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
+#define BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
 
-#include "config_begin.hpp"
+#include <boost/container/detail/config_begin.hpp>
 
 #if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)\
     && !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL)
-#define BOOST_CONTAINERS_PERFECT_FORWARDING
+ #define BOOST_CONTAINER_PERFECT_FORWARDING
+#endif
 
+#if defined(BOOST_NO_NOEXCEPT)
+ #define BOOST_CONTAINER_NOEXCEPT
+ #define BOOST_CONTAINER_NOEXCEPT_IF(x)
+#else
+ #define BOOST_CONTAINER_NOEXCEPT noexcept
+ #define BOOST_CONTAINER_NOEXCEPT_IF(x) noexcept(x)
 #endif
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif //#ifndef BOOST_CONTAINERS_DETAIL_WORKAROUND_HPP
+#endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP

Modified: trunk/boost/container/flat_map.hpp
==============================================================================
--- trunk/boost/container/flat_map.hpp (original)
+++ trunk/boost/container/flat_map.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_FLAT_MAP_HPP
-#define BOOST_CONTAINERS_FLAT_MAP_HPP
+#ifndef BOOST_CONTAINER_FLAT_MAP_HPP
+#define BOOST_CONTAINER_FLAT_MAP_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -26,6 +26,7 @@
 #include <boost/container/detail/flat_tree.hpp>
 #include <boost/type_traits/has_trivial_destructor.hpp>
 #include <boost/container/detail/mpl.hpp>
+#include <boost/container/allocator/allocator_traits.hpp>
 #include <boost/move/move.hpp>
 
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -52,6 +53,23 @@
 template <class Key, class T, class Pred, class A>
 inline bool operator<(const flat_map<Key,T,Pred,A>& x,
                       const flat_map<Key,T,Pred,A>& y);
+
+namespace container_detail{
+
+template<class D, class S>
+static D &force(const S &s)
+{ return *const_cast<D*>((reinterpret_cast<const D*>(&s))); }
+
+template<class D, class S>
+static D force_copy(S s)
+{
+ D *vp = reinterpret_cast<D *>(&s);
+ return D(*vp);
+}
+
+} //namespace container_detail{
+
+
 /// @endcond
 
 //! A flat_map is a kind of associative container that supports unique keys (contains at
@@ -86,19 +104,19 @@
    private:
    BOOST_COPYABLE_AND_MOVABLE(flat_map)
    //This is the tree that we should store if pair was movable
- typedef containers_detail::flat_tree<Key,
+ typedef container_detail::flat_tree<Key,
                            std::pair<Key, T>,
- containers_detail::select1st< std::pair<Key, T> >,
+ container_detail::select1st< std::pair<Key, T> >,
                            Pred,
                            A> tree_t;
 
    //This is the real tree stored here. It's based on a movable pair
- typedef containers_detail::flat_tree<Key,
- containers_detail::pair<Key, T>,
- containers_detail::select1st<containers_detail::pair<Key, T> >,
+ typedef container_detail::flat_tree<Key,
+ container_detail::pair<Key, T>,
+ container_detail::select1st<container_detail::pair<Key, T> >,
                            Pred,
- typename A::template
- rebind<containers_detail::pair<Key, T> >::other> impl_tree_t;
+ typename allocator_traits<A>::template portable_rebind_alloc
+ <container_detail::pair<Key, T> >::type> impl_tree_t;
    impl_tree_t m_flat_tree; // flat tree representing flat_map
 
    typedef typename impl_tree_t::value_type impl_value_type;
@@ -112,56 +130,56 @@
    typedef typename impl_tree_t::reverse_iterator impl_reverse_iterator;
    typedef typename impl_tree_t::const_reverse_iterator impl_const_reverse_iterator;
    typedef typename impl_tree_t::allocator_type impl_allocator_type;
+ typedef allocator_traits<A> allocator_traits_type;
 
- template<class D, class S>
- static D &force(const S &s)
- { return *const_cast<D*>(reinterpret_cast<const D*>(&s)); }
 
- template<class D, class S>
- static D force_copy(S s)
- {
- value_type *vp = reinterpret_cast<value_type *>(&*s);
- return D(vp);
- }
 
    /// @endcond
 
    public:
 
    // typedefs:
- typedef typename impl_tree_t::key_type key_type;
- typedef T mapped_type;
- typedef typename std::pair<key_type, mapped_type> value_type;
- typedef typename A::pointer pointer;
- typedef typename A::const_pointer const_pointer;
- typedef typename A::reference reference;
- typedef typename A::const_reference const_reference;
- typedef containers_detail::flat_tree_value_compare
+ typedef Key key_type;
+ typedef T mapped_type;
+ typedef typename std::pair<key_type, mapped_type> value_type;
+ typedef typename allocator_traits_type::pointer pointer;
+ typedef typename allocator_traits_type::const_pointer const_pointer;
+ typedef typename allocator_traits_type::reference reference;
+ typedef typename allocator_traits_type::const_reference const_reference;
+ typedef typename impl_tree_t::size_type size_type;
+ typedef typename impl_tree_t::difference_type difference_type;
+
+ typedef container_detail::flat_tree_value_compare
       < Pred
- , containers_detail::select1st< std::pair<Key, T> >
- , std::pair<Key, T> > value_compare;
- typedef Pred key_compare;
- typedef typename containers_detail::
- get_flat_tree_iterators<pointer>::iterator iterator;
- typedef typename containers_detail::
- get_flat_tree_iterators<pointer>::const_iterator const_iterator;
- typedef typename containers_detail::
+ , container_detail::select1st< std::pair<Key, T> >
+ , std::pair<Key, T> > value_compare;
+ typedef Pred key_compare;
+ typedef typename container_detail::
+ get_flat_tree_iterators<pointer>::iterator iterator;
+ typedef typename container_detail::
+ get_flat_tree_iterators<pointer>::const_iterator const_iterator;
+ typedef typename container_detail::
       get_flat_tree_iterators
- <pointer>::reverse_iterator reverse_iterator;
- typedef typename containers_detail::
+ <pointer>::reverse_iterator reverse_iterator;
+ typedef typename container_detail::
       get_flat_tree_iterators
- <pointer>::const_reverse_iterator const_reverse_iterator;
- typedef typename impl_tree_t::size_type size_type;
- typedef typename impl_tree_t::difference_type difference_type;
- typedef A allocator_type;
- typedef A stored_allocator_type;
+ <pointer>::const_reverse_iterator const_reverse_iterator;
+ typedef A allocator_type;
+ typedef A stored_allocator_type;
+
+ public:
+ //! <b>Effects</b>: Default constructs an empty flat_map.
+ //!
+ //! <b>Complexity</b>: Constant.
+ flat_map()
+ : m_flat_tree() {}
 
    //! <b>Effects</b>: Constructs an empty flat_map using the specified
    //! comparison object and allocator.
    //!
    //! <b>Complexity</b>: Constant.
- explicit flat_map(const Pred& comp = Pred(), const allocator_type& a = allocator_type())
- : m_flat_tree(comp, force<impl_allocator_type>(a)) {}
+ explicit flat_map(const Pred& comp, const allocator_type& a = allocator_type())
+ : m_flat_tree(comp, container_detail::force<impl_allocator_type>(a)) {}
 
    //! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and
    //! allocator, and inserts elements from the range [first ,last ).
@@ -171,7 +189,7 @@
    template <class InputIterator>
    flat_map(InputIterator first, InputIterator last, const Pred& comp = Pred(),
          const allocator_type& a = allocator_type())
- : m_flat_tree(comp, force<impl_allocator_type>(a))
+ : m_flat_tree(comp, container_detail::force<impl_allocator_type>(a))
       { m_flat_tree.insert_unique(first, last); }
 
    //! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and
@@ -224,27 +242,27 @@
    //!
    //! <b>Complexity</b>: Constant.
    key_compare key_comp() const
- { return force<key_compare>(m_flat_tree.key_comp()); }
+ { return container_detail::force<key_compare>(m_flat_tree.key_comp()); }
 
    //! <b>Effects</b>: Returns an object of value_compare constructed out
    //! of the comparison object.
    //!
    //! <b>Complexity</b>: Constant.
    value_compare value_comp() const
- { return value_compare(force<key_compare>(m_flat_tree.key_comp())); }
+ { return value_compare(container_detail::force<key_compare>(m_flat_tree.key_comp())); }
 
    //! <b>Effects</b>: Returns a copy of the Allocator that
    //! was passed to the object's constructor.
    //!
    //! <b>Complexity</b>: Constant.
    allocator_type get_allocator() const
- { return force<allocator_type>(m_flat_tree.get_allocator()); }
+ { return container_detail::force<allocator_type>(m_flat_tree.get_allocator()); }
 
    const stored_allocator_type &get_stored_allocator() const
- { return force<stored_allocator_type>(m_flat_tree.get_stored_allocator()); }
+ { return container_detail::force<stored_allocator_type>(m_flat_tree.get_stored_allocator()); }
 
    stored_allocator_type &get_stored_allocator()
- { return force<stored_allocator_type>(m_flat_tree.get_stored_allocator()); }
+ { return container_detail::force<stored_allocator_type>(m_flat_tree.get_stored_allocator()); }
 
    //! <b>Effects</b>: Returns an iterator to the first element contained in the container.
    //!
@@ -252,7 +270,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    iterator begin()
- { return force_copy<iterator>(m_flat_tree.begin()); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.begin()); }
 
    //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
    //!
@@ -260,7 +278,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    const_iterator begin() const
- { return force<const_iterator>(m_flat_tree.begin()); }
+ { return container_detail::force<const_iterator>(m_flat_tree.begin()); }
 
    //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
    //!
@@ -268,7 +286,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    const_iterator cbegin() const
- { return force<const_iterator>(m_flat_tree.cbegin()); }
+ { return container_detail::force<const_iterator>(m_flat_tree.cbegin()); }
 
    //! <b>Effects</b>: Returns an iterator to the end of the container.
    //!
@@ -276,7 +294,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    iterator end()
- { return force_copy<iterator>(m_flat_tree.end()); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.end()); }
 
    //! <b>Effects</b>: Returns a const_iterator to the end of the container.
    //!
@@ -284,7 +302,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    const_iterator end() const
- { return force<const_iterator>(m_flat_tree.end()); }
+ { return container_detail::force<const_iterator>(m_flat_tree.end()); }
 
    //! <b>Effects</b>: Returns a const_iterator to the end of the container.
    //!
@@ -292,7 +310,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    const_iterator cend() const
- { return force<const_iterator>(m_flat_tree.cend()); }
+ { return container_detail::force<const_iterator>(m_flat_tree.cend()); }
 
    //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
    //! of the reversed container.
@@ -301,7 +319,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    reverse_iterator rbegin()
- { return force<reverse_iterator>(m_flat_tree.rbegin()); }
+ { return container_detail::force<reverse_iterator>(m_flat_tree.rbegin()); }
 
    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
    //! of the reversed container.
@@ -310,7 +328,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    const_reverse_iterator rbegin() const
- { return force<const_reverse_iterator>(m_flat_tree.rbegin()); }
+ { return container_detail::force<const_reverse_iterator>(m_flat_tree.rbegin()); }
 
    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
    //! of the reversed container.
@@ -319,7 +337,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    const_reverse_iterator crbegin() const
- { return force<const_reverse_iterator>(m_flat_tree.crbegin()); }
+ { return container_detail::force<const_reverse_iterator>(m_flat_tree.crbegin()); }
 
    //! <b>Effects</b>: Returns a reverse_iterator pointing to the end
    //! of the reversed container.
@@ -328,7 +346,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    reverse_iterator rend()
- { return force<reverse_iterator>(m_flat_tree.rend()); }
+ { return container_detail::force<reverse_iterator>(m_flat_tree.rend()); }
 
    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
    //! of the reversed container.
@@ -337,7 +355,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    const_reverse_iterator rend() const
- { return force<const_reverse_iterator>(m_flat_tree.rend()); }
+ { return container_detail::force<const_reverse_iterator>(m_flat_tree.rend()); }
 
    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
    //! of the reversed container.
@@ -346,7 +364,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    const_reverse_iterator crend() const
- { return force<const_reverse_iterator>(m_flat_tree.crend()); }
+ { return container_detail::force<const_reverse_iterator>(m_flat_tree.crend()); }
 
    //! <b>Effects</b>: Returns true if the container contains no elements.
    //!
@@ -372,20 +390,14 @@
    size_type max_size() const
       { return m_flat_tree.max_size(); }
 
+ #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
    //! Effects: If there is no key equivalent to x in the flat_map, inserts
    //! value_type(x, T()) into the flat_map.
    //!
    //! Returns: A reference to the mapped_type corresponding to x in *this.
    //!
    //! Complexity: Logarithmic.
- T &operator[](const key_type& k)
- {
- iterator i = lower_bound(k);
- // i->first is greater than or equivalent to k.
- if (i == end() || key_comp()(k, (*i).first))
- i = insert(i, value_type(k, T()));
- return (*i).second;
- }
+ mapped_type &operator[](const key_type& k);
 
    //! Effects: If there is no key equivalent to x in the flat_map, inserts
    //! value_type(move(x), T()) into the flat_map (the key is move-constructed)
@@ -393,15 +405,11 @@
    //! Returns: A reference to the mapped_type corresponding to x in *this.
    //!
    //! Complexity: Logarithmic.
- T &operator[](BOOST_RV_REF(key_type) mk)
- {
- key_type &k = mk;
- iterator i = lower_bound(k);
- // i->first is greater than or equivalent to k.
- if (i == end() || key_comp()(k, (*i).first))
- i = insert(i, value_type(boost::move(k), boost::move(T())));
- return (*i).second;
- }
+ mapped_type &operator[](key_type &&k) ;
+
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, priv_subscript)
+ #endif
 
    //! Returns: A reference to the element whose key is equivalent to x.
    //! Throws: An exception object of type out_of_range if no such element is present.
@@ -448,8 +456,8 @@
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
    std::pair<iterator,bool> insert(const value_type& x)
- { return force<std::pair<iterator,bool> >(
- m_flat_tree.insert_unique(force<impl_value_type>(x))); }
+ { return container_detail::force<std::pair<iterator,bool> >(
+ m_flat_tree.insert_unique(container_detail::force<impl_value_type>(x))); }
 
    //! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and
    //! only if there is no element in the container with key equivalent to the key of x.
@@ -463,8 +471,8 @@
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
    std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
- { return force<std::pair<iterator,bool> >(
- m_flat_tree.insert_unique(boost::move(force<impl_value_type>(x)))); }
+ { return container_detail::force<std::pair<iterator,bool> >(
+ m_flat_tree.insert_unique(boost::move(container_detail::force<impl_value_type>(x)))); }
 
    //! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and
    //! only if there is no element in the container with key equivalent to the key of x.
@@ -479,7 +487,7 @@
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
    std::pair<iterator,bool> insert(BOOST_RV_REF(impl_value_type) x)
    {
- return force<std::pair<iterator,bool> >
+ return container_detail::force<std::pair<iterator,bool> >
       (m_flat_tree.insert_unique(boost::move(x)));
    }
 
@@ -495,8 +503,8 @@
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
    iterator insert(const_iterator position, const value_type& x)
- { return force_copy<iterator>(
- m_flat_tree.insert_unique(force<impl_const_iterator>(position), force<impl_value_type>(x))); }
+ { return container_detail::force_copy<iterator>(
+ m_flat_tree.insert_unique(container_detail::force<impl_const_iterator>(position), container_detail::force<impl_value_type>(x))); }
 
    //! <b>Effects</b>: Inserts an element move constructed from x in the container.
    //! p is a hint pointing to where the insert should start to search.
@@ -508,8 +516,8 @@
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
    iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
- { return force_copy<iterator>(
- m_flat_tree.insert_unique(force<impl_const_iterator>(position), boost::move(force<impl_value_type>(x)))); }
+ { return container_detail::force_copy<iterator>(
+ m_flat_tree.insert_unique(container_detail::force<impl_const_iterator>(position), boost::move(container_detail::force<impl_value_type>(x)))); }
 
    //! <b>Effects</b>: Inserts an element move constructed from x in the container.
    //! p is a hint pointing to where the insert should start to search.
@@ -522,8 +530,8 @@
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
    iterator insert(const_iterator position, BOOST_RV_REF(impl_value_type) x)
    {
- return force_copy<iterator>(
- m_flat_tree.insert_unique(force<impl_const_iterator>(position), boost::move(x)));
+ return container_detail::force_copy<iterator>(
+ m_flat_tree.insert_unique(container_detail::force<impl_const_iterator>(position), boost::move(x)));
    }
 
    //! <b>Requires</b>: first, last are not iterators into *this.
@@ -539,7 +547,7 @@
    void insert(InputIterator first, InputIterator last)
    { m_flat_tree.insert_unique(first, last); }
 
- #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... if and only if there is no element in the container
@@ -555,7 +563,7 @@
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
    template <class... Args>
    iterator emplace(Args&&... args)
- { return force_copy<iterator>(m_flat_tree.emplace_unique(boost::forward<Args>(args)...)); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.emplace_unique(boost::forward<Args>(args)...)); }
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... in the container if and only if there is
@@ -571,36 +579,27 @@
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
    template <class... Args>
    iterator emplace_hint(const_iterator hint, Args&&... args)
- { return force_copy<iterator>(m_flat_tree.emplace_hint_unique(force<impl_const_iterator>(hint), boost::forward<Args>(args)...)); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.emplace_hint_unique(container_detail::force<impl_const_iterator>(hint), boost::forward<Args>(args)...)); }
 
- #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
- iterator emplace()
- { return force_copy<iterator>(m_flat_tree.emplace_unique()); }
-
- iterator emplace_hint(const_iterator hint)
- { return force_copy<iterator>(m_flat_tree.emplace_hint_unique(force<impl_const_iterator>(hint))); }
-
- #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { \
- return force_copy<iterator>(m_flat_tree.emplace_unique \
- (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _))); \
- } \
- \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { \
- return force_copy<iterator>(m_flat_tree.emplace_hint_unique \
- (force<impl_const_iterator>(hint), \
- BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _))); \
- } \
+ #define BOOST_PP_LOCAL_MACRO(n) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { return container_detail::force_copy<iterator>(m_flat_tree.emplace_unique \
+ (BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); } \
+ \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace_hint(const_iterator hint \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { return container_detail::force_copy<iterator>(m_flat_tree.emplace_hint_unique \
+ (container_detail::force<impl_const_iterator>(hint) \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); } \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! <b>Effects</b>: Erases the element pointed to by position.
    //!
@@ -613,7 +612,7 @@
    //! <b>Note</b>: Invalidates elements with keys
    //! not less than the erased element.
    iterator erase(const_iterator position)
- { return force_copy<iterator>(m_flat_tree.erase(force<impl_const_iterator>(position))); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.erase(container_detail::force<impl_const_iterator>(position))); }
 
    //! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
    //!
@@ -633,7 +632,7 @@
    //! <b>Complexity</b>: Logarithmic search time plus erasure time
    //! linear to the elements with bigger keys.
    iterator erase(const_iterator first, const_iterator last)
- { return force_copy<iterator>(m_flat_tree.erase(force<impl_const_iterator>(first), force<impl_const_iterator>(last))); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.erase(container_detail::force<impl_const_iterator>(first), container_detail::force<impl_const_iterator>(last))); }
 
    //! <b>Effects</b>: erase(a.begin(),a.end()).
    //!
@@ -657,14 +656,14 @@
    //!
    //! <b>Complexity</b>: Logarithmic.
    iterator find(const key_type& x)
- { return force_copy<iterator>(m_flat_tree.find(x)); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.find(x)); }
 
    //! <b>Returns</b>: A const_iterator pointing to an element with the key
    //! equivalent to x, or end() if such an element is not found.
    //!
    //! <b>Complexity</b>: Logarithmic.s
    const_iterator find(const key_type& x) const
- { return force<const_iterator>(m_flat_tree.find(x)); }
+ { return container_detail::force<const_iterator>(m_flat_tree.find(x)); }
 
    //! <b>Returns</b>: The number of elements with key equivalent to x.
    //!
@@ -677,40 +676,40 @@
    //!
    //! <b>Complexity</b>: Logarithmic
    iterator lower_bound(const key_type& x)
- { return force_copy<iterator>(m_flat_tree.lower_bound(x)); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.lower_bound(x)); }
 
    //! <b>Returns</b>: A const iterator pointing to the first element with key not
    //! less than k, or a.end() if such an element is not found.
    //!
    //! <b>Complexity</b>: Logarithmic
    const_iterator lower_bound(const key_type& x) const
- { return force<const_iterator>(m_flat_tree.lower_bound(x)); }
+ { return container_detail::force<const_iterator>(m_flat_tree.lower_bound(x)); }
 
    //! <b>Returns</b>: An iterator pointing to the first element with key not less
    //! than x, or end() if such an element is not found.
    //!
    //! <b>Complexity</b>: Logarithmic
    iterator upper_bound(const key_type& x)
- { return force_copy<iterator>(m_flat_tree.upper_bound(x)); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.upper_bound(x)); }
 
    //! <b>Returns</b>: A const iterator pointing to the first element with key not
    //! less than x, or end() if such an element is not found.
    //!
    //! <b>Complexity</b>: Logarithmic
    const_iterator upper_bound(const key_type& x) const
- { return force<const_iterator>(m_flat_tree.upper_bound(x)); }
+ { return container_detail::force<const_iterator>(m_flat_tree.upper_bound(x)); }
 
    //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! <b>Complexity</b>: Logarithmic
    std::pair<iterator,iterator> equal_range(const key_type& x)
- { return force<std::pair<iterator,iterator> >(m_flat_tree.equal_range(x)); }
+ { return container_detail::force<std::pair<iterator,iterator> >(m_flat_tree.equal_range(x)); }
 
    //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! <b>Complexity</b>: Logarithmic
    std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const
- { return force<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); }
+ { return container_detail::force<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); }
 
    //! <b>Effects</b>: Number of elements for which memory has been allocated.
    //! capacity() is always greater than or equal to size().
@@ -740,6 +739,29 @@
    template <class K1, class T1, class C1, class A1>
    friend bool operator< (const flat_map<K1, T1, C1, A1>&,
                            const flat_map<K1, T1, C1, A1>&);
+
+ private:
+ mapped_type &priv_subscript(const key_type& k)
+ {
+ iterator i = lower_bound(k);
+ // i->first is greater than or equivalent to k.
+ if (i == end() || key_comp()(k, (*i).first)){
+ container_detail::value_init<mapped_type> m;
+ i = insert(i, impl_value_type(k, ::boost::move(m.m_t)));
+ }
+ return (*i).second;
+ }
+ mapped_type &priv_subscript(BOOST_RV_REF(key_type) mk)
+ {
+ key_type &k = mk;
+ iterator i = lower_bound(k);
+ // i->first is greater than or equivalent to k.
+ if (i == end() || key_comp()(k, (*i).first)){
+ container_detail::value_init<mapped_type> m;
+ i = insert(i, impl_value_type(boost::move(k), ::boost::move(m.m_t)));
+ }
+ return (*i).second;
+ }
    /// @endcond
 };
 
@@ -833,18 +855,18 @@
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(flat_multimap)
- typedef containers_detail::flat_tree<Key,
+ typedef container_detail::flat_tree<Key,
                            std::pair<Key, T>,
- containers_detail::select1st< std::pair<Key, T> >,
+ container_detail::select1st< std::pair<Key, T> >,
                            Pred,
                            A> tree_t;
    //This is the real tree stored here. It's based on a movable pair
- typedef containers_detail::flat_tree<Key,
- containers_detail::pair<Key, T>,
- containers_detail::select1st<containers_detail::pair<Key, T> >,
+ typedef container_detail::flat_tree<Key,
+ container_detail::pair<Key, T>,
+ container_detail::select1st<container_detail::pair<Key, T> >,
                            Pred,
- typename A::template
- rebind<containers_detail::pair<Key, T> >::other> impl_tree_t;
+ typename allocator_traits<A>::template portable_rebind_alloc
+ <container_detail::pair<Key, T> >::type> impl_tree_t;
    impl_tree_t m_flat_tree; // flat tree representing flat_map
 
    typedef typename impl_tree_t::value_type impl_value_type;
@@ -858,56 +880,55 @@
    typedef typename impl_tree_t::reverse_iterator impl_reverse_iterator;
    typedef typename impl_tree_t::const_reverse_iterator impl_const_reverse_iterator;
    typedef typename impl_tree_t::allocator_type impl_allocator_type;
+ typedef allocator_traits<A> allocator_traits_type;
 
- template<class D, class S>
- static D &force(const S &s)
- { return *const_cast<D*>((reinterpret_cast<const D*>(&s))); }
-
- template<class D, class S>
- static D force_copy(S s)
- {
- value_type *vp = reinterpret_cast<value_type *>(&*s);
- return D(vp);
- }
    /// @endcond
 
    public:
 
    // typedefs:
- typedef typename impl_tree_t::key_type key_type;
- typedef T mapped_type;
- typedef typename std::pair<key_type, mapped_type> value_type;
- typedef typename A::pointer pointer;
- typedef typename A::const_pointer const_pointer;
- typedef typename A::reference reference;
- typedef typename A::const_reference const_reference;
- typedef containers_detail::flat_tree_value_compare
+ typedef Key key_type;
+ typedef T mapped_type;
+ typedef Pred key_compare;
+ typedef typename std::pair<key_type, mapped_type> value_type;
+ typedef typename allocator_traits_type::pointer pointer;
+ typedef typename allocator_traits_type::const_pointer const_pointer;
+ typedef typename allocator_traits_type::reference reference;
+ typedef typename allocator_traits_type::const_reference const_reference;
+ typedef typename impl_tree_t::size_type size_type;
+ typedef typename impl_tree_t::difference_type difference_type;
+ typedef container_detail::flat_tree_value_compare
       < Pred
- , containers_detail::select1st< std::pair<Key, T> >
- , std::pair<Key, T> > value_compare;
- typedef Pred key_compare;
- typedef typename containers_detail::
- get_flat_tree_iterators<pointer>::iterator iterator;
- typedef typename containers_detail::
- get_flat_tree_iterators<pointer>::const_iterator const_iterator;
- typedef typename containers_detail::
+ , container_detail::select1st< std::pair<Key, T> >
+ , std::pair<Key, T> > value_compare;
+
+ typedef typename container_detail::
+ get_flat_tree_iterators<pointer>::iterator iterator;
+ typedef typename container_detail::
+ get_flat_tree_iterators<pointer>::const_iterator const_iterator;
+ typedef typename container_detail::
       get_flat_tree_iterators
- <pointer>::reverse_iterator reverse_iterator;
- typedef typename containers_detail::
+ <pointer>::reverse_iterator reverse_iterator;
+ typedef typename container_detail::
       get_flat_tree_iterators
- <pointer>::const_reverse_iterator const_reverse_iterator;
- typedef typename impl_tree_t::size_type size_type;
- typedef typename impl_tree_t::difference_type difference_type;
- typedef A allocator_type;
- typedef A stored_allocator_type;
+ <pointer>::const_reverse_iterator const_reverse_iterator;
+ typedef A allocator_type;
+ //Non-standard extension
+ typedef A stored_allocator_type;
+
+ //! <b>Effects</b>: Default constructs an empty flat_map.
+ //!
+ //! <b>Complexity</b>: Constant.
+ flat_multimap()
+ : m_flat_tree() {}
 
    //! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison
    //! object and allocator.
    //!
    //! <b>Complexity</b>: Constant.
- explicit flat_multimap(const Pred& comp = Pred(),
+ explicit flat_multimap(const Pred& comp,
                           const allocator_type& a = allocator_type())
- : m_flat_tree(comp, force<impl_allocator_type>(a)) { }
+ : m_flat_tree(comp, container_detail::force<impl_allocator_type>(a)) { }
 
    //! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison object
    //! and allocator, and inserts elements from the range [first ,last ).
@@ -918,7 +939,7 @@
    flat_multimap(InputIterator first, InputIterator last,
             const Pred& comp = Pred(),
             const allocator_type& a = allocator_type())
- : m_flat_tree(comp, force<impl_allocator_type>(a))
+ : m_flat_tree(comp, container_detail::force<impl_allocator_type>(a))
       { m_flat_tree.insert_equal(first, last); }
 
    //! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison object and
@@ -967,27 +988,27 @@
    //!
    //! <b>Complexity</b>: Constant.
    key_compare key_comp() const
- { return force<key_compare>(m_flat_tree.key_comp()); }
+ { return container_detail::force<key_compare>(m_flat_tree.key_comp()); }
 
    //! <b>Effects</b>: Returns an object of value_compare constructed out
    //! of the comparison object.
    //!
    //! <b>Complexity</b>: Constant.
    value_compare value_comp() const
- { return value_compare(force<key_compare>(m_flat_tree.key_comp())); }
+ { return value_compare(container_detail::force<key_compare>(m_flat_tree.key_comp())); }
 
    //! <b>Effects</b>: Returns a copy of the Allocator that
    //! was passed to the object's constructor.
    //!
    //! <b>Complexity</b>: Constant.
    allocator_type get_allocator() const
- { return force<allocator_type>(m_flat_tree.get_allocator()); }
+ { return container_detail::force<allocator_type>(m_flat_tree.get_allocator()); }
 
    const stored_allocator_type &get_stored_allocator() const
- { return force<stored_allocator_type>(m_flat_tree.get_stored_allocator()); }
+ { return container_detail::force<stored_allocator_type>(m_flat_tree.get_stored_allocator()); }
 
    stored_allocator_type &get_stored_allocator()
- { return force<stored_allocator_type>(m_flat_tree.get_stored_allocator()); }
+ { return container_detail::force<stored_allocator_type>(m_flat_tree.get_stored_allocator()); }
 
    //! <b>Effects</b>: Returns an iterator to the first element contained in the container.
    //!
@@ -995,7 +1016,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    iterator begin()
- { return force_copy<iterator>(m_flat_tree.begin()); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.begin()); }
 
    //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
    //!
@@ -1003,7 +1024,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    const_iterator begin() const
- { return force<const_iterator>(m_flat_tree.begin()); }
+ { return container_detail::force<const_iterator>(m_flat_tree.begin()); }
 
    //! <b>Effects</b>: Returns an iterator to the end of the container.
    //!
@@ -1011,7 +1032,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    iterator end()
- { return force_copy<iterator>(m_flat_tree.end()); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.end()); }
 
    //! <b>Effects</b>: Returns a const_iterator to the end of the container.
    //!
@@ -1019,7 +1040,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    const_iterator end() const
- { return force<const_iterator>(m_flat_tree.end()); }
+ { return container_detail::force<const_iterator>(m_flat_tree.end()); }
 
    //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
    //! of the reversed container.
@@ -1028,7 +1049,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    reverse_iterator rbegin()
- { return force<reverse_iterator>(m_flat_tree.rbegin()); }
+ { return container_detail::force<reverse_iterator>(m_flat_tree.rbegin()); }
 
    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
    //! of the reversed container.
@@ -1037,7 +1058,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    const_reverse_iterator rbegin() const
- { return force<const_reverse_iterator>(m_flat_tree.rbegin()); }
+ { return container_detail::force<const_reverse_iterator>(m_flat_tree.rbegin()); }
 
    //! <b>Effects</b>: Returns a reverse_iterator pointing to the end
    //! of the reversed container.
@@ -1046,7 +1067,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    reverse_iterator rend()
- { return force<reverse_iterator>(m_flat_tree.rend()); }
+ { return container_detail::force<reverse_iterator>(m_flat_tree.rend()); }
 
    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
    //! of the reversed container.
@@ -1055,7 +1076,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    const_reverse_iterator rend() const
- { return force<const_reverse_iterator>(m_flat_tree.rend()); }
+ { return container_detail::force<const_reverse_iterator>(m_flat_tree.rend()); }
 
    //! <b>Effects</b>: Returns true if the container contains no elements.
    //!
@@ -1098,7 +1119,7 @@
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
    iterator insert(const value_type& x)
- { return force_copy<iterator>(m_flat_tree.insert_equal(force<impl_value_type>(x))); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.insert_equal(container_detail::force<impl_value_type>(x))); }
 
    //! <b>Effects</b>: Inserts a new value move-constructed from x and returns
    //! the iterator pointing to the newly inserted element.
@@ -1108,7 +1129,7 @@
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
    iterator insert(BOOST_RV_REF(value_type) x)
- { return force_copy<iterator>(m_flat_tree.insert_equal(boost::move(x))); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.insert_equal(boost::move(x))); }
 
    //! <b>Effects</b>: Inserts a new value move-constructed from x and returns
    //! the iterator pointing to the newly inserted element.
@@ -1118,7 +1139,7 @@
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
    iterator insert(BOOST_RV_REF(impl_value_type) x)
- { return force_copy<iterator>(m_flat_tree.insert_equal(boost::move(x))); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.insert_equal(boost::move(x))); }
 
    //! <b>Effects</b>: Inserts a copy of x in the container.
    //! p is a hint pointing to where the insert should start to search.
@@ -1132,7 +1153,7 @@
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
    iterator insert(const_iterator position, const value_type& x)
- { return force_copy<iterator>(m_flat_tree.insert_equal(force<impl_const_iterator>(position), force<impl_value_type>(x))); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.insert_equal(container_detail::force<impl_const_iterator>(position), container_detail::force<impl_value_type>(x))); }
 
    //! <b>Effects</b>: Inserts a value move constructed from x in the container.
    //! p is a hint pointing to where the insert should start to search.
@@ -1147,8 +1168,8 @@
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
    iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
    {
- return force_copy<iterator>
- (m_flat_tree.insert_equal(force<impl_const_iterator>(position)
+ return container_detail::force_copy<iterator>
+ (m_flat_tree.insert_equal(container_detail::force<impl_const_iterator>(position)
                                   , boost::move(x)));
    }
 
@@ -1165,8 +1186,8 @@
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
    iterator insert(const_iterator position, BOOST_RV_REF(impl_value_type) x)
    {
- return force_copy<iterator>(
- m_flat_tree.insert_equal(force<impl_const_iterator>(position), boost::move(x)));
+ return container_detail::force_copy<iterator>(
+ m_flat_tree.insert_equal(container_detail::force<impl_const_iterator>(position), boost::move(x)));
    }
 
    //! <b>Requires</b>: first, last are not iterators into *this.
@@ -1181,7 +1202,7 @@
    void insert(InputIterator first, InputIterator last)
       { m_flat_tree.insert_equal(first, last); }
 
- #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... and returns the iterator pointing to the
@@ -1193,7 +1214,7 @@
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
    template <class... Args>
    iterator emplace(Args&&... args)
- { return force_copy<iterator>(m_flat_tree.emplace_equal(boost::forward<Args>(args)...)); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.emplace_equal(boost::forward<Args>(args)...)); }
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... in the container.
@@ -1210,38 +1231,29 @@
    template <class... Args>
    iterator emplace_hint(const_iterator hint, Args&&... args)
    {
- return force_copy<iterator>(m_flat_tree.emplace_hint_equal
- (force<impl_const_iterator>(hint), boost::forward<Args>(args)...));
+ return container_detail::force_copy<iterator>(m_flat_tree.emplace_hint_equal
+ (container_detail::force<impl_const_iterator>(hint), boost::forward<Args>(args)...));
    }
 
- #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
- iterator emplace()
- { return force_copy<iterator>(m_flat_tree.emplace_equal()); }
-
- iterator emplace_hint(const_iterator hint)
- { return force_copy<iterator>(m_flat_tree.emplace_hint_equal(force<impl_const_iterator>(hint))); }
+ #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
- #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { \
- return force_copy<iterator>(m_flat_tree.emplace_equal \
- (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _))); \
- } \
- \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { \
- return force_copy<iterator>(m_flat_tree.emplace_hint_equal \
- (force<impl_const_iterator>(hint), \
- BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _))); \
- } \
+ #define BOOST_PP_LOCAL_MACRO(n) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { return container_detail::force_copy<iterator>(m_flat_tree.emplace_equal \
+ (BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); } \
+ \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace_hint(const_iterator hint \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { return container_detail::force_copy<iterator>(m_flat_tree.emplace_hint_equal \
+ (container_detail::force<impl_const_iterator>(hint) \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); } \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! <b>Effects</b>: Erases the element pointed to by position.
    //!
@@ -1254,7 +1266,7 @@
    //! <b>Note</b>: Invalidates elements with keys
    //! not less than the erased element.
    iterator erase(const_iterator position)
- { return force_copy<iterator>(m_flat_tree.erase(force<impl_const_iterator>(position))); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.erase(container_detail::force<impl_const_iterator>(position))); }
 
    //! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
    //!
@@ -1274,7 +1286,7 @@
    //! <b>Complexity</b>: Logarithmic search time plus erasure time
    //! linear to the elements with bigger keys.
    iterator erase(const_iterator first, const_iterator last)
- { return force_copy<iterator>(m_flat_tree.erase(force<impl_const_iterator>(first), force<impl_const_iterator>(last))); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.erase(container_detail::force<impl_const_iterator>(first), container_detail::force<impl_const_iterator>(last))); }
 
    //! <b>Effects</b>: erase(a.begin(),a.end()).
    //!
@@ -1298,14 +1310,14 @@
    //!
    //! <b>Complexity</b>: Logarithmic.
    iterator find(const key_type& x)
- { return force_copy<iterator>(m_flat_tree.find(x)); }
+ { return container_detail::force_copy<iterator>(m_flat_tree.find(x)); }
 
    //! <b>Returns</b>: An const_iterator pointing to an element with the key
    //! equivalent to x, or end() if such an element is not found.
    //!
    //! <b>Complexity</b>: Logarithmic.
    const_iterator find(const key_type& x) const
- { return force<const_iterator>(m_flat_tree.find(x)); }
+ { return container_detail::force<const_iterator>(m_flat_tree.find(x)); }
 
    //! <b>Returns</b>: The number of elements with key equivalent to x.
    //!
@@ -1318,41 +1330,41 @@
    //!
    //! <b>Complexity</b>: Logarithmic
    iterator lower_bound(const key_type& x)
- {return force_copy<iterator>(m_flat_tree.lower_bound(x)); }
+ {return container_detail::force_copy<iterator>(m_flat_tree.lower_bound(x)); }
 
    //! <b>Returns</b>: A const iterator pointing to the first element with key
    //! not less than k, or a.end() if such an element is not found.
    //!
    //! <b>Complexity</b>: Logarithmic
    const_iterator lower_bound(const key_type& x) const
- { return force<const_iterator>(m_flat_tree.lower_bound(x)); }
+ { return container_detail::force<const_iterator>(m_flat_tree.lower_bound(x)); }
 
    //! <b>Returns</b>: An iterator pointing to the first element with key not less
    //! than x, or end() if such an element is not found.
    //!
    //! <b>Complexity</b>: Logarithmic
    iterator upper_bound(const key_type& x)
- {return force_copy<iterator>(m_flat_tree.upper_bound(x)); }
+ {return container_detail::force_copy<iterator>(m_flat_tree.upper_bound(x)); }
 
    //! <b>Returns</b>: A const iterator pointing to the first element with key
    //! not less than x, or end() if such an element is not found.
    //!
    //! <b>Complexity</b>: Logarithmic
    const_iterator upper_bound(const key_type& x) const
- { return force<const_iterator>(m_flat_tree.upper_bound(x)); }
+ { return container_detail::force<const_iterator>(m_flat_tree.upper_bound(x)); }
 
    //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! <b>Complexity</b>: Logarithmic
    std::pair<iterator,iterator> equal_range(const key_type& x)
- { return force_copy<std::pair<iterator,iterator> >(m_flat_tree.equal_range(x)); }
+ { return container_detail::force_copy<std::pair<iterator,iterator> >(m_flat_tree.equal_range(x)); }
 
    //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! <b>Complexity</b>: Logarithmic
    std::pair<const_iterator,const_iterator>
       equal_range(const key_type& x) const
- { return force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); }
+ { return container_detail::force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); }
 
    //! <b>Effects</b>: Number of elements for which memory has been allocated.
    //! capacity() is always greater than or equal to size().
@@ -1440,4 +1452,4 @@
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif /* BOOST_CONTAINERS_FLAT_MAP_HPP */
+#endif /* BOOST_CONTAINER_FLAT_MAP_HPP */

Modified: trunk/boost/container/flat_set.hpp
==============================================================================
--- trunk/boost/container/flat_set.hpp (original)
+++ trunk/boost/container/flat_set.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_FLAT_SET_HPP
-#define BOOST_CONTAINERS_FLAT_SET_HPP
+#ifndef BOOST_CONTAINER_FLAT_SET_HPP
+#define BOOST_CONTAINER_FLAT_SET_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -74,9 +74,9 @@
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(flat_set)
- typedef containers_detail::flat_tree<T, T, containers_detail::identity<T>, Pred, A> tree_t;
+ typedef container_detail::flat_tree<T, T, container_detail::identity<T>, Pred, A> tree_t;
    tree_t m_flat_tree; // flat tree representing flat_set
- typedef typename containers_detail::
+ typedef typename container_detail::
       move_const_ref_type<T>::type insert_const_ref_type;
    /// @endcond
 
@@ -100,11 +100,18 @@
    typedef typename tree_t::allocator_type allocator_type;
    typedef typename tree_t::stored_allocator_type stored_allocator_type;
 
+ //! <b>Effects</b>: Defatuls constructs an empty flat_map.
+ //!
+ //! <b>Complexity</b>: Constant.
+ explicit flat_set()
+ : m_flat_tree()
+ {}
+
    //! <b>Effects</b>: Constructs an empty flat_map using the specified
    //! comparison object and allocator.
    //!
    //! <b>Complexity</b>: Constant.
- explicit flat_set(const Pred& comp = Pred(),
+ explicit flat_set(const Pred& comp,
                      const allocator_type& a = allocator_type())
       : m_flat_tree(comp, a)
    {}
@@ -344,7 +351,7 @@
    { return this->insert(const_cast<const T &>(x)); }
 
    template<class U>
- std::pair<iterator, bool> insert(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
+ std::pair<iterator, bool> insert(const U &u, typename container_detail::enable_if_c<container_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
    { return priv_insert(u); }
    #endif
 
@@ -381,7 +388,7 @@
    { return this->insert(position, const_cast<const T &>(x)); }
 
    template<class U>
- iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
+ iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c<container_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
    { return priv_insert(position, u); }
    #endif
 
@@ -410,7 +417,7 @@
    void insert(InputIterator first, InputIterator last)
       { m_flat_tree.insert_unique(first, last); }
 
- #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... if and only if there is no element in the container
@@ -444,27 +451,23 @@
    iterator emplace_hint(const_iterator hint, Args&&... args)
    { return m_flat_tree.emplace_hint_unique(hint, boost::forward<Args>(args)...); }
 
- #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
- iterator emplace()
- { return m_flat_tree.emplace_unique(); }
-
- iterator emplace_hint(const_iterator hint)
- { return m_flat_tree.emplace_hint_unique(hint); }
+ #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
- #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { return m_flat_tree.emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); } \
- \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { return m_flat_tree.emplace_hint_unique(hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); }\
+ #define BOOST_PP_LOCAL_MACRO(n) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { return m_flat_tree.emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \
+ \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace_hint(const_iterator hint \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { return m_flat_tree.emplace_hint_unique \
+ (hint BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! <b>Effects</b>: Erases the element pointed to by position.
    //!
@@ -702,9 +705,9 @@
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(flat_multiset)
- typedef containers_detail::flat_tree<T, T, containers_detail::identity<T>, Pred, A> tree_t;
+ typedef container_detail::flat_tree<T, T, container_detail::identity<T>, Pred, A> tree_t;
    tree_t m_flat_tree; // flat tree representing flat_multiset
- typedef typename containers_detail::
+ typedef typename container_detail::
       move_const_ref_type<T>::type insert_const_ref_type;
    /// @endcond
 
@@ -727,8 +730,14 @@
    typedef typename tree_t::allocator_type allocator_type;
    typedef typename tree_t::stored_allocator_type stored_allocator_type;
 
- // allocation/deallocation
- explicit flat_multiset(const Pred& comp = Pred(),
+ //! <b>Effects</b>: Defatuls constructs an empty flat_map.
+ //!
+ //! <b>Complexity</b>: Constant.
+ explicit flat_multiset()
+ : m_flat_tree()
+ {}
+
+ explicit flat_multiset(const Pred& comp,
                           const allocator_type& a = allocator_type())
       : m_flat_tree(comp, a) {}
 
@@ -943,7 +952,7 @@
    { return this->insert(const_cast<const T &>(x)); }
 
    template<class U>
- iterator insert(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
+ iterator insert(const U &u, typename container_detail::enable_if_c<container_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
    { return priv_insert(u); }
    #endif
 
@@ -975,7 +984,7 @@
    { return this->insert(position, const_cast<const T &>(x)); }
 
    template<class U>
- iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
+ iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c<container_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
    { return priv_insert(position, u); }
    #endif
 
@@ -1004,7 +1013,7 @@
    void insert(InputIterator first, InputIterator last)
       { m_flat_tree.insert_equal(first, last); }
 
- #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... and returns the iterator pointing to the
@@ -1033,27 +1042,23 @@
    iterator emplace_hint(const_iterator hint, Args&&... args)
    { return m_flat_tree.emplace_hint_equal(hint, boost::forward<Args>(args)...); }
 
- #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
- iterator emplace()
- { return m_flat_tree.emplace_equal(); }
-
- iterator emplace_hint(const_iterator hint)
- { return m_flat_tree.emplace_hint_equal(hint); }
+ #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
- #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { return m_flat_tree.emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); } \
- \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { return m_flat_tree.emplace_hint_equal(hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); } \
+ #define BOOST_PP_LOCAL_MACRO(n) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { return m_flat_tree.emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \
+ \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace_hint(const_iterator hint \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { return m_flat_tree.emplace_hint_equal \
+ (hint BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! <b>Effects</b>: Erases the element pointed to by position.
    //!
@@ -1258,4 +1263,4 @@
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif /* BOOST_CONTAINERS_FLAT_SET_HPP */
+#endif /* BOOST_CONTAINER_FLAT_SET_HPP */

Modified: trunk/boost/container/list.hpp
==============================================================================
--- trunk/boost/container/list.hpp (original)
+++ trunk/boost/container/list.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -7,8 +7,8 @@
 // See http://www.boost.org/libs/container for documentation.
 //
 
-#ifndef BOOST_CONTAINERS_LIST_HPP_
-#define BOOST_CONTAINERS_LIST_HPP_
+#ifndef BOOST_CONTAINER_LIST_HPP_
+#define BOOST_CONTAINER_LIST_HPP_
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -20,15 +20,16 @@
 #include <boost/container/detail/version_type.hpp>
 #include <boost/move/move.hpp>
 #include <boost/move/move_helpers.hpp>
-#include <boost/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/container/detail/utilities.hpp>
 #include <boost/container/detail/algorithms.hpp>
 #include <boost/type_traits/has_trivial_destructor.hpp>
 #include <boost/container/detail/mpl.hpp>
 #include <boost/intrusive/list.hpp>
+#include <boost/assert.hpp>
 #include <boost/container/detail/node_alloc_holder.hpp>
 
-#if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 #else
 //Preprocessor library to emulate perfect forwarding
 #include <boost/container/detail/preprocessor.hpp>
@@ -51,13 +52,13 @@
 #endif
 
 /// @cond
-namespace containers_detail {
+namespace container_detail {
 
 template<class VoidPointer>
 struct list_hook
 {
- typedef typename containers_detail::bi::make_list_base_hook
- <containers_detail::bi::void_pointer<VoidPointer>, containers_detail::bi::link_mode<containers_detail::bi::normal_link> >::type type;
+ typedef typename container_detail::bi::make_list_base_hook
+ <container_detail::bi::void_pointer<VoidPointer>, container_detail::bi::link_mode<container_detail::bi::normal_link> >::type type;
 };
 
 template <class T, class VoidPointer>
@@ -65,33 +66,28 @@
    : public list_hook<VoidPointer>::type
 {
 
- #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
    list_node()
       : m_data()
    {}
+ #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    template<class ...Args>
    list_node(Args &&...args)
       : m_data(boost::forward<Args>(args)...)
    {}
 
- #else //#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
-
- list_node()
- : m_data()
- {}
+ #else //#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 
    #define BOOST_PP_LOCAL_MACRO(n) \
    template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- list_node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)) \
+ list_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)) \
    {} \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif//#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif//#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 
    T m_data;
 };
@@ -99,21 +95,25 @@
 template<class A>
 struct intrusive_list_type
 {
- typedef typename A::value_type value_type;
- typedef typename boost::pointer_to_other
- <typename A::pointer, void>::type void_pointer;
- typedef typename containers_detail::list_node
+ typedef boost::container::allocator_traits<A> allocator_traits_type;
+ typedef typename allocator_traits_type::value_type value_type;
+ typedef typename boost::intrusive::pointer_traits
+ <typename allocator_traits_type::pointer>::template
+ rebind_pointer<void>::type
+ void_pointer;
+ typedef typename container_detail::list_node
          <value_type, void_pointer> node_type;
- typedef typename containers_detail::bi::make_list
+ typedef typename container_detail::bi::make_list
       < node_type
- , containers_detail::bi::base_hook<typename list_hook<void_pointer>::type>
- , containers_detail::bi::constant_time_size<true>
- , containers_detail::bi::size_type<typename A::size_type>
+ , container_detail::bi::base_hook<typename list_hook<void_pointer>::type>
+ , container_detail::bi::constant_time_size<true>
+ , container_detail::bi::size_type
+ <typename allocator_traits_type::size_type>
>::type container_type;
    typedef container_type type ;
 };
 
-} //namespace containers_detail {
+} //namespace container_detail {
 /// @endcond
 
 //! A list is a doubly linked list. That is, it is a Sequence that supports both
@@ -132,22 +132,23 @@
 template <class T, class A>
 #endif
 class list
- : protected containers_detail::node_alloc_holder
- <A, typename containers_detail::intrusive_list_type<A>::type>
+ : protected container_detail::node_alloc_holder
+ <A, typename container_detail::intrusive_list_type<A>::type>
 {
    /// @cond
    typedef typename
- containers_detail::intrusive_list_type<A>::type Icont;
+ container_detail::intrusive_list_type<A>::type Icont;
    typedef list <T, A> ThisType;
- typedef containers_detail::node_alloc_holder<A, Icont> AllocHolder;
+ typedef container_detail::node_alloc_holder<A, Icont> AllocHolder;
    typedef typename AllocHolder::NodePtr NodePtr;
    typedef typename AllocHolder::NodeAlloc NodeAlloc;
    typedef typename AllocHolder::ValAlloc ValAlloc;
    typedef typename AllocHolder::Node Node;
- typedef containers_detail::allocator_destroyer<NodeAlloc> Destroyer;
+ typedef container_detail::allocator_destroyer<NodeAlloc> Destroyer;
    typedef typename AllocHolder::allocator_v1 allocator_v1;
    typedef typename AllocHolder::allocator_v2 allocator_v2;
    typedef typename AllocHolder::alloc_version alloc_version;
+ typedef boost::container::allocator_traits<A> allocator_traits_type;
 
    class equal_to_value
    {
@@ -181,23 +182,23 @@
 
    public:
    //! The type of object, T, stored in the list
- typedef T value_type;
+ typedef T value_type;
    //! Pointer to T
- typedef typename A::pointer pointer;
+ typedef typename allocator_traits_type::pointer pointer;
    //! Const pointer to T
- typedef typename A::const_pointer const_pointer;
+ typedef typename allocator_traits_type::const_pointer const_pointer;
    //! Reference to T
- typedef typename A::reference reference;
+ typedef typename allocator_traits_type::reference reference;
    //! Const reference to T
- typedef typename A::const_reference const_reference;
+ typedef typename allocator_traits_type::const_reference const_reference;
    //! An unsigned integral type
- typedef typename A::size_type size_type;
+ typedef typename allocator_traits_type::size_type size_type;
    //! A signed integral type
- typedef typename A::difference_type difference_type;
+ typedef typename allocator_traits_type::difference_type difference_type;
    //! The allocator type
- typedef A allocator_type;
- //! The stored allocator type
- typedef NodeAlloc stored_allocator_type;
+ typedef A allocator_type;
+ //! Non-standard extension: the stored allocator type
+ typedef NodeAlloc stored_allocator_type;
 
    /// @cond
    private:
@@ -313,12 +314,21 @@
    //! Const iterator used to iterate backwards through a list.
    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
 
+ //! <b>Effects</b>: Default constructs a list.
+ //!
+ //! <b>Throws</b>: If allocator_type's default constructor throws.
+ //!
+ //! <b>Complexity</b>: Constant.
+ list()
+ : AllocHolder()
+ {}
+
    //! <b>Effects</b>: Constructs a list taking the allocator as parameter.
    //!
    //! <b>Throws</b>: If allocator_type's copy constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- explicit list(const allocator_type &a = A())
+ explicit list(const allocator_type &a)
       : AllocHolder(a)
    {}
 
@@ -329,7 +339,7 @@
    //! throws or T's default or copy constructor throws.
    //!
    //! <b>Complexity</b>: Linear to n.
- list(size_type n)
+ explicit list(size_type n)
       : AllocHolder(A())
    { this->resize(n); }
 
@@ -533,7 +543,6 @@
    size_type max_size() const
    { return AllocHolder::max_size(); }
 
-
    #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
    //! <b>Effects</b>: Inserts a copy of x at the beginning of the list.
    //!
@@ -711,7 +720,15 @@
    //! <b>Complexity</b>: Linear to the number of elements in x.
    ThisType& operator=(BOOST_COPY_ASSIGN_REF(ThisType) x)
    {
- if (this != &x) {
+ if (&x != this){
+ NodeAlloc &this_alloc = this->node_alloc();
+ const NodeAlloc &x_alloc = x.node_alloc();
+ container_detail::bool_<allocator_traits_type::
+ propagate_on_container_copy_assignment::value> flag;
+ if(flag && this_alloc != x_alloc){
+ this->clear();
+ }
+ this->AllocHolder::copy_assign_alloc(x);
          this->assign(x.begin(), x.end());
       }
       return *this;
@@ -725,10 +742,26 @@
    //! <b>Throws</b>: If allocator_type's copy constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- ThisType& operator=(BOOST_RV_REF(ThisType) mx)
+ ThisType& operator=(BOOST_RV_REF(ThisType) x)
    {
- this->clear();
- this->swap(mx);
+ if (&x != this){
+ NodeAlloc &this_alloc = this->node_alloc();
+ NodeAlloc &x_alloc = x.node_alloc();
+ //If allocators are equal we can just swap pointers
+ if(this_alloc == x_alloc){
+ //Destroy and swap pointers
+ this->clear();
+ this->icont() = boost::move(x.icont());
+ //Move allocator if needed
+ this->AllocHolder::move_assign_alloc(x);
+ }
+ //If unequal allocators, then do a one by one move
+ else{
+ typedef typename std::iterator_traits<iterator>::iterator_category ItCat;
+ this->assign( boost::make_move_iterator(x.begin())
+ , boost::make_move_iterator(x.end()));
+ }
+ }
       return *this;
    }
 
@@ -753,8 +786,8 @@
    template <class InpIt>
    void insert(const_iterator p, InpIt first, InpIt last)
    {
- const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
- typedef containers_detail::bool_<aux_boolean> Result;
+ const bool aux_boolean = container_detail::is_convertible<InpIt, size_type>::value;
+ typedef container_detail::bool_<aux_boolean> Result;
       this->priv_insert_dispatch(p, first, last, Result());
    }
 
@@ -780,7 +813,7 @@
    BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
    #endif
 
- #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... in the end of the list.
@@ -818,57 +851,40 @@
    template <class... Args>
    iterator emplace(const_iterator p, Args&&... args)
    {
- typename AllocHolder::Deallocator d(AllocHolder::create_node_and_deallocator());
- new ((void*)containers_detail::get_pointer(d.get())) Node(boost::forward<Args>(args)...);
- NodePtr node = d.get();
- d.release();
- return iterator(this->icont().insert(p.get(), *node));
+ NodePtr pnode(AllocHolder::create_node(boost::forward<Args>(args)...));
+ return iterator(this->icont().insert(p.get(), *pnode));
    }
 
- #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
- //0 args
- void emplace_back()
- { this->emplace(this->cend()); }
-
- void emplace_front()
- { this->emplace(this->cbegin()); }
-
- iterator emplace(const_iterator p)
- {
- typename AllocHolder::Deallocator d(AllocHolder::create_node_and_deallocator());
- new ((void*)containers_detail::get_pointer(d.get())) Node();
- NodePtr node = d.get();
- d.release();
- return iterator(this->icont().insert(p.get(), *node));
- }
+ #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
- this->emplace(this->cend(), BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ this->emplace(this->cend() \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
    } \
                                                                                                 \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- void emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { this->emplace(this->cbegin(), BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));} \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ void emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { \
+ this->emplace(this->cbegin() \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
+ } \
                                                                                                 \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace(const_iterator p, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace(const_iterator p \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
- typename AllocHolder::Deallocator d(AllocHolder::create_node_and_deallocator()); \
- new ((void*)containers_detail::get_pointer(d.get())) \
- Node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
- NodePtr node = d.get(); \
- d.release(); \
- return iterator(this->icont().insert(p.get(), *node)); \
+ NodePtr pnode (AllocHolder::create_node \
+ (BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); \
+ return iterator(this->icont().insert(p.get(), *pnode)); \
    } \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! <b>Requires</b>: p must be a valid iterator of *this.
    //!
@@ -907,8 +923,8 @@
    template <class InpIt>
    void assign(InpIt first, InpIt last)
    {
- const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
- typedef containers_detail::bool_<aux_boolean> Result;
+ const bool aux_boolean = container_detail::is_convertible<InpIt, size_type>::value;
+ typedef container_detail::bool_<aux_boolean> Result;
       this->priv_assign_dispatch(first, last, Result());
    }
 
@@ -925,14 +941,10 @@
    //!
    //! <b>Note</b>: Iterators of values obtained from list x now point to elements of
    //! this list. Iterators of this list and all the references are not invalidated.
- void splice(const_iterator p, ThisType& x)
+ void splice(const_iterator p, ThisType& x) BOOST_CONTAINER_NOEXCEPT
    {
- if((NodeAlloc&)*this == (NodeAlloc&)x){
- this->icont().splice(p.get(), x.icont());
- }
- else{
- throw std::runtime_error("list::splice called with unequal allocators");
- }
+ BOOST_ASSERT((NodeAlloc&)*this == (NodeAlloc&)x);
+ this->icont().splice(p.get(), x.icont());
    }
 
    //! <b>Requires</b>: p must point to an element contained
@@ -949,14 +961,10 @@
    //!
    //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
    //! list. Iterators of this list and all the references are not invalidated.
- void splice(const_iterator p, ThisType &x, const_iterator i)
+ void splice(const_iterator p, ThisType &x, const_iterator i) BOOST_CONTAINER_NOEXCEPT
    {
- if((NodeAlloc&)*this == (NodeAlloc&)x){
- this->icont().splice(p.get(), x.icont(), i.get());
- }
- else{
- throw std::runtime_error("list::splice called with unequal allocators");
- }
+ BOOST_ASSERT((NodeAlloc&)*this == (NodeAlloc&)x);
+ this->icont().splice(p.get(), x.icont(), i.get());
    }
 
    //! <b>Requires</b>: p must point to an element contained
@@ -972,14 +980,10 @@
    //!
    //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
    //! list. Iterators of this list and all the references are not invalidated.
- void splice(const_iterator p, ThisType &x, const_iterator first, const_iterator last)
+ void splice(const_iterator p, ThisType &x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
    {
- if((NodeAlloc&)*this == (NodeAlloc&)x){
- this->icont().splice(p.get(), x.icont(), first.get(), last.get());
- }
- else{
- throw std::runtime_error("list::splice called with unequal allocators");
- }
+ BOOST_ASSERT((NodeAlloc&)*this == (NodeAlloc&)x);
+ this->icont().splice(p.get(), x.icont(), first.get(), last.get());
    }
 
    //! <b>Requires</b>: p must point to an element contained
@@ -996,14 +1000,10 @@
    //!
    //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
    //! list. Iterators of this list and all the references are not invalidated.
- void splice(const_iterator p, ThisType &x, const_iterator first, const_iterator last, size_type n)
+ void splice(const_iterator p, ThisType &x, const_iterator first, const_iterator last, size_type n) BOOST_CONTAINER_NOEXCEPT
    {
- if((NodeAlloc&)*this == (NodeAlloc&)x){
- this->icont().splice(p.get(), x.icont(), first.get(), last.get(), n);
- }
- else{
- throw std::runtime_error("list::splice called with unequal allocators");
- }
+ BOOST_ASSERT((NodeAlloc&)*this == (NodeAlloc&)x);
+ this->icont().splice(p.get(), x.icont(), first.get(), last.get(), n);
    }
 
    //! <b>Effects</b>: Reverses the order of elements in the list.
@@ -1240,11 +1240,11 @@
    template <class InputIter>
    void priv_insert_dispatch(const_iterator p,
                              InputIter first, InputIter last,
- containers_detail::false_)
+ container_detail::false_)
    { this->priv_create_and_insert_nodes(p, first, last); }
 
    template<class Integer>
- void priv_insert_dispatch(const_iterator p, Integer n, Integer x, containers_detail::true_)
+ void priv_insert_dispatch(const_iterator p, Integer n, Integer x, container_detail::true_)
    { this->insert(p, (size_type)n, x); }
 
    void priv_fill_assign(size_type n, const T& val)
@@ -1262,11 +1262,11 @@
    }
 
    template <class Integer>
- void priv_assign_dispatch(Integer n, Integer val, containers_detail::true_)
+ void priv_assign_dispatch(Integer n, Integer val, container_detail::true_)
    { this->priv_fill_assign((size_type) n, (T) val); }
 
    template <class InputIter>
- void priv_assign_dispatch(InputIter first2, InputIter last2, containers_detail::false_)
+ void priv_assign_dispatch(InputIter first2, InputIter last2, container_detail::false_)
    {
       iterator first1 = this->begin();
       iterator last1 = this->end();
@@ -1370,4 +1370,4 @@
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif // BOOST_CONTAINERS_LIST_HPP_
+#endif // BOOST_CONTAINER_LIST_HPP_

Modified: trunk/boost/container/map.hpp
==============================================================================
--- trunk/boost/container/map.hpp (original)
+++ trunk/boost/container/map.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_MAP_HPP
-#define BOOST_CONTAINERS_MAP_HPP
+#ifndef BOOST_CONTAINER_MAP_HPP
+#define BOOST_CONTAINER_MAP_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -31,7 +31,10 @@
 #include <boost/container/detail/pair.hpp>
 #include <boost/container/detail/type_traits.hpp>
 #include <boost/move/move.hpp>
+#include <boost/move/move_helpers.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/container/detail/value_init.hpp>
+
 
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
@@ -74,9 +77,9 @@
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(map)
- typedef containers_detail::rbtree<Key,
+ typedef container_detail::rbtree<Key,
                            std::pair<const Key, T>,
- containers_detail::select1st< std::pair<const Key, T> >,
+ container_detail::select1st< std::pair<const Key, T> >,
                            Pred,
                            A> tree_t;
    tree_t m_tree; // red-black tree representing map
@@ -103,7 +106,7 @@
    typedef typename tree_t::allocator_type allocator_type;
    typedef typename tree_t::stored_allocator_type stored_allocator_type;
    typedef std::pair<key_type, mapped_type> nonconst_value_type;
- typedef containers_detail::pair
+ typedef container_detail::pair
       <key_type, mapped_type> nonconst_impl_value_type;
 
    /// @cond
@@ -122,16 +125,26 @@
    /// @endcond
    typedef value_compare_impl value_compare;
 
+ //! <b>Effects</b>: Default constructs an empty map.
+ //!
+ //! <b>Complexity</b>: Constant.
+ map()
+ : m_tree()
+ {
+ //Allocator type must be std::pair<CONST Key, T>
+ BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
+ }
+
    //! <b>Effects</b>: Constructs an empty map using the specified comparison object
    //! and allocator.
    //!
    //! <b>Complexity</b>: Constant.
- explicit map(const Pred& comp = Pred(),
+ explicit map(const Pred& comp,
                 const allocator_type& a = allocator_type())
       : m_tree(comp, a)
    {
       //Allocator type must be std::pair<CONST Key, T>
- BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
+ BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
    }
 
    //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
@@ -145,7 +158,7 @@
       : m_tree(first, last, comp, a, true)
    {
       //Allocator type must be std::pair<CONST Key, T>
- BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
+ BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
    }
 
    //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
@@ -162,7 +175,7 @@
       : m_tree(ordered_range, first, last, comp, a)
    {
       //Allocator type must be std::pair<CONST Key, T>
- BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
+ BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
    }
 
    //! <b>Effects</b>: Copy constructs a map.
@@ -172,7 +185,7 @@
       : m_tree(x.m_tree)
    {
       //Allocator type must be std::pair<CONST Key, T>
- BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
+ BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
    }
 
    //! <b>Effects</b>: Move constructs a map. Constructs *this using x's resources.
@@ -184,7 +197,7 @@
       : m_tree(boost::move(x.m_tree))
    {
       //Allocator type must be std::pair<CONST Key, T>
- BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
+ BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
    }
 
    //! <b>Effects</b>: Makes *this a copy of x.
@@ -318,24 +331,14 @@
    size_type max_size() const
    { return m_tree.max_size(); }
 
+ #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
    //! Effects: If there is no key equivalent to x in the map, inserts
    //! value_type(x, T()) into the map.
    //!
    //! Returns: A reference to the mapped_type corresponding to x in *this.
    //!
    //! Complexity: Logarithmic.
- T& operator[](const key_type& k)
- {
- //we can optimize this
- iterator i = lower_bound(k);
- // i->first is greater than or equivalent to k.
- if (i == end() || key_comp()(k, (*i).first)){
- containers_detail::value_init<T> v;
- value_type val(k, boost::move(v.m_t));
- i = insert(i, boost::move(val));
- }
- return (*i).second;
- }
+ mapped_type& operator[](const key_type &k);
 
    //! Effects: If there is no key equivalent to x in the map, inserts
    //! value_type(boost::move(x), T()) into the map (the key is move-constructed)
@@ -343,18 +346,10 @@
    //! Returns: A reference to the mapped_type corresponding to x in *this.
    //!
    //! Complexity: Logarithmic.
- T& operator[](BOOST_RV_REF(key_type) mk)
- {
- key_type &k = mk;
- //we can optimize this
- iterator i = lower_bound(k);
- // i->first is greater than or equivalent to k.
- if (i == end() || key_comp()(k, (*i).first)){
- value_type val(boost::move(k), boost::move(T()));
- i = insert(i, boost::move(val));
- }
- return (*i).second;
- }
+ mapped_type& operator[](key_type &&k);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, priv_subscript)
+ #endif
 
    //! Returns: A reference to the element whose key is equivalent to x.
    //! Throws: An exception object of type out_of_range if no such element is present.
@@ -508,7 +503,7 @@
    void insert(InputIterator first, InputIterator last)
    { m_tree.insert_unique(first, last); }
 
- #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... in the container if and only if there is
@@ -538,27 +533,23 @@
    iterator emplace_hint(const_iterator hint, Args&&... args)
    { return m_tree.emplace_hint_unique(hint, boost::forward<Args>(args)...); }
 
- #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
- iterator emplace()
- { return m_tree.emplace_unique(); }
-
- iterator emplace_hint(const_iterator hint)
- { return m_tree.emplace_hint_unique(hint); }
-
- #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { return m_tree.emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); } \
- \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { return m_tree.emplace_hint_unique(hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));}\
+ #define BOOST_PP_LOCAL_MACRO(n) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { return m_tree.emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \
+ \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace_hint(const_iterator hint \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { return m_tree.emplace_hint_unique(hint \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));} \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! <b>Effects</b>: Erases the element pointed to by position.
    //!
@@ -660,7 +651,35 @@
                            const map<K1, T1, C1, A1>&);
    template <class K1, class T1, class C1, class A1>
    friend bool operator< (const map<K1, T1, C1, A1>&,
- const map<K1, T1, C1, A1>&);
+ const map<K1, T1, C1, A1>&);
+ private:
+ mapped_type& priv_subscript(const key_type &k)
+ {
+ //we can optimize this
+ iterator i = lower_bound(k);
+ // i->first is greater than or equivalent to k.
+ if (i == end() || key_comp()(k, (*i).first)){
+ container_detail::value_init<mapped_type> m;
+ nonconst_impl_value_type val(k, boost::move(m.m_t));
+ i = insert(i, boost::move(val));
+ }
+ return (*i).second;
+ }
+
+ mapped_type& priv_subscript(BOOST_RV_REF(key_type) mk)
+ {
+ key_type &k = mk;
+ //we can optimize this
+ iterator i = lower_bound(k);
+ // i->first is greater than or equivalent to k.
+ if (i == end() || key_comp()(k, (*i).first)){
+ container_detail::value_init<mapped_type> m;
+ nonconst_impl_value_type val(boost::move(k), boost::move(m.m_t));
+ i = insert(i, boost::move(val));
+ }
+ return (*i).second;
+ }
+
    /// @endcond
 };
 
@@ -747,12 +766,14 @@
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(multimap)
- typedef containers_detail::rbtree<Key,
+ typedef container_detail::rbtree<Key,
                            std::pair<const Key, T>,
- containers_detail::select1st< std::pair<const Key, T> >,
+ container_detail::select1st< std::pair<const Key, T> >,
                            Pred,
                            A> tree_t;
    tree_t m_tree; // red-black tree representing map
+ typedef typename container_detail::
+ move_const_ref_type<Key>::type insert_key_const_ref_type;
    /// @endcond
 
    public:
@@ -775,7 +796,7 @@
    typedef typename tree_t::allocator_type allocator_type;
    typedef typename tree_t::stored_allocator_type stored_allocator_type;
    typedef std::pair<key_type, mapped_type> nonconst_value_type;
- typedef containers_detail::pair
+ typedef container_detail::pair
       <key_type, mapped_type> nonconst_impl_value_type;
 
    /// @cond
@@ -794,16 +815,25 @@
    /// @endcond
    typedef value_compare_impl value_compare;
 
+ //! <b>Effects</b>: Default constructs an empty multimap.
+ //!
+ //! <b>Complexity</b>: Constant.
+ multimap()
+ : m_tree()
+ {
+ //Allocator type must be std::pair<CONST Key, T>
+ BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
+ }
+
    //! <b>Effects</b>: Constructs an empty multimap using the specified comparison
    //! object and allocator.
    //!
    //! <b>Complexity</b>: Constant.
- explicit multimap(const Pred& comp = Pred(),
- const allocator_type& a = allocator_type())
+ explicit multimap(const Pred& comp, const allocator_type& a = allocator_type())
       : m_tree(comp, a)
    {
       //Allocator type must be std::pair<CONST Key, T>
- BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
+ BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
    }
 
    //! <b>Effects</b>: Constructs an empty multimap using the specified comparison object
@@ -818,7 +848,7 @@
       : m_tree(first, last, comp, a, false)
    {
       //Allocator type must be std::pair<CONST Key, T>
- BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
+ BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
    }
 
    //! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and
@@ -842,7 +872,7 @@
       : m_tree(x.m_tree)
    {
       //Allocator type must be std::pair<CONST Key, T>
- BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
+ BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
    }
 
    //! <b>Effects</b>: Move constructs a multimap. Constructs *this using x's resources.
@@ -854,7 +884,7 @@
       : m_tree(boost::move(x.m_tree))
    {
       //Allocator type must be std::pair<CONST Key, T>
- BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
+ BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
    }
 
    //! <b>Effects</b>: Makes *this a copy of x.
@@ -1078,7 +1108,7 @@
    void insert(InputIterator first, InputIterator last)
    { m_tree.insert_equal(first, last); }
 
- #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... in the container.
@@ -1106,27 +1136,23 @@
    iterator emplace_hint(const_iterator hint, Args&&... args)
    { return m_tree.emplace_hint_equal(hint, boost::forward<Args>(args)...); }
 
- #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
- iterator emplace()
- { return m_tree.emplace_equal(); }
-
- iterator emplace_hint(const_iterator hint)
- { return m_tree.emplace_hint_equal(hint); }
+ #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
- #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { return m_tree.emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); } \
- \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { return m_tree.emplace_hint_equal(hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); }\
+ #define BOOST_PP_LOCAL_MACRO(n) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { return m_tree.emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \
+ \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace_hint(const_iterator hint \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { return m_tree.emplace_hint_equal(hint \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));} \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! <b>Effects</b>: Erases the element pointed to by position.
    //!
@@ -1288,5 +1314,5 @@
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif /* BOOST_CONTAINERS_MAP_HPP */
+#endif /* BOOST_CONTAINER_MAP_HPP */
 

Modified: trunk/boost/container/set.hpp
==============================================================================
--- trunk/boost/container/set.hpp (original)
+++ trunk/boost/container/set.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_SET_HPP
-#define BOOST_CONTAINERS_SET_HPP
+#ifndef BOOST_CONTAINER_SET_HPP
+#define BOOST_CONTAINER_SET_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -27,7 +27,7 @@
 #include <boost/container/detail/mpl.hpp>
 #include <boost/container/detail/tree.hpp>
 #include <boost/move/move.hpp>
-#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
+#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 #include <boost/container/detail/preprocessor.hpp>
 #endif
 
@@ -67,10 +67,10 @@
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(set)
- typedef containers_detail::rbtree<T, T,
- containers_detail::identity<T>, Pred, A> tree_t;
+ typedef container_detail::rbtree<T, T,
+ container_detail::identity<T>, Pred, A> tree_t;
    tree_t m_tree; // red-black tree representing set
- typedef typename containers_detail::
+ typedef typename container_detail::
       move_const_ref_type<T>::type insert_const_ref_type;
    /// @endcond
 
@@ -94,11 +94,18 @@
    typedef typename tree_t::allocator_type allocator_type;
    typedef typename tree_t::stored_allocator_type stored_allocator_type;
 
+ //! <b>Effects</b>: Default constructs an empty set.
+ //!
+ //! <b>Complexity</b>: Constant.
+ set()
+ : m_tree()
+ {}
+
    //! <b>Effects</b>: Constructs an empty set using the specified comparison object
    //! and allocator.
    //!
    //! <b>Complexity</b>: Constant.
- explicit set(const Pred& comp = Pred(),
+ explicit set(const Pred& comp,
                 const allocator_type& a = allocator_type())
       : m_tree(comp, a)
    {}
@@ -334,7 +341,7 @@
    { return this->insert(const_cast<const T &>(x)); }
 
    template<class U>
- std::pair<iterator,bool> insert(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
+ std::pair<iterator,bool> insert(const U &u, typename container_detail::enable_if_c<container_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
    { return priv_insert(u); }
    #endif
 
@@ -366,7 +373,7 @@
    { return this->insert(position, const_cast<const T &>(x)); }
 
    template<class U>
- iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
+ iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c<container_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
    { return priv_insert(position, u); }
    #endif
 
@@ -389,7 +396,7 @@
    void insert(InputIterator first, InputIterator last)
    { m_tree.insert_unique(first, last); }
 
- #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... if and only if there is
@@ -418,27 +425,23 @@
    iterator emplace_hint(const_iterator hint, Args&&... args)
    { return m_tree.emplace_hint_unique(hint, boost::forward<Args>(args)...); }
 
- #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
- iterator emplace()
- { return m_tree.emplace_unique(); }
-
- iterator emplace_hint(const_iterator hint)
- { return m_tree.emplace_hint_unique(hint); }
-
- #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { return m_tree.emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); } \
- \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { return m_tree.emplace_hint_unique(hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _));}\
+ #define BOOST_PP_LOCAL_MACRO(n) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { return m_tree.emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \
+ \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace_hint(const_iterator hint \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { return m_tree.emplace_hint_unique(hint \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));} \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! <b>Effects</b>: Erases the element pointed to by p.
    //!
@@ -629,10 +632,10 @@
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(multiset)
- typedef containers_detail::rbtree<T, T,
- containers_detail::identity<T>, Pred, A> tree_t;
+ typedef container_detail::rbtree<T, T,
+ container_detail::identity<T>, Pred, A> tree_t;
    tree_t m_tree; // red-black tree representing multiset
- typedef typename containers_detail::
+ typedef typename container_detail::
       move_const_ref_type<T>::type insert_const_ref_type;
    /// @endcond
 
@@ -660,7 +663,15 @@
    //! object and allocator.
    //!
    //! <b>Complexity</b>: Constant.
- explicit multiset(const Pred& comp = Pred(),
+ multiset()
+ : m_tree()
+ {}
+
+ //! <b>Effects</b>: Constructs an empty multiset using the specified comparison
+ //! object and allocator.
+ //!
+ //! <b>Complexity</b>: Constant.
+ explicit multiset(const Pred& comp,
                      const allocator_type& a = allocator_type())
       : m_tree(comp, a)
    {}
@@ -893,7 +904,7 @@
    { return this->insert(const_cast<const T &>(x)); }
 
    template<class U>
- iterator insert(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
+ iterator insert(const U &u, typename container_detail::enable_if_c<container_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
    { return priv_insert(u); }
    #endif
 
@@ -923,7 +934,7 @@
    { return this->insert(position, const_cast<const T &>(x)); }
 
    template<class U>
- iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
+ iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c<container_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
    { return priv_insert(position, u); }
    #endif
 
@@ -947,7 +958,7 @@
    void insert(InputIterator first, InputIterator last)
    { m_tree.insert_equal(first, last); }
 
- #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... and returns the iterator pointing to the
@@ -970,27 +981,23 @@
    iterator emplace_hint(const_iterator hint, Args&&... args)
    { return m_tree.emplace_hint_equal(hint, boost::forward<Args>(args)...); }
 
- #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
- iterator emplace()
- { return m_tree.emplace_equal(); }
-
- iterator emplace_hint(const_iterator hint)
- { return m_tree.emplace_hint_equal(hint); }
+ #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
- #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { return m_tree.emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); } \
- \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- { return m_tree.emplace_hint_equal(hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); }\
+ #define BOOST_PP_LOCAL_MACRO(n) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { return m_tree.emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \
+ \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace_hint(const_iterator hint \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { return m_tree.emplace_hint_equal(hint \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));} \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! <b>Effects</b>: Erases the element pointed to by p.
    //!
@@ -1159,5 +1166,5 @@
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif /* BOOST_CONTAINERS_SET_HPP */
+#endif /* BOOST_CONTAINER_SET_HPP */
 

Modified: trunk/boost/container/slist.hpp
==============================================================================
--- trunk/boost/container/slist.hpp (original)
+++ trunk/boost/container/slist.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_SLIST_HPP
-#define BOOST_CONTAINERS_SLIST_HPP
+#ifndef BOOST_CONTAINER_SLIST_HPP
+#define BOOST_CONTAINER_SLIST_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -20,7 +20,7 @@
 
 #include <boost/container/container_fwd.hpp>
 #include <boost/move/move.hpp>
-#include <boost/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/container/detail/utilities.hpp>
 #include <boost/container/detail/mpl.hpp>
 #include <boost/type_traits/has_trivial_destructor.hpp>
@@ -29,7 +29,7 @@
 #include <boost/intrusive/slist.hpp>
 
 
-#if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 //Preprocessor library to emulate perfect forwarding
 #else
 #include <boost/container/detail/preprocessor.hpp>
@@ -52,46 +52,43 @@
 
 /// @cond
 
-namespace containers_detail {
+namespace container_detail {
 
 template<class VoidPointer>
 struct slist_hook
 {
- typedef typename containers_detail::bi::make_slist_base_hook
- <containers_detail::bi::void_pointer<VoidPointer>, containers_detail::bi::link_mode<containers_detail::bi::normal_link> >::type type;
+ typedef typename container_detail::bi::make_slist_base_hook
+ <container_detail::bi::void_pointer<VoidPointer>, container_detail::bi::link_mode<container_detail::bi::normal_link> >::type type;
 };
 
 template <class T, class VoidPointer>
 struct slist_node
    : public slist_hook<VoidPointer>::type
 {
- #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    slist_node()
       : m_data()
    {}
 
+ #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
    template<class ...Args>
    slist_node(Args &&...args)
       : m_data(boost::forward<Args>(args)...)
    {}
 
- #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
- slist_node()
- : m_data()
- {}
+ #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
- #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- slist_node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)) \
- {} \
+ #define BOOST_PP_LOCAL_MACRO(n) \
+ template<BOOST_PP_ENUM_PARAMS(n, class P)> \
+ slist_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)) \
+ {} \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif//#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif//#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    T m_data;
 };
@@ -99,22 +96,26 @@
 template<class A>
 struct intrusive_slist_type
 {
- typedef typename A::value_type value_type;
- typedef typename boost::pointer_to_other
- <typename A::pointer, void>::type void_pointer;
- typedef typename containers_detail::slist_node
+ typedef boost::container::allocator_traits<A> allocator_traits_type;
+ typedef typename allocator_traits_type::value_type value_type;
+ typedef typename boost::intrusive::pointer_traits
+ <typename allocator_traits_type::pointer>::template
+ rebind_pointer<void>::type
+ void_pointer;
+ typedef typename container_detail::slist_node
          <value_type, void_pointer> node_type;
 
- typedef typename containers_detail::bi::make_slist
+ typedef typename container_detail::bi::make_slist
       <node_type
- ,containers_detail::bi::base_hook<typename slist_hook<void_pointer>::type>
- ,containers_detail::bi::constant_time_size<true>
- ,containers_detail::bi::size_type<typename A::size_type>
+ ,container_detail::bi::base_hook<typename slist_hook<void_pointer>::type>
+ ,container_detail::bi::constant_time_size<true>
+ , container_detail::bi::size_type
+ <typename allocator_traits_type::size_type>
>::type container_type;
    typedef container_type type ;
 };
 
-} //namespace containers_detail {
+} //namespace container_detail {
 
 /// @endcond
 
@@ -156,24 +157,25 @@
 template <class T, class A>
 #endif
 class slist
- : protected containers_detail::node_alloc_holder
- <A, typename containers_detail::intrusive_slist_type<A>::type>
+ : protected container_detail::node_alloc_holder
+ <A, typename container_detail::intrusive_slist_type<A>::type>
 {
    /// @cond
- typedef typename containers_detail::
+ typedef typename container_detail::
       move_const_ref_type<T>::type insert_const_ref_type;
    typedef typename
- containers_detail::intrusive_slist_type<A>::type Icont;
- typedef containers_detail::node_alloc_holder<A, Icont> AllocHolder;
+ container_detail::intrusive_slist_type<A>::type Icont;
+ typedef container_detail::node_alloc_holder<A, Icont> AllocHolder;
    typedef typename AllocHolder::NodePtr NodePtr;
    typedef slist <T, A> ThisType;
    typedef typename AllocHolder::NodeAlloc NodeAlloc;
    typedef typename AllocHolder::ValAlloc ValAlloc;
    typedef typename AllocHolder::Node Node;
- typedef containers_detail::allocator_destroyer<NodeAlloc> Destroyer;
+ typedef container_detail::allocator_destroyer<NodeAlloc> Destroyer;
    typedef typename AllocHolder::allocator_v1 allocator_v1;
    typedef typename AllocHolder::allocator_v2 allocator_v2;
    typedef typename AllocHolder::alloc_version alloc_version;
+ typedef boost::container::allocator_traits<A> allocator_traits_type;
 
    class equal_to_value
    {
@@ -206,23 +208,23 @@
    /// @endcond
    public:
    //! The type of object, T, stored in the list
- typedef T value_type;
+ typedef T value_type;
    //! Pointer to T
- typedef typename A::pointer pointer;
+ typedef typename allocator_traits_type::pointer pointer;
    //! Const pointer to T
- typedef typename A::const_pointer const_pointer;
+ typedef typename allocator_traits_type::const_pointer const_pointer;
    //! Reference to T
- typedef typename A::reference reference;
+ typedef typename allocator_traits_type::reference reference;
    //! Const reference to T
- typedef typename A::const_reference const_reference;
+ typedef typename allocator_traits_type::const_reference const_reference;
    //! An unsigned integral type
- typedef typename A::size_type size_type;
+ typedef typename allocator_traits_type::size_type size_type;
    //! A signed integral type
- typedef typename A::difference_type difference_type;
+ typedef typename allocator_traits_type::difference_type difference_type;
    //! The allocator type
- typedef A allocator_type;
- //! The stored allocator type
- typedef NodeAlloc stored_allocator_type;
+ typedef A allocator_type;
+ //! Non-standard extension: the stored allocator type
+ typedef NodeAlloc stored_allocator_type;
 
    /// @cond
    private:
@@ -328,7 +330,16 @@
    //! <b>Throws</b>: If allocator_type's copy constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- explicit slist(const allocator_type& a = allocator_type())
+ slist()
+ : AllocHolder()
+ {}
+
+ //! <b>Effects</b>: Constructs a list taking the allocator as parameter.
+ //!
+ //! <b>Throws</b>: If allocator_type's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Constant.
+ explicit slist(const allocator_type& a)
       : AllocHolder(a)
    {}
 
@@ -377,7 +388,7 @@
    //!
    //! <b>Complexity</b>: Constant.
    slist(BOOST_RV_REF(slist) x)
- : AllocHolder(boost::move((AllocHolder&)x))
+ : AllocHolder(boost::move(static_cast<AllocHolder&>(x)))
    {}
 
    //! <b>Effects</b>: Makes *this contain the same elements as x.
@@ -391,6 +402,14 @@
    slist& operator= (BOOST_COPY_ASSIGN_REF(slist) x)
    {
       if (&x != this){
+ NodeAlloc &this_alloc = this->node_alloc();
+ const NodeAlloc &x_alloc = x.node_alloc();
+ container_detail::bool_<allocator_traits_type::
+ propagate_on_container_copy_assignment::value> flag;
+ if(flag && this_alloc != x_alloc){
+ this->clear();
+ }
+ this->AllocHolder::copy_assign_alloc(x);
          this->assign(x.begin(), x.end());
       }
       return *this;
@@ -404,11 +423,25 @@
    //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
    //!
    //! <b>Complexity</b>: Linear to the number of elements in x.
- slist& operator= (BOOST_RV_REF(slist) mx)
+ slist& operator= (BOOST_RV_REF(slist) x)
    {
- if (&mx != this){
- this->clear();
- this->swap(mx);
+ if (&x != this){
+ NodeAlloc &this_alloc = this->node_alloc();
+ NodeAlloc &x_alloc = x.node_alloc();
+ //If allocators a re equal we can just swap pointers
+ if(this_alloc == x_alloc){
+ //Destroy and swap pointers
+ this->clear();
+ this->icont() = boost::move(x.icont());
+ //Move allocator if needed
+ this->AllocHolder::move_assign_alloc(x);
+ }
+ //If unequal allocators, then do a one by one move
+ else{
+ typedef typename std::iterator_traits<iterator>::iterator_category ItCat;
+ this->assign( boost::make_move_iterator(x.begin())
+ , boost::make_move_iterator(x.end()));
+ }
       }
       return *this;
    }
@@ -455,8 +488,8 @@
    template <class InpIt>
    void assign(InpIt first, InpIt last)
    {
- const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
- typedef containers_detail::bool_<aux_boolean> Result;
+ const bool aux_boolean = container_detail::is_convertible<InpIt, size_type>::value;
+ typedef container_detail::bool_<aux_boolean> Result;
       this->priv_assign_dispatch(first, last, Result());
    }
 
@@ -607,7 +640,7 @@
    void push_front(T &x) { push_front(const_cast<const T &>(x)); }
 
    template<class U>
- void push_front(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
+ void push_front(const U &u, typename container_detail::enable_if_c<container_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
    { return priv_push_front(u); }
    #endif
 
@@ -669,7 +702,7 @@
    { return this->insert_after(position, const_cast<const T &>(x)); }
 
    template<class U>
- iterator insert_after(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
+ iterator insert_after(const_iterator position, const U &u, typename container_detail::enable_if_c<container_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
    { return this->priv_insert_after(position, u); }
    #endif
 
@@ -717,8 +750,8 @@
    template <class InIter>
    void insert_after(const_iterator prev_pos, InIter first, InIter last)
    {
- const bool aux_boolean = containers_detail::is_convertible<InIter, size_type>::value;
- typedef containers_detail::bool_<aux_boolean> Result;
+ const bool aux_boolean = container_detail::is_convertible<InIter, size_type>::value;
+ typedef container_detail::bool_<aux_boolean> Result;
       this->priv_insert_after_range_dispatch(prev_pos, first, last, Result());
    }
 
@@ -737,7 +770,7 @@
    { return this->insert(position, const_cast<const T &>(x)); }
 
    template<class U>
- iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
+ iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c<container_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
    { return this->priv_insert(position, u); }
    #endif
 
@@ -774,7 +807,7 @@
    void insert(const_iterator p, InIter first, InIter last)
    { return this->insert_after(previous(p), first, last); }
 
- #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... in the front of the list
@@ -808,63 +841,42 @@
    template <class... Args>
    iterator emplace_after(const_iterator prev, Args&&... args)
    {
- typename AllocHolder::Deallocator d(AllocHolder::create_node_and_deallocator());
- new ((void*)containers_detail::get_pointer(d.get())) Node(boost::forward<Args>(args)...);
- NodePtr node = d.get();
- d.release();
- return iterator(this->icont().insert_after(prev.get(), *node));
+ NodePtr pnode(AllocHolder::create_node(boost::forward<Args>(args)...));
+ return iterator(this->icont().insert_after(prev.get(), *pnode));
    }
 
- #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
-
- //0 args
- void emplace_front()
- { this->emplace_after(this->cbefore_begin()); }
-
- iterator emplace(const_iterator p)
- { return this->emplace_after(this->previous(p)); }
-
- iterator emplace_after(const_iterator prev)
- {
- typename AllocHolder::Deallocator d(AllocHolder::create_node_and_deallocator());
- new ((void*)containers_detail::get_pointer(d.get())) Node();
- NodePtr node = d.get();
- d.release();
- return iterator(this->icont().insert_after(prev.get(), *node));
- }
+ #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- void emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ void emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
- this->emplace \
- (this->cbegin(), BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ this->emplace(this->cbegin() \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
    } \
                                                                                              \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace \
- (const_iterator p, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace (const_iterator p \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
       return this->emplace_after \
- (this->previous(p), BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ (this->previous(p) \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
    } \
                                                                                              \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace_after \
- (const_iterator prev, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace_after(const_iterator prev \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
- typename AllocHolder::Deallocator d(AllocHolder::create_node_and_deallocator()); \
- new ((void*)containers_detail::get_pointer(d.get())) \
- Node(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
- NodePtr node = d.get(); \
- d.release(); \
- return iterator(this->icont().insert_after(prev.get(), *node)); \
+ NodePtr pnode (AllocHolder::create_node \
+ (BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); \
+ return iterator(this->icont().insert_after(prev.get(), *pnode)); \
    } \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! <b>Effects</b>: Erases the element after the element pointed by prev_pos
    //! of the list.
@@ -1337,11 +1349,11 @@
    template <class InputIter>
    void priv_insert_dispatch(const_iterator prev,
                              InputIter first, InputIter last,
- containers_detail::false_)
+ container_detail::false_)
    { this->priv_create_and_insert_nodes(prev, first, last); }
 
    template<class Integer>
- void priv_insert_dispatch(const_iterator prev, Integer n, Integer x, containers_detail::true_)
+ void priv_insert_dispatch(const_iterator prev, Integer n, Integer x, container_detail::true_)
    { this->priv_create_and_insert_nodes(prev, (size_type)n, x); }
 
    void priv_fill_assign(size_type n, const T& val)
@@ -1361,11 +1373,11 @@
    }
 
    template <class Int>
- void priv_assign_dispatch(Int n, Int val, containers_detail::true_)
+ void priv_assign_dispatch(Int n, Int val, container_detail::true_)
    { this->priv_fill_assign((size_type) n, (T)val); }
 
    template <class InpIt>
- void priv_assign_dispatch(InpIt first, InpIt last, containers_detail::false_)
+ void priv_assign_dispatch(InpIt first, InpIt last, container_detail::false_)
    {
       iterator end_n(this->end());
       iterator prev(this->before_begin());
@@ -1383,11 +1395,11 @@
    }
 
    template <class Int>
- void priv_insert_after_range_dispatch(const_iterator prev_pos, Int n, Int x, containers_detail::true_)
+ void priv_insert_after_range_dispatch(const_iterator prev_pos, Int n, Int x, container_detail::true_)
    { this->priv_create_and_insert_nodes(prev_pos, (size_type)n, x); }
 
    template <class InIter>
- void priv_insert_after_range_dispatch(const_iterator prev_pos, InIter first, InIter last, containers_detail::false_)
+ void priv_insert_after_range_dispatch(const_iterator prev_pos, InIter first, InIter last, container_detail::false_)
    { this->priv_create_and_insert_nodes(prev_pos, first, last); }
 
    //Functors for member algorithm defaults
@@ -1533,4 +1545,4 @@
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif /* BOOST_CONTAINERS_SLIST_HPP */
+#endif /* BOOST_CONTAINER_SLIST_HPP */

Modified: trunk/boost/container/stable_vector.hpp
==============================================================================
--- trunk/boost/container/stable_vector.hpp (original)
+++ trunk/boost/container/stable_vector.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -27,15 +27,14 @@
 #include <boost/container/container_fwd.hpp>
 #include <boost/mpl/bool.hpp>
 #include <boost/mpl/not.hpp>
-#include <boost/noncopyable.hpp>
 #include <boost/type_traits/is_integral.hpp>
 #include <boost/container/detail/version_type.hpp>
 #include <boost/container/detail/multiallocation_chain.hpp>
 #include <boost/container/detail/utilities.hpp>
 #include <boost/container/detail/iterators.hpp>
 #include <boost/container/detail/algorithms.hpp>
-#include <boost/pointer_to_other.hpp>
-#include <boost/get_pointer.hpp>
+#include <boost/container/allocator/allocator_traits.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 
 #include <algorithm>
 #include <stdexcept>
@@ -79,7 +78,7 @@
 };
 
 template<class Ptr>
-inline typename smart_ptr_type<Ptr>::pointer get_pointer(const Ptr &ptr)
+inline typename smart_ptr_type<Ptr>::pointer to_raw_pointer(const Ptr &ptr)
 { return smart_ptr_type<Ptr>::get(ptr); }
 
 template <class C>
@@ -126,33 +125,29 @@
 struct node_type
    : public node_type_base<VoidPointer>
 {
- #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
    node_type()
       : value()
    {}
 
+ #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
    template<class ...Args>
    node_type(Args &&...args)
       : value(boost::forward<Args>(args)...)
    {}
 
- #else //BOOST_CONTAINERS_PERFECT_FORWARDING
-
- node_type()
- : value()
- {}
+ #else //BOOST_CONTAINER_PERFECT_FORWARDING
 
- #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- node_type(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- : value(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)) \
- {} \
+ #define BOOST_PP_LOCAL_MACRO(n) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ node_type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ : value(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)) \
+ {} \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif//BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif//BOOST_CONTAINER_PERFECT_FORWARDING
    
    void set_pointer(VoidPointer p)
    { node_type_base<VoidPointer>::set_pointer(p); }
@@ -163,33 +158,38 @@
 template<typename T, typename Reference, typename Pointer>
 class iterator
    : public std::iterator< std::random_access_iterator_tag
- , typename std::iterator_traits<Pointer>::value_type
- , typename std::iterator_traits<Pointer>::difference_type
+ , T
+ , typename boost::intrusive::
+ pointer_traits<Pointer>::difference_type
                          , Pointer
                          , Reference>
 {
+ typedef typename boost::intrusive::
+ pointer_traits<Pointer>::template
+ rebind_pointer<void>::type void_ptr;
+ typedef typename boost::intrusive::
+ pointer_traits<Pointer>::template
+ rebind_pointer<const void>::type const_void_ptr;
+ typedef node_type<void_ptr, T> node_type_t;
+ typedef typename boost::intrusive::
+ pointer_traits<Pointer>::template
+ rebind_pointer<node_type_t>::type node_type_ptr_t;
+ typedef typename boost::intrusive::
+ pointer_traits<Pointer>::template
+ rebind_pointer<const node_type_t>::type const_node_type_ptr_t;
+ typedef typename boost::intrusive::
+ pointer_traits<Pointer>::template
+ rebind_pointer<void_ptr>::type void_ptr_ptr;
 
- typedef typename boost::pointer_to_other
- <Pointer, void>::type void_ptr;
- typedef typename boost::pointer_to_other
- <Pointer, const void>::type const_void_ptr;
- typedef node_type<void_ptr, T> node_type_t;
- typedef typename boost::pointer_to_other
- <void_ptr, node_type_t>::type node_type_ptr_t;
- typedef typename boost::pointer_to_other
- <void_ptr, const node_type_t>::type const_node_type_ptr_t;
- typedef typename boost::pointer_to_other
- <void_ptr, void_ptr>::type void_ptr_ptr;
-
- friend class iterator<T, const T, typename boost::pointer_to_other<Pointer, T>::type>;
+ friend class iterator<T, const T, typename boost::intrusive::pointer_traits<Pointer>::template rebind_pointer<T>::type>;
 
    public:
- typedef std::random_access_iterator_tag iterator_category;
- typedef T value_type;
- typedef typename std::iterator_traits
- <Pointer>::difference_type difference_type;
- typedef Pointer pointer;
- typedef Reference reference;
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef T value_type;
+ typedef typename boost::intrusive::
+ pointer_traits<Pointer>::difference_type difference_type;
+ typedef Pointer pointer;
+ typedef Reference reference;
 
    iterator()
    {}
@@ -198,27 +198,24 @@
       : pn(pn)
    {}
 
- iterator(const iterator<T, T&, typename boost::pointer_to_other<Pointer, T>::type >& x)
+ iterator(const iterator<T, T&, typename boost::intrusive::pointer_traits<Pointer>::template rebind_pointer<T>::type>& x)
       : pn(x.pn)
    {}
    
    private:
    static node_type_ptr_t node_ptr_cast(const void_ptr &p)
    {
- using boost::get_pointer;
- return node_type_ptr_t(static_cast<node_type_t*>(stable_vector_detail::get_pointer(p)));
+ return node_type_ptr_t(static_cast<node_type_t*>(stable_vector_detail::to_raw_pointer(p)));
    }
 
    static const_node_type_ptr_t node_ptr_cast(const const_void_ptr &p)
    {
- using boost::get_pointer;
- return const_node_type_ptr_t(static_cast<const node_type_t*>(stable_vector_detail::get_pointer(p)));
+ return const_node_type_ptr_t(static_cast<const node_type_t*>(stable_vector_detail::to_raw_pointer(p)));
    }
 
    static void_ptr_ptr void_ptr_ptr_cast(const void_ptr &p)
    {
- using boost::get_pointer;
- return void_ptr_ptr(static_cast<void_ptr*>(stable_vector_detail::get_pointer(p)));
+ return void_ptr_ptr(static_cast<void_ptr*>(stable_vector_detail::to_raw_pointer(p)));
    }
 
    reference dereference() const
@@ -325,12 +322,15 @@
 template<class A>
 struct select_multiallocation_chain<A, 1>
 {
- typedef typename A::template
- rebind<void>::other::pointer void_ptr;
- typedef containers_detail::basic_multiallocation_chain
+ typedef typename boost::intrusive::pointer_traits
+ <typename allocator_traits<A>::pointer>::
+ template rebind_pointer<void>::type void_ptr;
+ typedef container_detail::basic_multiallocation_chain
       <void_ptr> multialloc_cached_counted;
- typedef boost::container::containers_detail::transform_multiallocation_chain
- <multialloc_cached_counted, typename A::value_type> type;
+ typedef boost::container::container_detail::
+ transform_multiallocation_chain
+ < multialloc_cached_counted
+ , typename allocator_traits<A>::value_type> type;
 };
 
 } //namespace stable_vector_detail
@@ -389,59 +389,82 @@
 class stable_vector
 {
    ///@cond
- typedef typename containers_detail::
- move_const_ref_type<T>::type insert_const_ref_type;
- typedef typename A::template
- rebind<void>::other::pointer void_ptr;
- typedef typename boost::pointer_to_other
- <void_ptr, const void>::type const_void_ptr;
- typedef typename A::template
- rebind<void_ptr>::other::pointer void_ptr_ptr;
- typedef typename boost::pointer_to_other
- <void_ptr, const void_ptr>::type const_void_ptr_ptr;
+ typedef allocator_traits<A> allocator_traits_type;
+ typedef typename container_detail::
+ move_const_ref_type<T>::type insert_const_ref_type;
+ typedef typename boost::intrusive::pointer_traits
+ <typename allocator_traits_type::pointer>::
+ template rebind_pointer<void>::type void_ptr;
+ typedef typename boost::intrusive::pointer_traits
+ <void_ptr>::template
+ rebind_pointer<const void>::type const_void_ptr;
+ typedef typename boost::intrusive::pointer_traits
+ <void_ptr>::template
+ rebind_pointer<void_ptr>::type void_ptr_ptr;
+ typedef typename boost::intrusive::pointer_traits
+ <void_ptr>::template
+ rebind_pointer<const void_ptr>::type const_void_ptr_ptr;
    typedef stable_vector_detail::node_type
       <void_ptr, T> node_type_t;
- typedef typename A::template
- rebind<node_type_t>::other::pointer node_type_ptr_t;
+ typedef typename boost::intrusive::pointer_traits
+ <void_ptr>::template
+ rebind_pointer<node_type_t>::type node_type_ptr_t;
    typedef stable_vector_detail::node_type_base
       <void_ptr> node_type_base_t;
- typedef typename A::template
- rebind<node_type_base_t>::other::pointer node_type_base_ptr_t;
- typedef
- ::boost::container::vector<void_ptr,
- typename A::
- template rebind<void_ptr>::other
- > impl_type;
+ typedef typename boost::intrusive::pointer_traits
+ <void_ptr>::template
+ rebind_pointer<node_type_base_t>::type node_type_base_ptr_t;
+ typedef ::boost::container::vector<void_ptr,
+ typename allocator_traits_type::
+ template portable_rebind_alloc
+ <void_ptr>::type> impl_type;
    typedef typename impl_type::iterator impl_iterator;
    typedef typename impl_type::const_iterator const_impl_iterator;
 
- typedef ::boost::container::containers_detail::
+ typedef ::boost::container::container_detail::
       integral_constant<unsigned, 1> allocator_v1;
- typedef ::boost::container::containers_detail::
+ typedef ::boost::container::container_detail::
       integral_constant<unsigned, 2> allocator_v2;
- typedef ::boost::container::containers_detail::integral_constant
- <unsigned, boost::container::containers_detail::
- version<A>::value> alloc_version;
- typedef typename A::
- template rebind<node_type_t>::other node_allocator_type;
+ typedef ::boost::container::container_detail::integral_constant
+ <unsigned, boost::container::container_detail::
+ version<A>::value> alloc_version;
+ typedef typename allocator_traits_type::
+ template portable_rebind_alloc
+ <node_type_t>::type node_allocator_type;
 
    node_type_ptr_t allocate_one()
    { return this->allocate_one(alloc_version()); }
 
- node_type_ptr_t allocate_one(allocator_v1)
- { return get_al().allocate(1); }
+ template<class AllocatorVersion>
+ node_type_ptr_t allocate_one(AllocatorVersion,
+ typename boost::container::container_detail::enable_if_c
+ <boost::container::container_detail::is_same<AllocatorVersion, allocator_v1>
+ ::value>::type * = 0)
+ { return node_alloc().allocate(1); }
 
- node_type_ptr_t allocate_one(allocator_v2)
- { return get_al().allocate_one(); }
+ template<class AllocatorVersion>
+ node_type_ptr_t allocate_one(AllocatorVersion,
+ typename boost::container::container_detail::enable_if_c
+ <boost::container::container_detail::is_same<AllocatorVersion, allocator_v2>
+ ::value>::type * = 0)
+ { return node_alloc().allocate_one(); }
 
    void deallocate_one(node_type_ptr_t p)
    { return this->deallocate_one(p, alloc_version()); }
 
- void deallocate_one(node_type_ptr_t p, allocator_v1)
- { get_al().deallocate(p, 1); }
+ template<class AllocatorVersion>
+ void deallocate_one(node_type_ptr_t p, AllocatorVersion,
+ typename boost::container::container_detail::enable_if_c
+ <boost::container::container_detail::is_same<AllocatorVersion, allocator_v1>
+ ::value>::type * = 0)
+ { node_alloc().deallocate(p, 1); }
 
- void deallocate_one(node_type_ptr_t p, allocator_v2)
- { get_al().deallocate_one(p); }
+ template<class AllocatorVersion>
+ void deallocate_one(node_type_ptr_t p, AllocatorVersion,
+ typename boost::container::container_detail::enable_if_c
+ <boost::container::container_detail::is_same<AllocatorVersion, allocator_v2>
+ ::value>::type * = 0)
+ { node_alloc().deallocate_one(p); }
 
    friend class stable_vector_detail::clear_on_destroy<stable_vector>;
    ///@endcond
@@ -450,10 +473,10 @@
 
    // types:
 
- typedef typename A::reference reference;
- typedef typename A::const_reference const_reference;
- typedef typename A::pointer pointer;
- typedef typename A::const_pointer const_pointer;
+ typedef typename allocator_traits_type::reference reference;
+ typedef typename allocator_traits_type::const_reference const_reference;
+ typedef typename allocator_traits_type::pointer pointer;
+ typedef typename allocator_traits_type::const_pointer const_pointer;
    typedef stable_vector_detail::iterator
       <T,T&, pointer> iterator;
    typedef stable_vector_detail::iterator
@@ -461,9 +484,10 @@
    typedef typename impl_type::size_type size_type;
    typedef typename iterator::difference_type difference_type;
    typedef T value_type;
- typedef A allocator_type;
+ typedef A allocator_type;
    typedef std::reverse_iterator<iterator> reverse_iterator;
    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef node_allocator_type stored_allocator_type;
 
    ///@cond
    private:
@@ -483,13 +507,24 @@
    ///@endcond
    public:
 
+ //! <b>Effects</b>: Default constructs a stable_vector.
+ //!
+ //! <b>Throws</b>: If allocator_type's default constructor throws.
+ //!
+ //! <b>Complexity</b>: Constant.
+ stable_vector()
+ : internal_data(), impl()
+ {
+ STABLE_VECTOR_CHECK_INVARIANT;
+ }
+
    //! <b>Effects</b>: Constructs a stable_vector taking the allocator as parameter.
    //!
    //! <b>Throws</b>: If allocator_type's copy constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- explicit stable_vector(const A& al=A())
- : internal_data(al),impl(al)
+ explicit stable_vector(const A& al)
+ : internal_data(al),impl(al)
    {
       STABLE_VECTOR_CHECK_INVARIANT;
    }
@@ -502,7 +537,7 @@
    //!
    //! <b>Complexity</b>: Linear to n.
    explicit stable_vector(size_type n)
- : internal_data(A()),impl(A())
+ : internal_data(A()),impl(A())
    {
       stable_vector_detail::clear_on_destroy<stable_vector> cod(*this);
       this->resize(n);
@@ -518,7 +553,7 @@
    //!
    //! <b>Complexity</b>: Linear to n.
    stable_vector(size_type n, const T& t, const A& al=A())
- : internal_data(al),impl(al)
+ : internal_data(al),impl(al)
    {
       stable_vector_detail::clear_on_destroy<stable_vector> cod(*this);
       this->insert(this->cbegin(), n, t);
@@ -549,7 +584,10 @@
    //!
    //! <b>Complexity</b>: Linear to the elements x contains.
    stable_vector(const stable_vector& x)
- : internal_data(x.get_al()),impl(x.get_al())
+ : internal_data(allocator_traits<node_allocator_type>::
+ select_on_container_copy_construction(x.node_alloc()))
+ , impl(allocator_traits<allocator_type>::
+ select_on_container_copy_construction(x.impl.get_stored_allocator()))
    {
       stable_vector_detail::clear_on_destroy<stable_vector> cod(*this);
       this->insert(this->cbegin(), x.begin(), x.end());
@@ -562,9 +600,11 @@
    //! <b>Throws</b>: If allocator_type's copy constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- stable_vector(BOOST_RV_REF(stable_vector) x)
- : internal_data(x.get_al()),impl(x.get_al())
- { this->swap(x); }
+ stable_vector(BOOST_RV_REF(stable_vector) x)
+ : internal_data(boost::move(x.node_alloc())), impl(boost::move(x.impl))
+ {
+ this->priv_swap_members(x);
+ }
 
    //! <b>Effects</b>: Destroys the stable_vector. All stored values are destroyed
    //! and used memory is deallocated.
@@ -589,7 +629,17 @@
    stable_vector& operator=(BOOST_COPY_ASSIGN_REF(stable_vector) x)
    {
       STABLE_VECTOR_CHECK_INVARIANT;
- if (this != &x) {
+ if (&x != this){
+ node_allocator_type &this_alloc = this->node_alloc();
+ const node_allocator_type &x_alloc = x.node_alloc();
+ container_detail::bool_<allocator_traits_type::
+ propagate_on_container_copy_assignment::value> flag;
+ if(flag && this_alloc != x_alloc){
+ this->clear();
+ this->shrink_to_fit();
+ }
+ container_detail::assign_alloc(this->node_alloc(), x.node_alloc(), flag);
+ container_detail::assign_alloc(this->impl.get_stored_allocator(), x.impl.get_stored_allocator(), flag);
          this->assign(x.begin(), x.end());
       }
       return *this;
@@ -606,8 +656,25 @@
    stable_vector& operator=(BOOST_RV_REF(stable_vector) x)
    {
       if (&x != this){
- this->swap(x);
- x.clear();
+ node_allocator_type &this_alloc = this->node_alloc();
+ node_allocator_type &x_alloc = x.node_alloc();
+ //If allocators are equal we can just swap pointers
+ if(this_alloc == x_alloc){
+ //Destroy objects but retain memory
+ this->clear();
+ this->impl = boost::move(x.impl);
+ this->priv_swap_members(x);
+ //Move allocator if needed
+ container_detail::bool_<allocator_traits_type::
+ propagate_on_container_move_assignment::value> flag;
+ container_detail::move_alloc(this->node_alloc(), x.node_alloc(), flag);
+ }
+ //If unequal allocators, then do a one by one move
+ else{
+ typedef typename std::iterator_traits<iterator>::iterator_category ItCat;
+ this->assign( boost::make_move_iterator(x.begin())
+ , boost::make_move_iterator(x.end()));
+ }
       }
       return *this;
    }
@@ -641,7 +708,27 @@
    //! <b>Throws</b>: If allocator's copy constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- allocator_type get_allocator()const {return get_al();}
+ allocator_type get_allocator()const {return node_alloc();}
+
+ //! <b>Effects</b>: Returns a reference to the internal allocator.
+ //!
+ //! <b>Throws</b>: Nothing
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
+ //! <b>Note</b>: Non-standard extension.
+ const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+ { return node_alloc(); }
+
+ //! <b>Effects</b>: Returns a reference to the internal allocator.
+ //!
+ //! <b>Throws</b>: Nothing
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
+ //! <b>Note</b>: Non-standard extension.
+ stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
+ { return node_alloc(); }
 
 
    //! <b>Effects</b>: Returns an iterator to the first element contained in the stable_vector.
@@ -946,7 +1033,8 @@
    void push_back(T &x) { push_back(const_cast<const T &>(x)); }
 
    template<class U>
- void push_back(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
+ void push_back(const U &u, typename container_detail::enable_if_c
+ <container_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
    { return priv_push_back(u); }
    #endif
 
@@ -982,7 +1070,8 @@
    iterator insert(const_iterator position, T &x) { return this->insert(position, const_cast<const T &>(x)); }
 
    template<class U>
- iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
+ iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c
+ <container_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
    { return this->priv_insert(position, u); }
    #endif
 
@@ -1035,7 +1124,7 @@
                         boost::mpl::not_<boost::is_integral<InputIterator> >());
    }
 
- #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... in the end of the stable_vector.
@@ -1046,7 +1135,7 @@
    template<class ...Args>
    void emplace_back(Args &&...args)
    {
- typedef emplace_functor<node_type_t, Args...> EmplaceFunctor;
+ typedef emplace_functor<Args...> EmplaceFunctor;
       typedef emplace_iterator<node_type_t, EmplaceFunctor, difference_type> EmplaceIterator;
       EmplaceFunctor &&ef = EmplaceFunctor(boost::forward<Args>(args)...);
       this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator());
@@ -1066,7 +1155,7 @@
    {
       //Just call more general insert(pos, size, value) and return iterator
       size_type pos_n = position - cbegin();
- typedef emplace_functor<node_type_t, Args...> EmplaceFunctor;
+ typedef emplace_functor<Args...> EmplaceFunctor;
       typedef emplace_iterator<node_type_t, EmplaceFunctor, difference_type> EmplaceIterator;
       EmplaceFunctor &&ef = EmplaceFunctor(boost::forward<Args>(args)...);
       this->insert(position, EmplaceIterator(ef), EmplaceIterator());
@@ -1075,51 +1164,40 @@
 
    #else
 
- void emplace_back()
- {
- typedef emplace_functor<node_type_t> EmplaceFunctor;
- typedef emplace_iterator<node_type_t, EmplaceFunctor, difference_type> EmplaceIterator;
- EmplaceFunctor ef;
- this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator());
- }
-
- iterator emplace(const_iterator position)
- {
- typedef emplace_functor<node_type_t> EmplaceFunctor;
- typedef emplace_iterator<node_type_t, EmplaceFunctor, difference_type> EmplaceIterator;
- EmplaceFunctor ef;
- size_type pos_n = position - this->cbegin();
- this->insert(position, EmplaceIterator(ef), EmplaceIterator());
- return iterator(this->begin() + pos_n);
- }
-
    #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
       typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg) \
- <node_type_t, BOOST_PP_ENUM_PARAMS(n, P)> EmplaceFunctor; \
+ BOOST_PP_EXPR_IF(n, <) BOOST_PP_ENUM_PARAMS(n, P) BOOST_PP_EXPR_IF(n, >) \
+ EmplaceFunctor; \
       typedef emplace_iterator<node_type_t, EmplaceFunctor, difference_type> EmplaceIterator; \
- EmplaceFunctor ef(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
- this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator()); \
+ EmplaceFunctor ef BOOST_PP_LPAREN_IF(n) \
+ BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) \
+ BOOST_PP_RPAREN_IF(n); \
+ this->insert(this->cend() , EmplaceIterator(ef), EmplaceIterator()); \
    } \
                                                                                                 \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace(const_iterator pos, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace(const_iterator pos \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
       typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg) \
- <node_type_t, BOOST_PP_ENUM_PARAMS(n, P)> EmplaceFunctor; \
+ BOOST_PP_EXPR_IF(n, <) BOOST_PP_ENUM_PARAMS(n, P) BOOST_PP_EXPR_IF(n, >) \
+ EmplaceFunctor; \
       typedef emplace_iterator<node_type_t, EmplaceFunctor, difference_type> EmplaceIterator; \
- EmplaceFunctor ef(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ EmplaceFunctor ef BOOST_PP_LPAREN_IF(n) \
+ BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) \
+ BOOST_PP_RPAREN_IF(n); \
       size_type pos_n = pos - this->cbegin(); \
       this->insert(pos, EmplaceIterator(ef), EmplaceIterator()); \
       return iterator(this->begin() + pos_n); \
    } \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
    //! <b>Effects</b>: Erases the element at position pos.
    //!
@@ -1157,7 +1235,11 @@
    void swap(stable_vector & x)
    {
       STABLE_VECTOR_CHECK_INVARIANT;
- this->swap_impl(*this,x);
+ container_detail::bool_<allocator_traits_type::propagate_on_container_swap::value> flag;
+ container_detail::swap_alloc(this->node_alloc(), x.node_alloc(), flag);
+ //vector's allocator is swapped here
+ this->impl.swap(x.impl);
+ this->priv_swap_members(x);
    }
 
    //! <b>Effects</b>: Erases all the elements of the stable_vector.
@@ -1181,7 +1263,8 @@
          this->clear_pool();
          //If empty completely destroy the index, let's recover default-constructed state
          if(this->empty()){
- impl_type().swap(this->impl);
+ this->impl.clear();
+ this->impl.shrink_to_fit();
             this->internal_data.set_end_pointer_to_default_constructed();
          }
          //Otherwise, try to shrink-to-fit the index and readjust pointers if necessary
@@ -1209,7 +1292,11 @@
    void priv_push_back(const value_type &t)
    { this->insert(end(), t); }
 
- void clear_pool(allocator_v1)
+ template<class AllocatorVersion>
+ void clear_pool(AllocatorVersion,
+ typename boost::container::container_detail::enable_if_c
+ <boost::container::container_detail::is_same<AllocatorVersion, allocator_v1>
+ ::value>::type * = 0)
    {
       if(!impl.empty() && impl.back()){
          void_ptr &pool_first_ref = impl.end()[-2];
@@ -1227,15 +1314,18 @@
       }
    }
 
- void clear_pool(allocator_v2)
+ template<class AllocatorVersion>
+ void clear_pool(AllocatorVersion,
+ typename boost::container::container_detail::enable_if_c
+ <boost::container::container_detail::is_same<AllocatorVersion, allocator_v2>
+ ::value>::type * = 0)
    {
-
       if(!impl.empty() && impl.back()){
          void_ptr &pool_first_ref = impl.end()[-2];
          void_ptr &pool_last_ref = impl.back();
          multiallocation_chain holder;
          holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
- get_al().deallocate_individual(boost::move(holder));
+ node_alloc().deallocate_individual(boost::move(holder));
          pool_first_ref = pool_last_ref = 0;
          this->internal_data.pool_size = 0;
       }
@@ -1251,7 +1341,11 @@
       this->add_to_pool(n, alloc_version());
    }
 
- void add_to_pool(size_type n, allocator_v1)
+ template<class AllocatorVersion>
+ void add_to_pool(size_type n, AllocatorVersion,
+ typename boost::container::container_detail::enable_if_c
+ <boost::container::container_detail::is_same<AllocatorVersion, allocator_v1>
+ ::value>::type * = 0)
    {
       size_type remaining = n;
       while(remaining--){
@@ -1259,14 +1353,18 @@
       }
    }
 
- void add_to_pool(size_type n, allocator_v2)
+ template<class AllocatorVersion>
+ void add_to_pool(size_type n, AllocatorVersion,
+ typename boost::container::container_detail::enable_if_c
+ <boost::container::container_detail::is_same<AllocatorVersion, allocator_v2>
+ ::value>::type * = 0)
    {
       void_ptr &pool_first_ref = impl.end()[-2];
       void_ptr &pool_last_ref = impl.back();
       multiallocation_chain holder;
       holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
       //BOOST_STATIC_ASSERT((::boost::has_move_emulation_enabled<multiallocation_chain>::value == true));
- multiallocation_chain m (get_al().allocate_individual(n));
+ multiallocation_chain m (node_alloc().allocate_individual(n));
       holder.splice_after(holder.before_begin(), m, m.before_begin(), m.last(), n);
       this->internal_data.pool_size += n;
       std::pair<void_ptr, void_ptr> data(holder.extract_data());
@@ -1375,8 +1473,8 @@
 
    template<class AllocatorVersion>
    iterator priv_erase(const_iterator first, const_iterator last, AllocatorVersion,
- typename boost::container::containers_detail::enable_if_c
- <boost::container::containers_detail::is_same<AllocatorVersion, allocator_v2>
+ typename boost::container::container_detail::enable_if_c
+ <boost::container::container_detail::is_same<AllocatorVersion, allocator_v2>
             ::value>::type * = 0)
    {
       STABLE_VECTOR_CHECK_INVARIANT;
@@ -1385,14 +1483,12 @@
 
    static node_type_ptr_t node_ptr_cast(const void_ptr &p)
    {
- using boost::get_pointer;
- return node_type_ptr_t(static_cast<node_type_t*>(stable_vector_detail::get_pointer(p)));
+ return node_type_ptr_t(static_cast<node_type_t*>(stable_vector_detail::to_raw_pointer(p)));
    }
 
    static node_type_base_ptr_t node_base_ptr_cast(const void_ptr &p)
    {
- using boost::get_pointer;
- return node_type_base_ptr_t(static_cast<node_type_base_t*>(stable_vector_detail::get_pointer(p)));
+ return node_type_base_ptr_t(static_cast<node_type_base_t*>(stable_vector_detail::to_raw_pointer(p)));
    }
 
    static value_type& value(const void_ptr &p)
@@ -1434,7 +1530,7 @@
    {
       node_type_ptr_t p = this->allocate_one();
       try{
- boost::container::construct_in_place(&*p, it);
+ boost::container::construct_in_place(this->node_alloc(), &*p, it);
          p->set_pointer(up);
       }
       catch(...){
@@ -1516,7 +1612,7 @@
    template <class FwdIterator>
    void insert_iter_fwd_alloc(const impl_iterator it, FwdIterator first, FwdIterator last, difference_type n, allocator_v2)
    {
- multiallocation_chain mem(get_al().allocate_individual(n));
+ multiallocation_chain mem(node_alloc().allocate_individual(n));
 
       size_type i = 0;
       node_type_ptr_t p = 0;
@@ -1525,7 +1621,7 @@
             p = mem.front();
             mem.pop_front();
             //This can throw
- boost::container::construct_in_place(&*p, first);
+ boost::container::construct_in_place(this->node_alloc(), &*p, first);
             p->set_pointer(void_ptr_ptr(&it[i]));
             ++first;
             it[i] = p;
@@ -1533,8 +1629,8 @@
          }
       }
       catch(...){
- get_al().deallocate_one(p);
- get_al().deallocate_many(boost::move(mem));
+ node_alloc().deallocate_one(p);
+ node_alloc().deallocate_many(boost::move(mem));
          impl_iterator e = impl.erase(it+i, it+n);
          this->align_nodes(e, get_last_align());
          throw;
@@ -1548,13 +1644,13 @@
       node_type_ptr_t p = 0;
       try{
          while(first != last){
- p = get_from_pool();
+ p = this->get_from_pool();
             if(!p){
                insert_iter_fwd_alloc(it+i, first, last, n-i, alloc_version());
                break;
             }
             //This can throw
- boost::container::construct_in_place(&*p, first);
+ boost::container::construct_in_place(this->node_alloc(), &*p, first);
             p->set_pointer(void_ptr_ptr(&it[i]));
             ++first;
             it[i]=p;
@@ -1575,16 +1671,6 @@
       this->insert_not_iter(position, first, last);
    }
 
- static void swap_impl(stable_vector& x,stable_vector& y)
- {
- using std::swap;
- swap(x.get_al(),y.get_al());
- swap(x.impl,y.impl);
- swap(x.internal_data.pool_size, y.internal_data.pool_size);
- x.readjust_end_node();
- y.readjust_end_node();
- }
-
    #if defined(STABLE_VECTOR_ENABLE_INVARIANT_CHECKING)
    bool invariant()const
    {
@@ -1609,9 +1695,12 @@
       return n >= num_pool;
    }
 
- class invariant_checker:private boost::noncopyable
+ class invariant_checker
    {
+ invariant_checker(const invariant_checker &);
+ invariant_checker & operator=(const invariant_checker &);
       const stable_vector* p;
+
       public:
       invariant_checker(const stable_vector& v):p(&v){}
       ~invariant_checker(){BOOST_ASSERT(p->invariant());}
@@ -1619,11 +1708,32 @@
    };
    #endif
 
- struct ebo_holder
- : node_allocator_type
+ class ebo_holder
+ : public node_allocator_type
    {
- ebo_holder(const allocator_type &a)
- : node_allocator_type(a), pool_size(0), end_node()
+ private:
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(ebo_holder)
+ public:
+/*
+ explicit ebo_holder(BOOST_RV_REF(ebo_holder) x)
+ : node_allocator_type(boost::move(static_cast<node_allocator_type&>(x)))
+ , pool_size(0)
+ , end_node()
+ {}
+*/
+ template<class AllocatorRLValue>
+ explicit ebo_holder(BOOST_FWD_REF(AllocatorRLValue) a)
+ : node_allocator_type(boost::forward<AllocatorRLValue>(a))
+ , pool_size(0)
+ , end_node()
+ {
+ this->set_end_pointer_to_default_constructed();
+ }
+
+ ebo_holder()
+ : node_allocator_type()
+ , pool_size(0)
+ , end_node()
       {
          this->set_end_pointer_to_default_constructed();
       }
@@ -1637,8 +1747,15 @@
       node_type_base_t end_node;
    } internal_data;
 
- node_allocator_type &get_al() { return internal_data; }
- const node_allocator_type &get_al() const { return internal_data; }
+ void priv_swap_members(stable_vector &x)
+ {
+ container_detail::do_swap(this->internal_data.pool_size, x.internal_data.pool_size);
+ this->readjust_end_node();
+ x.readjust_end_node();
+ }
+
+ node_allocator_type &node_alloc() { return internal_data; }
+ const node_allocator_type &node_alloc() const { return internal_data; }
 
    impl_type impl;
    /// @endcond

Modified: trunk/boost/container/string.hpp
==============================================================================
--- trunk/boost/container/string.hpp (original)
+++ trunk/boost/container/string.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -30,8 +30,8 @@
 // representations about the suitability of this software for any
 // purpose. It is provided "as is" without express or implied warranty.
 
-#ifndef BOOST_CONTAINERS_STRING_HPP
-#define BOOST_CONTAINERS_STRING_HPP
+#ifndef BOOST_CONTAINER_STRING_HPP
+#define BOOST_CONTAINER_STRING_HPP
 
 #include <boost/container/detail/config_begin.hpp>
 #include <boost/container/detail/workaround.hpp>
@@ -43,6 +43,7 @@
 #include <boost/container/detail/algorithms.hpp>
 #include <boost/container/detail/version_type.hpp>
 #include <boost/container/detail/allocation_type.hpp>
+#include <boost/container/allocator/allocator_traits.hpp>
 #include <boost/container/detail/mpl.hpp>
 #include <boost/move/move.hpp>
 #include <boost/static_assert.hpp>
@@ -75,7 +76,7 @@
 #endif
 
 /// @cond
-namespace containers_detail {
+namespace container_detail {
 // ------------------------------------------------------------
 // Class basic_string_base.
 
@@ -89,16 +90,20 @@
 template <class A>
 class basic_string_base
 {
- basic_string_base();
    BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_string_base)
 
+ typedef allocator_traits<A> allocator_traits_type;
  public:
    typedef A allocator_type;
    //! The stored allocator type
    typedef allocator_type stored_allocator_type;
- typedef typename A::pointer pointer;
- typedef typename A::value_type value_type;
- typedef typename A::size_type size_type;
+ typedef typename allocator_traits_type::pointer pointer;
+ typedef typename allocator_traits_type::value_type value_type;
+ typedef typename allocator_traits_type::size_type size_type;
+
+ basic_string_base()
+ : members_()
+ { init(); }
 
    basic_string_base(const allocator_type& a)
       : members_(a)
@@ -112,16 +117,16 @@
    }
 
    basic_string_base(BOOST_RV_REF(basic_string_base) b)
- : members_(b.members_)
+ : members_(boost::move(b.alloc()))
    {
- init();
- this->swap(b);
+ this->init();
+ this->swap_data(b);
    }
 
    ~basic_string_base()
    {
- this->deallocate_block();
       if(!this->is_short()){
+ this->deallocate_block();
          static_cast<long_t*>(static_cast<void*>(&this->members_.m_repr.r))->~long_t();
       }
    }
@@ -169,14 +174,14 @@
    //so, unlike long_t, it can be placed in a union
    
    typedef typename boost::aligned_storage< sizeof(long_t),
- containers_detail::alignment_of<long_t>::value>::type long_raw_t;
+ container_detail::alignment_of<long_t>::value>::type long_raw_t;
 
    protected:
    static const size_type MinInternalBufferChars = 8;
    static const size_type AlignmentOfValueType =
       alignment_of<value_type>::value;
    static const size_type ShortDataOffset =
- containers_detail::ct_rounded_size<sizeof(short_header), AlignmentOfValueType>::value;
+ container_detail::ct_rounded_size<sizeof(short_header), AlignmentOfValueType>::value;
    static const size_type ZeroCostInternalBufferChars =
       (sizeof(long_t) - ShortDataOffset)/sizeof(value_type);
    static const size_type UnalignedFinalInternalBufferChars =
@@ -204,8 +209,13 @@
    struct members_holder
       : public A
    {
- members_holder(const A &a)
- : A(a)
+ members_holder()
+ : A()
+ {}
+
+ template<class AllocatorConvertible>
+ explicit members_holder(BOOST_FWD_REF(AllocatorConvertible) a)
+ : A(boost::forward<AllocatorConvertible>(a))
       {}
 
       repr_t m_repr;
@@ -247,10 +257,10 @@
 
    protected:
 
- typedef containers_detail::integral_constant<unsigned, 1> allocator_v1;
- typedef containers_detail::integral_constant<unsigned, 2> allocator_v2;
- typedef containers_detail::integral_constant<unsigned,
- boost::container::containers_detail::version<A>::value> alloc_version;
+ typedef container_detail::integral_constant<unsigned, 1> allocator_v1;
+ typedef container_detail::integral_constant<unsigned, 2> allocator_v2;
+ typedef container_detail::integral_constant<unsigned,
+ boost::container::container_detail::version<A>::value> alloc_version;
 
    std::pair<pointer, bool>
       allocation_command(allocation_type command,
@@ -295,7 +305,7 @@
    }
 
    size_type next_capacity(size_type additional_objects) const
- { return get_next_capacity(this->alloc().max_size(), this->priv_storage(), additional_objects); }
+ { return get_next_capacity(allocator_traits_type::max_size(this->alloc()), this->priv_storage(), additional_objects); }
 
    void deallocate(pointer p, size_type n)
    {
@@ -304,16 +314,16 @@
    }
 
    void construct(pointer p, const value_type &value = value_type())
- { new((void*)containers_detail::get_pointer(p)) value_type(value); }
+ { new((void*)container_detail::to_raw_pointer(p)) value_type(value); }
 
    void destroy(pointer p, size_type n)
    {
       for(; n--; ++p)
- containers_detail::get_pointer(p)->~value_type();
+ container_detail::to_raw_pointer(p)->~value_type();
    }
 
    void destroy(pointer p)
- { containers_detail::get_pointer(p)->~value_type(); }
+ { container_detail::to_raw_pointer(p)->~value_type(); }
 
    void allocate_initial_block(size_type n)
    {
@@ -335,7 +345,7 @@
    { this->deallocate(this->priv_addr(), this->priv_storage()); }
       
    size_type max_size() const
- { return this->alloc().max_size() - 1; }
+ { return allocator_traits_type::max_size(this->alloc()) - 1; }
 
    // Helper functions for exception handling.
    void throw_length_error() const
@@ -404,14 +414,14 @@
 
    void priv_long_size(size_type sz)
    {
- this->members_.m_repr.long_repr().length = static_cast<typename A::size_type>(sz);
+ this->members_.m_repr.long_repr().length = static_cast<typename allocator_traits_type::size_type>(sz);
    }
 
- void swap(basic_string_base& other)
+ void swap_data(basic_string_base& other)
    {
       if(this->is_short()){
          if(other.is_short()){
- std::swap(this->members_.m_repr, other.members_.m_repr);
+ container_detail::do_swap(this->members_.m_repr, other.members_.m_repr);
          }
          else{
             repr_t copied(this->members_.m_repr);
@@ -426,18 +436,13 @@
             this->members_.m_repr = copied;
          }
          else{
- std::swap(this->members_.m_repr.long_repr(), other.members_.m_repr.long_repr());
+ container_detail::do_swap(this->members_.m_repr.long_repr(), other.members_.m_repr.long_repr());
          }
       }
-
- allocator_type & this_al = this->alloc(), &other_al = other.alloc();
- if(this_al != other_al){
- containers_detail::do_swap(this_al, other_al);
- }
    }
 };
 
-} //namespace containers_detail {
+} //namespace container_detail {
 
 /// @endcond
 
@@ -475,12 +480,13 @@
 template <class CharT, class Traits, class A>
 #endif
 class basic_string
- : private containers_detail::basic_string_base<A>
+ : private container_detail::basic_string_base<A>
 {
    /// @cond
    private:
+ typedef allocator_traits<A> allocator_traits_type;
    BOOST_COPYABLE_AND_MOVABLE(basic_string)
- typedef containers_detail::basic_string_base<A> base_t;
+ typedef container_detail::basic_string_base<A> base_t;
    static const typename base_t::size_type InternalBufferChars = base_t::InternalBufferChars;
 
    protected:
@@ -527,17 +533,17 @@
    //! The second template parameter Traits
    typedef Traits traits_type;
    //! Pointer to CharT
- typedef typename A::pointer pointer;
+ typedef typename allocator_traits_type::pointer pointer;
    //! Const pointer to CharT
- typedef typename A::const_pointer const_pointer;
+ typedef typename allocator_traits_type::const_pointer const_pointer;
    //! Reference to CharT
- typedef typename A::reference reference;
+ typedef typename allocator_traits_type::reference reference;
    //! Const reference to CharT
- typedef typename A::const_reference const_reference;
+ typedef typename allocator_traits_type::const_reference const_reference;
    //! An unsigned integral type
- typedef typename A::size_type size_type;
+ typedef typename allocator_traits_type::size_type size_type;
    //! A signed integral type
- typedef typename A::difference_type difference_type;
+ typedef typename allocator_traits_type::difference_type difference_type;
    //! Iterator used to iterate through a string. It's a Random Access Iterator
    typedef pointer iterator;
    //! Const iterator used to iterate through a string. It's a Random Access Iterator
@@ -562,17 +568,28 @@
    struct reserve_t {};
 
    basic_string(reserve_t, size_type n,
- const allocator_type& a = allocator_type())
- : base_t(a, n + 1)
+ const allocator_type& a = allocator_type())
+ //Select allocator as in copy constructor as reserve_t-based constructors
+ //are two step copies optimized for capacity
+ : base_t( allocator_traits_type::select_on_container_copy_construction(a)
+ , n + 1)
    { this->priv_terminate_string(); }
 
    /// @endcond
 
+ //! <b>Effects</b>: Default constructs a basic_string.
+ //!
+ //! <b>Throws</b>: If allocator_type's default constructor throws.
+ basic_string()
+ : base_t()
+ { this->priv_terminate_string(); }
+
+
    //! <b>Effects</b>: Constructs a basic_string taking the allocator as parameter.
    //!
    //! <b>Throws</b>: If allocator_type's copy constructor throws.
- explicit basic_string(const allocator_type& a = allocator_type())
- : base_t(a, InternalBufferChars)
+ explicit basic_string(const allocator_type& a)
+ : base_t(a)
    { this->priv_terminate_string(); }
 
    //! <b>Effects</b>: Copy constructs a basic_string.
@@ -581,7 +598,7 @@
    //!
    //! <b>Throws</b>: If allocator_type's default constructor or copy constructor throws.
    basic_string(const basic_string& s)
- : base_t(s.alloc())
+ : base_t(allocator_traits_type::select_on_container_copy_construction(s.alloc()))
    { this->priv_range_initialize(s.begin(), s.end()); }
 
    //! <b>Effects</b>: Move constructor. Moves mx's resources to *this.
@@ -603,7 +620,7 @@
          this->throw_out_of_range();
       else
          this->priv_range_initialize
- (s.begin() + pos, s.begin() + pos + containers_detail::min_value(n, s.size() - pos));
+ (s.begin() + pos, s.begin() + pos + container_detail::min_value(n, s.size() - pos));
    }
 
    //! <b>Effects</b>: Constructs a basic_string taking the allocator as parameter,
@@ -638,8 +655,8 @@
       : base_t(a)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InputIterator, size_type>::value;
- typedef containers_detail::bool_<aux_boolean> Result;
+ const bool aux_boolean = container_detail::is_convertible<InputIterator, size_type>::value;
+ typedef container_detail::bool_<aux_boolean> Result;
       this->priv_initialize_dispatch(f, l, Result());
    }
 
@@ -656,10 +673,24 @@
    //! <b>Postcondition</b>: x == *this.
    //!
    //! <b>Complexity</b>: Linear to the elements x contains.
- basic_string& operator=(BOOST_COPY_ASSIGN_REF(basic_string) s)
+ basic_string& operator=(BOOST_COPY_ASSIGN_REF(basic_string) x)
    {
- if (&s != this)
- this->assign(s.begin(), s.end());
+ if (&x != this){
+ allocator_type &this_alloc = this->alloc();
+ const allocator_type &x_alloc = x.alloc();
+ container_detail::bool_<allocator_traits_type::
+ propagate_on_container_copy_assignment::value> flag;
+ if(flag && this_alloc != x_alloc){
+ if(!this->is_short()){
+ this->deallocate_block();
+ this->is_short(true);
+ Traits::assign(*this->priv_addr(), this->priv_null());
+ this->priv_size(0);
+ }
+ }
+ container_detail::assign_alloc(this->alloc(), x.alloc(), flag);
+ this->assign(x.begin(), x.end());
+ }
       return *this;
    }
 
@@ -668,11 +699,25 @@
    //! <b>Throws</b>: If allocator_type's copy constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- basic_string& operator=(BOOST_RV_REF(basic_string) ms)
+ basic_string& operator=(BOOST_RV_REF(basic_string) x)
    {
- basic_string &s = ms;
- if (&s != this){
- this->swap(s);
+ if (&x != this){
+ allocator_type &this_alloc = this->alloc();
+ allocator_type &x_alloc = x.alloc();
+ //If allocators are equal we can just swap pointers
+ if(this_alloc == x_alloc){
+ //Destroy objects but retain memory in case x reuses it in the future
+ this->clear();
+ this->swap_data(x);
+ //Move allocator if needed
+ container_detail::bool_<allocator_traits_type::
+ propagate_on_container_move_assignment::value> flag;
+ container_detail::move_alloc(this_alloc, x_alloc, flag);
+ }
+ //If unequal allocators, then do a one by one move
+ else{
+ this->assign( x.begin(), x.end());
+ }
       }
       return *this;
    }
@@ -709,7 +754,6 @@
    const_iterator cbegin() const
    { return this->priv_addr(); }
 
-
    //! <b>Effects</b>: Returns an iterator to the end of the vector.
    //!
    //! <b>Throws</b>: Nothing.
@@ -796,6 +840,26 @@
    allocator_type get_allocator() const
    { return this->alloc(); }
 
+ //! <b>Effects</b>: Returns a reference to the internal allocator.
+ //!
+ //! <b>Throws</b>: Nothing
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
+ //! <b>Note</b>: Non-standard extension.
+ const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+ { return this->alloc(); }
+
+ //! <b>Effects</b>: Returns a reference to the internal allocator.
+ //!
+ //! <b>Throws</b>: Nothing
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
+ //! <b>Note</b>: Non-standard extension.
+ stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
+ { return this->alloc(); }
+
    //! <b>Effects</b>: Returns the number of the elements contained in the vector.
    //!
    //! <b>Throws</b>: Nothing.
@@ -855,7 +919,7 @@
          this->throw_length_error();
 
       if (this->capacity() < res_arg){
- size_type n = containers_detail::max_value(res_arg, this->size()) + 1;
+ size_type n = container_detail::max_value(res_arg, this->size()) + 1;
          size_type new_cap = this->next_capacity(n);
          pointer new_start = this->allocation_command
             (allocate_new, n, new_cap, new_cap).first;
@@ -912,8 +976,8 @@
             size_type long_storage = this->priv_long_storage();
             size_type long_size = this->priv_long_size();
             //Shrink from allocated buffer to the internal one, including trailing null
- Traits::copy( containers_detail::get_pointer(this->priv_short_addr())
- , containers_detail::get_pointer(long_addr)
+ Traits::copy( container_detail::to_raw_pointer(this->priv_short_addr())
+ , container_detail::to_raw_pointer(long_addr)
                         , long_size+1);
             this->is_short(true);
             this->alloc().deallocate(long_addr, long_storage);
@@ -1020,7 +1084,7 @@
       if (pos > s.size())
       this->throw_out_of_range();
       return this->append(s.begin() + pos,
- s.begin() + pos + containers_detail::min_value(n, s.size() - pos));
+ s.begin() + pos + container_detail::min_value(n, s.size() - pos));
    }
 
    //! <b>Requires</b>: s points to an array of at least n elements of CharT.
@@ -1087,7 +1151,7 @@
    //!
    //! <b>Returns</b>: *this
    basic_string& assign(BOOST_RV_REF(basic_string) ms)
- { return this->swap(ms), *this; }
+ { return this->swap_data(ms), *this; }
 
    //! <b>Requires</b>: pos <= str.size()
    //!
@@ -1102,7 +1166,7 @@
       if (pos > s.size())
       this->throw_out_of_range();
       return this->assign(s.begin() + pos,
- s.begin() + pos + containers_detail::min_value(n, s.size() - pos));
+ s.begin() + pos + container_detail::min_value(n, s.size() - pos));
    }
 
    //! <b>Requires</b>: s points to an array of at least n elements of CharT.
@@ -1137,8 +1201,8 @@
    basic_string& assign(InputIter first, InputIter last)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InputIter, size_type>::value;
- typedef containers_detail::bool_<aux_boolean> Result;
+ const bool aux_boolean = container_detail::is_convertible<InputIter, size_type>::value;
+ typedef container_detail::bool_<aux_boolean> Result;
       return this->priv_assign_dispatch(first, last, Result());
    }
 
@@ -1172,10 +1236,10 @@
    {
       if (pos1 > this->size() || pos2 > s.size())
          this->throw_out_of_range();
- size_type len = containers_detail::min_value(n, s.size() - pos2);
+ size_type len = container_detail::min_value(n, s.size() - pos2);
       if (this->size() > this->max_size() - len)
          this->throw_length_error();
- const CharT *beg_ptr = containers_detail::get_pointer(s.begin()) + pos2;
+ const CharT *beg_ptr = container_detail::to_raw_pointer(s.begin()) + pos2;
       const CharT *end_ptr = beg_ptr + len;
       this->insert(this->priv_addr() + pos1, beg_ptr, end_ptr);
       return *this;
@@ -1271,8 +1335,8 @@
    void insert(const_iterator p, InputIter first, InputIter last)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InputIter, size_type>::value;
- typedef containers_detail::bool_<aux_boolean> Result;
+ const bool aux_boolean = container_detail::is_convertible<InputIter, size_type>::value;
+ typedef container_detail::bool_<aux_boolean> Result;
       this->priv_insert_dispatch(p, first, last, Result());
    }
 
@@ -1291,7 +1355,7 @@
    {
       if (pos > size())
          this->throw_out_of_range();
- erase(this->priv_addr() + pos, this->priv_addr() + pos + containers_detail::min_value(n, size() - pos));
+ erase(this->priv_addr() + pos, this->priv_addr() + pos + container_detail::min_value(n, size() - pos));
       return *this;
    }
 
@@ -1304,9 +1368,9 @@
    iterator erase(const_iterator p)
    {
       // The move includes the terminating null.
- CharT *ptr = const_cast<CharT*>(containers_detail::get_pointer(p));
+ CharT *ptr = const_cast<CharT*>(container_detail::to_raw_pointer(p));
       Traits::move(ptr,
- containers_detail::get_pointer(p + 1),
+ container_detail::to_raw_pointer(p + 1),
                    this->priv_size() - (p - this->priv_addr()));
       this->priv_size(this->priv_size()-1);
       return iterator(ptr);
@@ -1322,11 +1386,11 @@
    //! the other elements being erased. If no such element exists, end() is returned.
    iterator erase(const_iterator first, const_iterator last)
    {
- CharT * f = const_cast<CharT*>(containers_detail::get_pointer(first));
+ CharT * f = const_cast<CharT*>(container_detail::to_raw_pointer(first));
       if (first != last) { // The move includes the terminating null.
          size_type num_erased = last - first;
          Traits::move(f,
- containers_detail::get_pointer(last),
+ container_detail::to_raw_pointer(last),
                       (this->priv_size() + 1)-(last - this->priv_addr()));
          size_type new_length = this->priv_size() - num_erased;
          this->priv_size(new_length);
@@ -1356,7 +1420,7 @@
    {
       if (pos1 > size())
          this->throw_out_of_range();
- const size_type len = containers_detail::min_value(n1, size() - pos1);
+ const size_type len = container_detail::min_value(n1, size() - pos1);
       if (this->size() - len >= this->max_size() - str.size())
          this->throw_length_error();
       return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len,
@@ -1377,8 +1441,8 @@
    {
       if (pos1 > size() || pos2 > str.size())
          this->throw_out_of_range();
- const size_type len1 = containers_detail::min_value(n1, size() - pos1);
- const size_type len2 = containers_detail::min_value(n2, str.size() - pos2);
+ const size_type len1 = container_detail::min_value(n1, size() - pos1);
+ const size_type len2 = container_detail::min_value(n2, str.size() - pos2);
       if (this->size() - len1 >= this->max_size() - len2)
          this->throw_length_error();
       return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len1,
@@ -1404,7 +1468,7 @@
    {
       if (pos1 > size())
          this->throw_out_of_range();
- const size_type len = containers_detail::min_value(n1, size() - pos1);
+ const size_type len = container_detail::min_value(n1, size() - pos1);
       if (n2 > this->max_size() || size() - len >= this->max_size() - n2)
          this->throw_length_error();
       return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len,
@@ -1429,7 +1493,7 @@
    {
       if (pos > size())
          this->throw_out_of_range();
- const size_type len = containers_detail::min_value(n1, size() - pos);
+ const size_type len = container_detail::min_value(n1, size() - pos);
       const size_type n2 = Traits::length(s);
       if (n2 > this->max_size() || size() - len >= this->max_size() - n2)
          this->throw_length_error();
@@ -1449,7 +1513,7 @@
    {
       if (pos1 > size())
          this->throw_out_of_range();
- const size_type len = containers_detail::min_value(n1, size() - pos1);
+ const size_type len = container_detail::min_value(n1, size() - pos1);
       if (n2 > this->max_size() || size() - len >= this->max_size() - n2)
          this->throw_length_error();
       return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len, n2, c);
@@ -1498,11 +1562,11 @@
    {
       const size_type len = static_cast<size_type>(i2 - i1);
       if (len >= n) {
- Traits::assign(const_cast<CharT*>(containers_detail::get_pointer(i1)), n, c);
+ Traits::assign(const_cast<CharT*>(container_detail::to_raw_pointer(i1)), n, c);
          erase(i1 + n, i2);
       }
       else {
- Traits::assign(const_cast<CharT*>(containers_detail::get_pointer(i1)), len, c);
+ Traits::assign(const_cast<CharT*>(container_detail::to_raw_pointer(i1)), len, c);
          insert(i2, n - len, c);
       }
       return *this;
@@ -1519,8 +1583,8 @@
    basic_string& replace(const_iterator i1, const_iterator i2, InputIter j1, InputIter j2)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InputIter, size_type>::value;
- typedef containers_detail::bool_<aux_boolean> Result;
+ const bool aux_boolean = container_detail::is_convertible<InputIter, size_type>::value;
+ typedef container_detail::bool_<aux_boolean> Result;
       return this->priv_replace_dispatch(i1, i2, j1, j2, Result());
    }
 
@@ -1539,8 +1603,8 @@
    {
       if (pos > size())
          this->throw_out_of_range();
- const size_type len = containers_detail::min_value(n, size() - pos);
- Traits::copy(s, containers_detail::get_pointer(this->priv_addr() + pos), len);
+ const size_type len = container_detail::min_value(n, size() - pos);
+ Traits::copy(s, container_detail::to_raw_pointer(this->priv_addr() + pos), len);
       return len;
    }
 
@@ -1549,7 +1613,11 @@
    //!
    //! <b>Throws</b>: Nothing
    void swap(basic_string& x)
- { base_t::swap(x); }
+ {
+ this->base_t::swap_data(x);
+ container_detail::bool_<allocator_traits_type::propagate_on_container_swap::value> flag;
+ container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
+ }
 
    //! <b>Requires</b>: The program shall not alter any of the values stored in the character array.
    //!
@@ -1557,7 +1625,7 @@
    //!
    //! <b>Complexity</b>: constant time.
    const CharT* c_str() const
- { return containers_detail::get_pointer(this->priv_addr()); }
+ { return container_detail::to_raw_pointer(this->priv_addr()); }
 
    //! <b>Requires</b>: The program shall not alter any of the values stored in the character array.
    //!
@@ -1565,7 +1633,7 @@
    //!
    //! <b>Complexity</b>: constant time.
    const CharT* data() const
- { return containers_detail::get_pointer(this->priv_addr()); }
+ { return container_detail::to_raw_pointer(this->priv_addr()); }
 
    //! <b>Effects</b>: Determines the lowest position xpos, if possible, such that both
    //! of the following conditions obtain: 19 pos <= xpos and xpos + str.size() <= size();
@@ -1589,8 +1657,8 @@
       else {
          pointer finish = this->priv_addr() + this->priv_size();
          const const_iterator result =
- std::search(containers_detail::get_pointer(this->priv_addr() + pos),
- containers_detail::get_pointer(finish),
+ std::search(container_detail::to_raw_pointer(this->priv_addr() + pos),
+ container_detail::to_raw_pointer(finish),
                    s, s + n, Eq_traits<Traits>());
          return result != finish ? result - begin() : npos;
       }
@@ -1643,9 +1711,9 @@
       if (n > len)
          return npos;
       else if (n == 0)
- return containers_detail::min_value(len, pos);
+ return container_detail::min_value(len, pos);
       else {
- const const_iterator last = begin() + containers_detail::min_value(len - n, pos) + n;
+ const const_iterator last = begin() + container_detail::min_value(len - n, pos) + n;
          const const_iterator result = find_end(begin(), last,
                                                 s, s + n,
                                                 Eq_traits<Traits>());
@@ -1672,7 +1740,7 @@
       if (len < 1)
          return npos;
       else {
- const const_iterator last = begin() + containers_detail::min_value(len - 1, pos) + 1;
+ const const_iterator last = begin() + container_detail::min_value(len - 1, pos) + 1;
          const_reverse_iterator rresult =
             std::find_if(const_reverse_iterator(last), rend(),
                   std::bind2nd(Eq_traits<Traits>(), c));
@@ -1746,7 +1814,7 @@
       if (len < 1)
          return npos;
       else {
- const const_iterator last = this->priv_addr() + containers_detail::min_value(len - 1, pos) + 1;
+ const const_iterator last = this->priv_addr() + container_detail::min_value(len - 1, pos) + 1;
          const const_reverse_iterator rresult =
             std::find_first_of(const_reverse_iterator(last), rend(),
                                s, s + n,
@@ -1843,7 +1911,7 @@
       if (len < 1)
          return npos;
       else {
- const const_iterator last = begin() + containers_detail::min_value(len - 1, pos) + 1;
+ const const_iterator last = begin() + container_detail::min_value(len - 1, pos) + 1;
          const const_reverse_iterator rresult =
             std::find_if(const_reverse_iterator(last), rend(),
                     Not_within_traits<Traits>(s, s + n));
@@ -1869,7 +1937,7 @@
       if (len < 1)
          return npos;
       else {
- const const_iterator last = begin() + containers_detail::min_value(len - 1, pos) + 1;
+ const const_iterator last = begin() + container_detail::min_value(len - 1, pos) + 1;
          const_reverse_iterator rresult =
             std::find_if(const_reverse_iterator(last), rend(),
                   std::not1(std::bind2nd(Eq_traits<Traits>(), c)));
@@ -1890,7 +1958,7 @@
       if (pos > size())
          this->throw_out_of_range();
       return basic_string(this->priv_addr() + pos,
- this->priv_addr() + pos + containers_detail::min_value(n, size() - pos), this->alloc());
+ this->priv_addr() + pos + container_detail::min_value(n, size() - pos), this->alloc());
    }
 
    //! <b>Effects</b>: Determines the effective length rlen of the string to copy as
@@ -1918,7 +1986,7 @@
       if (pos1 > size())
          this->throw_out_of_range();
       return s_compare(this->priv_addr() + pos1,
- this->priv_addr() + pos1 + containers_detail::min_value(n1, size() - pos1),
+ this->priv_addr() + pos1 + container_detail::min_value(n1, size() - pos1),
                         str.priv_addr(), str.priv_addr() + str.priv_size());
    }
 
@@ -1935,9 +2003,9 @@
       if (pos1 > size() || pos2 > str.size())
          this->throw_out_of_range();
       return s_compare(this->priv_addr() + pos1,
- this->priv_addr() + pos1 + containers_detail::min_value(n1, size() - pos1),
+ this->priv_addr() + pos1 + container_detail::min_value(n1, size() - pos1),
                         str.priv_addr() + pos2,
- str.priv_addr() + pos2 + containers_detail::min_value(n2, size() - pos2));
+ str.priv_addr() + pos2 + container_detail::min_value(n2, size() - pos2));
    }
 
    //! <b>Throws</b>: Nothing
@@ -1958,7 +2026,7 @@
       if (pos1 > size())
          this->throw_out_of_range();
       return s_compare(this->priv_addr() + pos1,
- this->priv_addr() + pos1 + containers_detail::min_value(n1, size() - pos1),
+ this->priv_addr() + pos1 + container_detail::min_value(n1, size() - pos1),
                         s, s + n2);
    }
 
@@ -1977,13 +2045,16 @@
    {
       const difference_type n1 = l1 - f1;
       const difference_type n2 = l2 - f2;
- const int cmp = Traits::compare(containers_detail::get_pointer(f1),
- containers_detail::get_pointer(f2),
- containers_detail::min_value(n1, n2));
+ const int cmp = Traits::compare(container_detail::to_raw_pointer(f1),
+ container_detail::to_raw_pointer(f2),
+ container_detail::min_value(n1, n2));
       return cmp != 0 ? cmp : (n1 < n2 ? -1 : (n1 > n2 ? 1 : 0));
    }
 
- void priv_shrink_to_fit_dynamic_buffer(allocator_v1)
+ template<class AllocVersion>
+ void priv_shrink_to_fit_dynamic_buffer
+ ( AllocVersion
+ , typename container_detail::enable_if<container_detail::is_same<AllocVersion, allocator_v1> >::type* = 0)
    {
       //Allocate a new buffer.
       size_type real_cap = 0;
@@ -1995,8 +2066,8 @@
          std::pair<pointer, bool> ret = this->allocation_command
                (allocate_new, long_size+1, long_size+1, real_cap, long_addr);
          //Copy and update
- Traits::copy( containers_detail::get_pointer(ret.first)
- , containers_detail::get_pointer(this->priv_long_addr())
+ Traits::copy( container_detail::to_raw_pointer(ret.first)
+ , container_detail::to_raw_pointer(this->priv_long_addr())
                      , long_size+1);
          this->priv_long_addr(ret.first);
          this->priv_storage(real_cap);
@@ -2008,7 +2079,10 @@
       }
    }
 
- void priv_shrink_to_fit_dynamic_buffer(allocator_v2)
+ template<class AllocVersion>
+ void priv_shrink_to_fit_dynamic_buffer
+ ( AllocVersion
+ , typename container_detail::enable_if<container_detail::is_same<AllocVersion, allocator_v2> >::type* = 0)
    {
       size_type received_size;
       if(this->alloc().allocation_command
@@ -2044,7 +2118,7 @@
                               std::forward_iterator_tag)
    {
       difference_type n = std::distance(f, l);
- this->allocate_initial_block(containers_detail::max_value<difference_type>(n+1, InternalBufferChars));
+ this->allocate_initial_block(container_detail::max_value<difference_type>(n+1, InternalBufferChars));
       priv_uninitialized_copy(f, l, this->priv_addr());
       this->priv_size(n);
       this->priv_terminate_string();
@@ -2058,16 +2132,16 @@
    }
 
    template <class Integer>
- void priv_initialize_dispatch(Integer n, Integer x, containers_detail::true_)
+ void priv_initialize_dispatch(Integer n, Integer x, container_detail::true_)
    {
- this->allocate_initial_block(containers_detail::max_value<difference_type>(n+1, InternalBufferChars));
+ this->allocate_initial_block(container_detail::max_value<difference_type>(n+1, InternalBufferChars));
       priv_uninitialized_fill_n(this->priv_addr(), n, x);
       this->priv_size(n);
       this->priv_terminate_string();
    }
 
    template <class InputIter>
- void priv_initialize_dispatch(InputIter f, InputIter l, containers_detail::false_)
+ void priv_initialize_dispatch(InputIter f, InputIter l, container_detail::false_)
    { this->priv_range_initialize(f, l); }
  
    template<class FwdIt, class Count> inline
@@ -2117,15 +2191,15 @@
    }
 
    template <class Integer>
- basic_string& priv_assign_dispatch(Integer n, Integer x, containers_detail::true_)
+ basic_string& priv_assign_dispatch(Integer n, Integer x, container_detail::true_)
    { return this->assign((size_type) n, (CharT) x); }
 
    template <class InputIter>
    basic_string& priv_assign_dispatch(InputIter f, InputIter l,
- containers_detail::false_)
+ container_detail::false_)
    {
       size_type cur = 0;
- CharT *ptr = containers_detail::get_pointer(this->priv_addr());
+ CharT *ptr = container_detail::to_raw_pointer(this->priv_addr());
       while (f != l && cur != this->priv_size()) {
          Traits::assign(*ptr, *f);
          ++f;
@@ -2189,10 +2263,10 @@
                                        pointer_past_last, pointer_past_last);
 
                this->priv_size(this->priv_size()+n);
- Traits::move(const_cast<CharT*>(containers_detail::get_pointer(position + n)),
- containers_detail::get_pointer(position),
+ Traits::move(const_cast<CharT*>(container_detail::to_raw_pointer(position + n)),
+ container_detail::to_raw_pointer(position),
                            (elems_after - n) + 1);
- this->priv_copy(first, last, const_cast<CharT*>(containers_detail::get_pointer(position)));
+ this->priv_copy(first, last, const_cast<CharT*>(container_detail::to_raw_pointer(position)));
             }
             else {
                ForwardIter mid = first;
@@ -2204,7 +2278,7 @@
                   (position, const_iterator(this->priv_addr() + old_length + 1),
                   this->priv_addr() + this->priv_size());
                this->priv_size(this->priv_size() + elems_after);
- this->priv_copy(first, mid, const_cast<CharT*>(containers_detail::get_pointer(position)));
+ this->priv_copy(first, mid, const_cast<CharT*>(container_detail::to_raw_pointer(position)));
             }
          }
          else{
@@ -2231,9 +2305,9 @@
             else{
                //value_type is POD, so backwards expansion is much easier
                //than with vector<T>
- value_type *oldbuf = containers_detail::get_pointer(old_start);
- value_type *newbuf = containers_detail::get_pointer(new_start);
- const value_type *pos = containers_detail::get_pointer(position);
+ value_type *oldbuf = container_detail::to_raw_pointer(old_start);
+ value_type *newbuf = container_detail::to_raw_pointer(new_start);
+ const value_type *pos = container_detail::to_raw_pointer(position);
                size_type before = pos - oldbuf;
 
                //First move old data
@@ -2253,12 +2327,12 @@
 
    template <class Integer>
    void priv_insert_dispatch(const_iterator p, Integer n, Integer x,
- containers_detail::true_)
+ container_detail::true_)
    { insert(p, (size_type) n, (CharT) x); }
 
    template <class InputIter>
    void priv_insert_dispatch(const_iterator p, InputIter first, InputIter last,
- containers_detail::false_)
+ container_detail::false_)
    {
       typedef typename std::iterator_traits<InputIter>::iterator_category Category;
       priv_insert(p, first, last, Category());
@@ -2277,13 +2351,13 @@
    template <class Integer>
    basic_string& priv_replace_dispatch(const_iterator first, const_iterator last,
                                        Integer n, Integer x,
- containers_detail::true_)
+ container_detail::true_)
    { return this->replace(first, last, (size_type) n, (CharT) x); }
 
    template <class InputIter>
    basic_string& priv_replace_dispatch(const_iterator first, const_iterator last,
                                        InputIter f, InputIter l,
- containers_detail::false_)
+ container_detail::false_)
    {
       typedef typename std::iterator_traits<InputIter>::iterator_category Category;
       return this->priv_replace(first, last, f, l, Category());
@@ -2312,13 +2386,13 @@
       difference_type n = std::distance(f, l);
       const difference_type len = last - first;
       if (len >= n) {
- this->priv_copy(f, l, const_cast<CharT*>(containers_detail::get_pointer(first)));
+ this->priv_copy(f, l, const_cast<CharT*>(container_detail::to_raw_pointer(first)));
          this->erase(first + n, last);
       }
       else {
          ForwardIter m = f;
          std::advance(m, len);
- this->priv_copy(f, m, const_cast<CharT*>(containers_detail::get_pointer(first)));
+ this->priv_copy(f, m, const_cast<CharT*>(container_detail::to_raw_pointer(first)));
          this->insert(last, m, l);
       }
       return *this;
@@ -2364,10 +2438,20 @@
    typedef basic_string<CharT,Traits,A> str_t;
    typedef typename str_t::reserve_t reserve_t;
    reserve_t reserve;
- str_t result(reserve, x.size() + y.size(), x.alloc());
+ str_t result(reserve, x.size() + y.size(), x.get_stored_allocator());
    result.append(x);
    result.append(y);
- return result;
+ return boost::move(result);
+}
+
+template <class CharT, class Traits, class A> inline
+BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
+ operator+(
+ BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
+ , BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
+{
+ mx += my;
+ return boost::move(mx);
 }
 
 template <class CharT, class Traits, class A> inline
@@ -2386,7 +2470,8 @@
          BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
 {
    typedef typename basic_string<CharT,Traits,A>::size_type size_type;
- return my.replace(size_type(0), size_type(0), x);
+ my.replace(size_type(0), size_type(0), x);
+ return boost::move(my);
 }
 
 template <class CharT, class Traits, class A>
@@ -2400,7 +2485,7 @@
    str_t result(reserve, n + y.size());
    result.append(s, s + n);
    result.append(y);
- return result;
+ return boost::move(result);
 }
 
 template <class CharT, class Traits, class A> inline
@@ -2409,7 +2494,7 @@
          BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
 {
    typedef typename basic_string<CharT,Traits,A>::size_type size_type;
- return boost::move(my.get().replace(size_type(0), size_type(0), s));
+ return boost::move(my.replace(size_type(0), size_type(0), s));
 }
 
 template <class CharT, class Traits, class A>
@@ -2422,7 +2507,7 @@
    str_t result(reserve, 1 + y.size());
    result.push_back(c);
    result.append(y);
- return result;
+ return boost::move(result);
 }
 
 template <class CharT, class Traits, class A> inline
@@ -2431,7 +2516,7 @@
          BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
 {
    typedef typename basic_string<CharT,Traits,A>::size_type size_type;
- return my.replace(size_type(0), size_type(0), &c, &c + 1);
+ return boost::move(my.replace(size_type(0), size_type(0), &c, &c + 1));
 }
 
 template <class CharT, class Traits, class A>
@@ -2442,10 +2527,10 @@
    typedef typename str_t::reserve_t reserve_t;
    reserve_t reserve;
    const typename str_t::size_type n = Traits::length(s);
- str_t result(reserve, x.size() + n, x.alloc());
+ str_t result(reserve, x.size() + n, x.get_stored_allocator());
    result.append(x);
    result.append(s, s + n);
- return result;
+ return boost::move(result);
 }
 
 template <class CharT, class Traits, class A>
@@ -2461,13 +2546,13 @@
 inline basic_string<CharT,Traits,A>
 operator+(const basic_string<CharT,Traits,A>& x, const CharT c)
 {
- typedef basic_string<CharT,Traits,A> str_t;
- typedef typename str_t::reserve_t reserve_t;
+ typedef basic_string<CharT,Traits,A> str_t;
+ typedef typename str_t::reserve_t reserve_t;
    reserve_t reserve;
- str_t result(reserve, x.size() + 1, x.alloc());
+ str_t result(reserve, x.size() + 1, x.get_stored_allocator());
    result.append(x);
    result.push_back(c);
- return result;
+ return boost::move(result);
 }
 
 template <class CharT, class Traits, class A>
@@ -2616,7 +2701,7 @@
 
 /// @cond
 // I/O.
-namespace containers_detail {
+namespace container_detail {
 
 template <class CharT, class Traits>
 inline bool
@@ -2633,7 +2718,7 @@
    return ok;
 }
 
-} //namespace containers_detail {
+} //namespace container_detail {
 /// @endcond
 
 template <class CharT, class Traits, class A>
@@ -2655,13 +2740,13 @@
          pad_len = w - n;
        
       if (!left)
- ok = containers_detail::string_fill(os, buf, pad_len);
+ ok = container_detail::string_fill(os, buf, pad_len);
 
       ok = ok &&
             buf->sputn(s.data(), std::streamsize(n)) == std::streamsize(n);
 
       if (left)
- ok = ok && containers_detail::string_fill(os, buf, pad_len);
+ ok = ok && container_detail::string_fill(os, buf, pad_len);
    }
 
    if (!ok)
@@ -2783,4 +2868,4 @@
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif // BOOST_CONTAINERS_STRING_HPP
+#endif // BOOST_CONTAINER_STRING_HPP

Modified: trunk/boost/container/vector.hpp
==============================================================================
--- trunk/boost/container/vector.hpp (original)
+++ trunk/boost/container/vector.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_CONTAINERS_CONTAINERS_VECTOR_HPP
-#define BOOST_CONTAINERS_CONTAINERS_VECTOR_HPP
+#ifndef BOOST_CONTAINER_CONTAINER_VECTOR_HPP
+#define BOOST_CONTAINER_CONTAINER_VECTOR_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -31,17 +31,20 @@
 #include <boost/type_traits/has_trivial_assign.hpp>
 #include <boost/type_traits/has_nothrow_copy.hpp>
 #include <boost/type_traits/has_nothrow_assign.hpp>
-#include <boost/move/move_helpers.hpp>
+#include <boost/type_traits/has_nothrow_constructor.hpp>
 #include <boost/container/detail/version_type.hpp>
 #include <boost/container/detail/allocation_type.hpp>
 #include <boost/container/detail/utilities.hpp>
 #include <boost/container/detail/iterators.hpp>
 #include <boost/container/detail/algorithms.hpp>
 #include <boost/container/detail/destroyers.hpp>
+#include <boost/container/allocator/allocator_traits.hpp>
 #include <boost/container/container_fwd.hpp>
 #include <boost/move/move.hpp>
-#include <boost/pointer_to_other.hpp>
+#include <boost/move/move_helpers.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/container/detail/mpl.hpp>
+#include <boost/container/detail/type_traits.hpp>
 #include <boost/container/detail/advanced_insert_int.hpp>
 
 namespace boost {
@@ -49,25 +52,19 @@
 
 /// @cond
 
-namespace containers_detail {
+namespace container_detail {
 
 //! Const vector_iterator used to iterate through a vector.
 template <class Pointer>
 class vector_const_iterator
- : public std::iterator<std::random_access_iterator_tag
- ,const typename std::iterator_traits<Pointer>::value_type
- ,typename std::iterator_traits<Pointer>::difference_type
- ,typename boost::pointer_to_other
- <Pointer
- ,const typename std::iterator_traits<Pointer>::value_type
- >::type
- ,const typename std::iterator_traits<Pointer>::value_type &>
 {
    public:
- typedef typename std::iterator_traits<Pointer>::value_type value_type;
- typedef typename std::iterator_traits<Pointer>::difference_type difference_type;
- typedef typename boost::pointer_to_other<Pointer, value_type>::type pointer;
- typedef const value_type& reference;
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef typename boost::intrusive::pointer_traits<Pointer>::element_type value_type;
+ typedef typename boost::intrusive::pointer_traits<Pointer>::difference_type difference_type;
+ typedef typename boost::intrusive::pointer_traits<Pointer>::template
+ rebind_pointer<const value_type>::type pointer;
+ typedef const value_type& reference;
 
    /// @cond
    protected:
@@ -88,7 +85,7 @@
    { return *m_ptr; }
 
    const value_type * operator->() const
- { return containers_detail::get_pointer(m_ptr); }
+ { return container_detail::to_raw_pointer(m_ptr); }
 
    reference operator[](difference_type off) const
    { return m_ptr[off]; }
@@ -156,10 +153,11 @@
    {}
 
    public:
- typedef typename std::iterator_traits<Pointer>::value_type value_type;
- typedef typename vector_const_iterator<Pointer>::difference_type difference_type;
- typedef Pointer pointer;
- typedef value_type& reference;
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef typename boost::intrusive::pointer_traits<Pointer>::element_type value_type;
+ typedef typename boost::intrusive::pointer_traits<Pointer>::difference_type difference_type;
+ typedef Pointer pointer;
+ typedef value_type& reference;
 
    //Constructors
    vector_iterator()
@@ -170,7 +168,7 @@
    { return *this->m_ptr; }
 
    value_type* operator->() const
- { return containers_detail::get_pointer(this->m_ptr); }
+ { return container_detail::to_raw_pointer(this->m_ptr); }
 
    reference operator[](difference_type off) const
    { return this->m_ptr[off]; }
@@ -216,30 +214,35 @@
    static const bool trivial_dctr = boost::has_trivial_destructor<value_type>::value;
    static const bool trivial_dctr_after_move = trivial_dctr;
       //::boost::has_trivial_destructor_after_move<value_type>::value || trivial_dctr;
+ //static const bool trivial_copy = has_trivial_copy<value_type>::value;
+ //static const bool nothrow_copy = has_nothrow_copy<value_type>::value;
+ //static const bool trivial_assign = has_trivial_assign<value_type>::value;
+ //static const bool nothrow_assign = has_nothrow_assign<value_type>::value;
+
    static const bool trivial_copy = has_trivial_copy<value_type>::value;
    static const bool nothrow_copy = has_nothrow_copy<value_type>::value;
    static const bool trivial_assign = has_trivial_assign<value_type>::value;
- static const bool nothrow_assign = has_nothrow_assign<value_type>::value;
+ static const bool nothrow_assign = false;
 
    //This is the anti-exception array destructor
    //to deallocate values already constructed
- typedef typename containers_detail::if_c
+ typedef typename container_detail::if_c
       <trivial_dctr
- ,containers_detail::null_scoped_destructor_n<allocator_type>
- ,containers_detail::scoped_destructor_n<allocator_type>
+ ,container_detail::null_scoped_destructor_n<A>
+ ,container_detail::scoped_destructor_n<A>
>::type OldArrayDestructor;
    //This is the anti-exception array destructor
    //to destroy objects created with copy construction
- typedef typename containers_detail::if_c
+ typedef typename container_detail::if_c
       <nothrow_copy
- ,containers_detail::null_scoped_destructor_n<allocator_type>
- ,containers_detail::scoped_destructor_n<allocator_type>
+ ,container_detail::null_scoped_destructor_n<A>
+ ,container_detail::scoped_destructor_n<A>
>::type ArrayDestructor;
    //This is the anti-exception array deallocator
- typedef typename containers_detail::if_c
+ typedef typename container_detail::if_c
       <nothrow_copy
- ,containers_detail::null_scoped_array_deallocator<allocator_type>
- ,containers_detail::scoped_array_deallocator<allocator_type>
+ ,container_detail::null_scoped_array_deallocator<A>
+ ,container_detail::scoped_array_deallocator<A>
>::type ArrayDeallocator;
 };
 
@@ -247,14 +250,22 @@
 template <class A>
 struct vector_alloc_holder
 {
- typedef typename A::pointer pointer;
- typedef typename A::size_type size_type;
- typedef typename A::value_type value_type;
- typedef vector_value_traits<value_type, A> value_traits;
+ typedef boost::container::allocator_traits<A> allocator_traits_type;
+ typedef typename allocator_traits_type::pointer pointer;
+ typedef typename allocator_traits_type::size_type size_type;
+ typedef typename allocator_traits_type::value_type value_type;
+ typedef vector_value_traits<value_type, A> value_traits;
+
+ //Constructor, does not throw
+ vector_alloc_holder()
+ BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor<A>::value)
+ : members_()
+ {}
 
    //Constructor, does not throw
- vector_alloc_holder(const A &a)
- : members_(a)
+ template<class AllocConvertible>
+ explicit vector_alloc_holder(BOOST_FWD_REF(AllocConvertible) a) BOOST_CONTAINER_NOEXCEPT
+ : members_(boost::forward<AllocConvertible>(a))
    {}
 
    //Destructor
@@ -264,10 +275,10 @@
       this->prot_deallocate();
    }
 
- typedef containers_detail::integral_constant<unsigned, 1> allocator_v1;
- typedef containers_detail::integral_constant<unsigned, 2> allocator_v2;
- typedef containers_detail::integral_constant<unsigned,
- boost::container::containers_detail::version<A>::value> alloc_version;
+ typedef container_detail::integral_constant<unsigned, 1> allocator_v1;
+ typedef container_detail::integral_constant<unsigned, 2> allocator_v2;
+ typedef container_detail::integral_constant<unsigned,
+ boost::container::container_detail::version<A>::value> alloc_version;
    std::pair<pointer, bool>
       allocation_command(allocation_type command,
                          size_type limit_size,
@@ -307,7 +318,10 @@
    }
 
    size_type next_capacity(size_type additional_objects) const
- { return get_next_capacity(this->alloc().max_size(), this->members_.m_capacity, additional_objects); }
+ {
+ return get_next_capacity( allocator_traits_type::max_size(this->alloc())
+ , this->members_.m_capacity, additional_objects);
+ }
 
    struct members_holder
       : public A
@@ -316,8 +330,13 @@
       members_holder(const members_holder&);
 
       public:
- members_holder(const A &alloc)
- : A(alloc), m_start(0), m_size(0), m_capacity(0)
+ template<class Alloc>
+ explicit members_holder(BOOST_FWD_REF(Alloc) alloc)
+ : A(boost::forward<Alloc>(alloc)), m_start(0), m_size(0), m_capacity(0)
+ {}
+
+ members_holder()
+ : A(), m_start(0), m_size(0), m_capacity(0)
       {}
 
       pointer m_start;
@@ -325,6 +344,13 @@
       size_type m_capacity;
    } members_;
 
+ void swap_members(vector_alloc_holder &x)
+ {
+ container_detail::do_swap(this->members_.m_start, x.members_.m_start);
+ container_detail::do_swap(this->members_.m_size, x.members_.m_size);
+ container_detail::do_swap(this->members_.m_capacity, x.members_.m_capacity);
+ }
+
    A &alloc()
    { return members_; }
 
@@ -344,23 +370,26 @@
    void destroy(value_type* p)
    {
       if(!value_traits::trivial_dctr)
- containers_detail::get_pointer(p)->~value_type();
+ allocator_traits_type::destroy(this->alloc(), p);
    }
 
    void destroy_n(value_type* p, size_type n)
    {
- if(!value_traits::trivial_dctr)
- for(; n--; ++p) p->~value_type();
+ if(!value_traits::trivial_dctr){
+ for(; n--; ++p){
+ allocator_traits_type::destroy(this->alloc(), p);
+ }
+ }
    }
 
    void prot_destroy_all()
    {
- this->destroy_n(containers_detail::get_pointer(this->members_.m_start), this->members_.m_size);
+ this->destroy_n(container_detail::to_raw_pointer(this->members_.m_start), this->members_.m_size);
       this->members_.m_size = 0;
    }
 };
 
-} //namespace containers_detail {
+} //namespace container_detail {
 /// @endcond
 
 //! \class vector
@@ -375,33 +404,34 @@
 #else
 template <class T, class A>
 #endif
-class vector : private containers_detail::vector_alloc_holder<A>
+class vector : private container_detail::vector_alloc_holder<A>
 {
    /// @cond
    typedef vector<T, A> self_t;
- typedef containers_detail::vector_alloc_holder<A> base_t;
+ typedef container_detail::vector_alloc_holder<A> base_t;
+ typedef allocator_traits<A> allocator_traits_type;
    /// @endcond
    public:
    //! The type of object, T, stored in the vector
- typedef T value_type;
+ typedef T value_type;
    //! Pointer to T
- typedef typename A::pointer pointer;
+ typedef typename allocator_traits_type::pointer pointer;
    //! Const pointer to T
- typedef typename A::const_pointer const_pointer;
+ typedef typename allocator_traits_type::const_pointer const_pointer;
    //! Reference to T
- typedef typename A::reference reference;
+ typedef typename allocator_traits_type::reference reference;
    //! Const reference to T
- typedef typename A::const_reference const_reference;
+ typedef typename allocator_traits_type::const_reference const_reference;
    //! An unsigned integral type
- typedef typename A::size_type size_type;
+ typedef typename allocator_traits_type::size_type size_type;
    //! A signed integral type
- typedef typename A::difference_type difference_type;
+ typedef typename allocator_traits_type::difference_type difference_type;
    //! The allocator type
    typedef A allocator_type;
    //! The random access iterator
- typedef containers_detail::vector_iterator<pointer> iterator;
+ typedef container_detail::vector_iterator<pointer> iterator;
    //! The random access const_iterator
- typedef containers_detail::vector_const_iterator<pointer> const_iterator;
+ typedef container_detail::vector_const_iterator<pointer> const_iterator;
 
    //! Iterator used to iterate backwards through a vector.
    typedef std::reverse_iterator<iterator>
@@ -415,8 +445,8 @@
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(vector)
- typedef containers_detail::advanced_insert_aux_int<T, T*> advanced_insert_aux_int_t;
- typedef containers_detail::vector_value_traits<value_type, A> value_traits;
+ typedef container_detail::advanced_insert_aux_int<T*> advanced_insert_aux_int_t;
+ typedef container_detail::vector_value_traits<value_type, A> value_traits;
 
    typedef typename base_t::allocator_v1 allocator_v1;
    typedef typename base_t::allocator_v2 allocator_v2;
@@ -431,33 +461,43 @@
 
    //! <b>Effects</b>: Constructs a vector taking the allocator as parameter.
    //!
- //! <b>Throws</b>: If allocator_type's copy constructor throws.
+ //! <b>Throws</b>: If allocator_type's default constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- explicit vector(const A& a = A())
+ vector()
+ BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor<A>::value)
+ : base_t()
+ {}
+
+ //! <b>Effects</b>: Constructs a vector taking the allocator as parameter.
+ //!
+ //! <b>Throws</b>: Nothing
+ //!
+ //! <b>Complexity</b>: Constant.
+ explicit vector(const A& a) BOOST_CONTAINER_NOEXCEPT
       : base_t(a)
    {}
 
    //! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
    //! and inserts n default contructed values.
    //!
- //! <b>Throws</b>: If allocator_type's default constructor or copy constructor
- //! throws or T's default or copy constructor throws.
+ //! <b>Throws</b>: If allocator_type's default constructor or allocation
+ //! throws or T's default constructor throws.
    //!
    //! <b>Complexity</b>: Linear to n.
- explicit vector(size_type n)
- : base_t(allocator_type())
+ explicit vector(size_type n)
+ : base_t()
    {
       //Allocate
       size_type real_cap;
       std::pair<pointer, bool> ret =
          this->allocation_command(allocate_new, n, n, real_cap, this->members_.m_start);
- T *new_mem = containers_detail::get_pointer(ret.first);
+ T *new_mem = container_detail::to_raw_pointer(ret.first);
       //Anti-exception rollback
       typename value_traits::ArrayDeallocator scoped_alloc(new_mem, this->alloc(), real_cap);
       //Default constructor
- containers_detail::default_construct_aux_proxy<T, T*, size_type> proxy(n);
- proxy.uninitialized_copy_all_to(new_mem);
+ container_detail::default_construct_aux_proxy<A, T*> proxy(this->alloc(), n);
+ proxy.uninitialized_copy_remaining_to(new_mem);
       //All ok, commit
       this->members_.m_start = ret.first;
       this->members_.m_size = n;
@@ -468,8 +508,8 @@
    //! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
    //! and inserts n copies of value.
    //!
- //! <b>Throws</b>: If allocator_type's default constructor or copy constructor
- //! throws or T's default or copy constructor throws.
+ //! <b>Throws</b>: If allocator_type's default constructor or allocation
+ //! throws or T's copy constructor throws.
    //!
    //! <b>Complexity</b>: Linear to n.
    vector(size_type n, const T& value, const allocator_type& a = allocator_type())
@@ -480,24 +520,30 @@
    //!
    //! <b>Postcondition</b>: x == *this.
    //!
+ //! <b>Throws</b>: If allocator_type's default constructor or allocation
+ //! throws or T's copy constructor throws.
+ //!
    //! <b>Complexity</b>: Linear to the elements x contains.
- vector(const vector<T, A>& x)
- : base_t(static_cast<const base_t&>(x).alloc())
- { *this = x; }
+ vector(const vector &x)
+ : base_t(allocator_traits_type::select_on_container_copy_construction(x.alloc()))
+ {
+ this->assign( container_detail::to_raw_pointer(x.members_.m_start)
+ , container_detail::to_raw_pointer(x.members_.m_start + x.members_.m_size));
+ }
 
    //! <b>Effects</b>: Move constructor. Moves mx's resources to *this.
    //!
- //! <b>Throws</b>: If allocator_type's copy constructor throws.
+ //! <b>Throws</b>: Nothing
    //!
    //! <b>Complexity</b>: Constant.
- vector(BOOST_RV_REF(vector) mx)
- : base_t(static_cast<base_t&>(mx).alloc())
- { this->swap(mx); }
+ vector(BOOST_RV_REF(vector) mx) BOOST_CONTAINER_NOEXCEPT
+ : base_t(boost::move(mx.alloc()))
+ { this->swap_members(mx); }
 
    //! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
    //! and inserts a copy of the range [first, last) in the vector.
    //!
- //! <b>Throws</b>: If allocator_type's default constructor or copy constructor
+ //! <b>Throws</b>: If allocator_type's default constructor or allocation
    //! throws or T's constructor taking an dereferenced InIt throws.
    //!
    //! <b>Complexity</b>: Linear to the range [first, last).
@@ -512,7 +558,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Linear to the number of elements.
- ~vector()
+ ~vector() BOOST_CONTAINER_NOEXCEPT
    {} //vector_alloc_holder clears the data
 
    //! <b>Effects</b>: Returns an iterator to the first element contained in the vector.
@@ -520,7 +566,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- iterator begin()
+ iterator begin() BOOST_CONTAINER_NOEXCEPT
    { return iterator(this->members_.m_start); }
 
    //! <b>Effects</b>: Returns a const_iterator to the first element contained in the vector.
@@ -528,7 +574,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_iterator begin() const
+ const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
    { return const_iterator(this->members_.m_start); }
 
    //! <b>Effects</b>: Returns an iterator to the end of the vector.
@@ -536,7 +582,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- iterator end()
+ iterator end() BOOST_CONTAINER_NOEXCEPT
    { return iterator(this->members_.m_start + this->members_.m_size); }
 
    //! <b>Effects</b>: Returns a const_iterator to the end of the vector.
@@ -544,7 +590,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_iterator end() const
+ const_iterator end() const BOOST_CONTAINER_NOEXCEPT
    { return this->cend(); }
 
    //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
@@ -553,7 +599,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- reverse_iterator rbegin()
+ reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
    { return reverse_iterator(this->end()); }
 
    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
@@ -562,7 +608,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_reverse_iterator rbegin()const
+ const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
    { return this->crbegin(); }
 
    //! <b>Effects</b>: Returns a reverse_iterator pointing to the end
@@ -571,7 +617,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- reverse_iterator rend()
+ reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
    { return reverse_iterator(this->begin()); }
 
    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
@@ -580,7 +626,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_reverse_iterator rend() const
+ const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
    { return this->crend(); }
 
    //! <b>Effects</b>: Returns a const_iterator to the first element contained in the vector.
@@ -588,7 +634,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_iterator cbegin() const
+ const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
    { return const_iterator(this->members_.m_start); }
 
    //! <b>Effects</b>: Returns a const_iterator to the end of the vector.
@@ -596,7 +642,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_iterator cend() const
+ const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
    { return const_iterator(this->members_.m_start + this->members_.m_size); }
 
    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
@@ -605,7 +651,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_reverse_iterator crbegin()const
+ const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
    { return const_reverse_iterator(this->end());}
 
    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
@@ -614,7 +660,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_reverse_iterator crend() const
+ const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
    { return const_reverse_iterator(this->begin()); }
 
    //! <b>Requires</b>: !empty()
@@ -625,7 +671,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- reference front()
+ reference front() BOOST_CONTAINER_NOEXCEPT
    { return *this->members_.m_start; }
 
    //! <b>Requires</b>: !empty()
@@ -636,7 +682,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_reference front() const
+ const_reference front() const BOOST_CONTAINER_NOEXCEPT
    { return *this->members_.m_start; }
 
    //! <b>Requires</b>: !empty()
@@ -647,7 +693,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- reference back()
+ reference back() BOOST_CONTAINER_NOEXCEPT
    { return this->members_.m_start[this->members_.m_size - 1]; }
 
    //! <b>Requires</b>: !empty()
@@ -658,7 +704,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_reference back() const
+ const_reference back() const BOOST_CONTAINER_NOEXCEPT
    { return this->members_.m_start[this->members_.m_size - 1]; }
 
    //! <b>Returns</b>: A pointer such that [data(),data() + size()) is a valid range.
@@ -667,7 +713,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- pointer data()
+ pointer data() BOOST_CONTAINER_NOEXCEPT
    { return this->members_.m_start; }
 
    //! <b>Returns</b>: A pointer such that [data(),data() + size()) is a valid range.
@@ -676,7 +722,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_pointer data() const
+ const_pointer data() const BOOST_CONTAINER_NOEXCEPT
    { return this->members_.m_start; }
 
    //! <b>Effects</b>: Returns the number of the elements contained in the vector.
@@ -684,7 +730,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- size_type size() const
+ size_type size() const BOOST_CONTAINER_NOEXCEPT
    { return this->members_.m_size; }
 
    //! <b>Effects</b>: Returns the largest possible size of the vector.
@@ -692,8 +738,8 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- size_type max_size() const
- { return this->alloc().max_size(); }
+ size_type max_size() const BOOST_CONTAINER_NOEXCEPT
+ { return allocator_traits_type::max_size(this->alloc()); }
 
    //! <b>Effects</b>: Number of elements for which memory has been allocated.
    //! capacity() is always greater than or equal to size().
@@ -701,7 +747,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- size_type capacity() const
+ size_type capacity() const BOOST_CONTAINER_NOEXCEPT
    { return this->members_.m_capacity; }
 
    //! <b>Effects</b>: Returns true if the vector contains no elements.
@@ -709,7 +755,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- bool empty() const
+ bool empty() const BOOST_CONTAINER_NOEXCEPT
    { return !this->members_.m_size; }
 
    //! <b>Requires</b>: size() < n.
@@ -731,7 +777,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Constant.
- const_reference operator[](size_type n) const
+ const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
    { return this->members_.m_start[n]; }
 
    //! <b>Requires</b>: size() < n.
@@ -742,7 +788,7 @@
    //! <b>Throws</b>: std::range_error if n >= size()
    //!
    //! <b>Complexity</b>: Constant.
- reference at(size_type n)
+ reference at(size_type n)
    { this->priv_check_range(n); return this->members_.m_start[n]; }
 
    //! <b>Requires</b>: size() < n.
@@ -761,13 +807,27 @@
    //! <b>Throws</b>: If allocator's copy constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- allocator_type get_allocator() const
+ allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
    { return this->alloc(); }
 
- const stored_allocator_type &get_stored_allocator() const
+ //! <b>Effects</b>: Returns a reference to the internal allocator.
+ //!
+ //! <b>Throws</b>: Nothing
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
+ //! <b>Note</b>: Non-standard extension.
+ const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
    { return this->alloc(); }
 
- stored_allocator_type &get_stored_allocator()
+ //! <b>Effects</b>: Returns a reference to the internal allocator.
+ //!
+ //! <b>Throws</b>: Nothing
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
+ //! <b>Note</b>: Non-standard extension.
+ stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
    { return this->alloc(); }
 
    //! <b>Effects</b>: If n is less than or equal to capacity(), this call has no
@@ -791,7 +851,7 @@
          //Check for forward expansion
          same_buffer_start = ret.second && this->members_.m_start == ret.first;
          if(same_buffer_start){
- #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
             ++this->num_expand_fwd;
             #endif
             this->members_.m_capacity = real_cap;
@@ -800,30 +860,30 @@
          //If there is no forward expansion, move objects
          else{
             //We will reuse insert code, so create a dummy input iterator
- T *dummy_it(containers_detail::get_pointer(this->members_.m_start));
- containers_detail::advanced_insert_aux_proxy<T, boost::move_iterator<T*>, T*>
- proxy(::boost::make_move_iterator(dummy_it), ::boost::make_move_iterator(dummy_it));
+ T *dummy_it(container_detail::to_raw_pointer(this->members_.m_start));
+ container_detail::advanced_insert_aux_proxy<A, boost::move_iterator<T*>, T*>
+ proxy(this->alloc(), ::boost::make_move_iterator(dummy_it), ::boost::make_move_iterator(dummy_it));
             //Backwards (and possibly forward) expansion
             if(ret.second){
- #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
                ++this->num_expand_bwd;
                #endif
                this->priv_range_insert_expand_backwards
- ( containers_detail::get_pointer(ret.first)
+ ( container_detail::to_raw_pointer(ret.first)
                   , real_cap
- , containers_detail::get_pointer(this->members_.m_start)
+ , container_detail::to_raw_pointer(this->members_.m_start)
                   , 0
                   , proxy);
             }
             //New buffer
             else{
- #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
                ++this->num_alloc;
                #endif
                this->priv_range_insert_new_allocation
- ( containers_detail::get_pointer(ret.first)
+ ( container_detail::to_raw_pointer(ret.first)
                   , real_cap
- , containers_detail::get_pointer(this->members_.m_start)
+ , container_detail::to_raw_pointer(this->members_.m_start)
                   , 0
                   , proxy);
             }
@@ -836,13 +896,23 @@
    //! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy
    //! of each of x's elements.
    //!
- //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
+ //! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment throws.
    //!
    //! <b>Complexity</b>: Linear to the number of elements in x.
    vector& operator=(BOOST_COPY_ASSIGN_REF(vector) x)
    {
       if (&x != this){
- this->assign(x.members_.m_start, x.members_.m_start + x.members_.m_size);
+ allocator_type &this_alloc = this->alloc();
+ const allocator_type &x_alloc = x.alloc();
+ container_detail::bool_<allocator_traits_type::
+ propagate_on_container_copy_assignment::value> flag;
+ if(flag && this_alloc != x_alloc){
+ this->clear();
+ this->shrink_to_fit();
+ }
+ container_detail::assign_alloc(this_alloc, x_alloc, flag);
+ this->assign( container_detail::to_raw_pointer(x.members_.m_start)
+ , container_detail::to_raw_pointer(x.members_.m_start + x.members_.m_size));
       }
       return *this;
    }
@@ -852,21 +922,39 @@
    //! <b>Postcondition</b>: x.empty(). *this contains a the elements x had
    //! before the function.
    //!
- //! <b>Throws</b>: If allocator_type's copy constructor throws.
+ //! <b>Throws</b>: Nothing
    //!
    //! <b>Complexity</b>: Linear.
    vector& operator=(BOOST_RV_REF(vector) x)
+ //iG BOOST_CONTAINER_NOEXCEPT_IF(!allocator_type::propagate_on_container_move_assignment::value || is_nothrow_move_assignable<allocator_type>::value);)
+ BOOST_CONTAINER_NOEXCEPT
    {
       if (&x != this){
- this->swap(x);
- x.clear();
+ allocator_type &this_alloc = this->alloc();
+ allocator_type &x_alloc = x.alloc();
+ //If allocators are equal we can just swap pointers
+ if(this_alloc == x_alloc){
+ //Destroy objects but retain memory in case x reuses it in the future
+ this->clear();
+ this->swap_members(x);
+ //Move allocator if needed
+ container_detail::bool_<allocator_traits_type::
+ propagate_on_container_move_assignment::value> flag;
+ container_detail::move_alloc(this_alloc, x_alloc, flag);
+ }
+ //If unequal allocators, then do a one by one move
+ else{
+ this->assign( boost::make_move_iterator(container_detail::to_raw_pointer(x.members_.m_start))
+ , boost::make_move_iterator(container_detail::to_raw_pointer(x.members_.m_start + x.members_.m_size)));
+ }
       }
       return *this;
    }
 
    //! <b>Effects</b>: Assigns the n copies of val to *this.
    //!
- //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
+ //! <b>Throws</b>: If memory allocation throws or
+ //! T's copy/move constructor/assignment throws.
    //!
    //! <b>Complexity</b>: Linear to n.
    void assign(size_type n, const value_type& val)
@@ -874,16 +962,16 @@
 
    //! <b>Effects</b>: Assigns the the range [first, last) to *this.
    //!
- //! <b>Throws</b>: If memory allocation throws or
- //! T's constructor from dereferencing InpIt throws.
+ //! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment or
+ //! T's constructor/assignment from dereferencing InpIt throws.
    //!
    //! <b>Complexity</b>: Linear to n.
    template <class InIt>
    void assign(InIt first, InIt last)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InIt, size_type>::value;
- typedef containers_detail::bool_<aux_boolean> Result;
+ const bool aux_boolean = container_detail::is_convertible<InIt, size_type>::value;
+ typedef container_detail::bool_<aux_boolean> Result;
       this->priv_assign_dispatch(first, last, Result());
    }
 
@@ -891,7 +979,7 @@
    //! <b>Effects</b>: Inserts a copy of x at the end of the vector.
    //!
    //! <b>Throws</b>: If memory allocation throws or
- //! T's copy constructor throws.
+ //! T's copy/move constructor throws.
    //!
    //! <b>Complexity</b>: Amortized constant time.
    void push_back(const T &x);
@@ -899,7 +987,8 @@
    //! <b>Effects</b>: Constructs a new element in the end of the vector
    //! and moves the resources of mx to this new element.
    //!
- //! <b>Throws</b>: If memory allocation throws.
+ //! <b>Throws</b>: If memory allocation throws or
+ //! T's move constructor throws.
    //!
    //! <b>Complexity</b>: Amortized constant time.
    void push_back(T &&x);
@@ -907,69 +996,26 @@
    BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
    #endif
 
-/*
- void push_back(insert_const_ref_type x)
- { return priv_push_back(x); }
-
- #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
- void push_back(T &x) { push_back(const_cast<const T &>(x)); }
-
- template<class U>
- typename containers_detail::enable_if_c
- <!::boost::has_move_emulation_enabled<U>::value &&
- containers_detail::is_same<T, U>::value
- >::type
- push_back(const U &u)
- { return priv_push_back(u); }
-
- #endif
-
- //! <b>Effects</b>: Constructs a new element in the end of the vector
- //! and moves the resources of mx to this new element.
- //!
- //! <b>Throws</b>: If memory allocation throws.
- //!
- //! <b>Complexity</b>: Amortized constant time.
- void push_back(BOOST_RV_REF(T) x)
- {
- if (this->members_.m_size < this->members_.m_capacity){
- //There is more memory, just construct a new object at the end
- new((void*)containers_detail::get_pointer(this->members_.m_start + this->members_.m_size))value_type(::boost::move(x));
- ++this->members_.m_size;
- }
- else{
- this->insert(this->cend(), ::boost::move(x));
- }
- }
-*/
- //! <b>Effects</b>: Constructs a new element in the end of the vector
- //! and moves the resources of mx to this new element.
- //!
- //! <b>Throws</b>: If memory allocation throws.
- //!
- //! <b>Complexity</b>: Amortized constant time.
-
-
- #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
+ #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... in the end of the vector.
    //!
- //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws.
+ //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws or
+ //! T's move constructor throws.
    //!
    //! <b>Complexity</b>: Amortized constant time.
    template<class ...Args>
    void emplace_back(Args &&...args)
    {
- T* back_pos = containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size;
+ T* back_pos = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
       if (this->members_.m_size < this->members_.m_capacity){
          //There is more memory, just construct a new object at the end
- new((void*)(back_pos))value_type(::boost::forward<Args>(args)...);
+ allocator_traits_type::construct(this->alloc(), back_pos, ::boost::forward<Args>(args)...);
          ++this->members_.m_size;
       }
       else{
- typedef containers_detail::advanced_insert_aux_emplace<T, T*, Args...> type;
- type &&proxy = type(::boost::forward<Args>(args)...);
+ typedef container_detail::advanced_insert_aux_emplace<A, T*, Args...> type;
+ type &&proxy = type(this->alloc(), ::boost::forward<Args>(args)...);
          priv_range_insert(back_pos, 1, proxy);
       }
    }
@@ -979,7 +1025,8 @@
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... before position
    //!
- //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws.
+ //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws or
+ //! T's move constructor/assignment throws.
    //!
    //! <b>Complexity</b>: If position is end(), amortized constant time
    //! Linear time otherwise.
@@ -988,69 +1035,49 @@
    {
       //Just call more general insert(pos, size, value) and return iterator
       size_type pos_n = position - cbegin();
- typedef containers_detail::advanced_insert_aux_emplace<T, T*, Args...> type;
- type &&proxy = type(::boost::forward<Args>(args)...);
+ typedef container_detail::advanced_insert_aux_emplace<A, T*, Args...> type;
+ type &&proxy = type(this->alloc(), ::boost::forward<Args>(args)...);
       priv_range_insert(position.get_ptr(), 1, proxy);
       return iterator(this->members_.m_start + pos_n);
    }
 
    #else
 
- void emplace_back()
- {
- T* back_pos = containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size;
- if (this->members_.m_size < this->members_.m_capacity){
- //There is more memory, just construct a new object at the end
- new((void*)(back_pos))value_type();
- ++this->members_.m_size;
- }
- else{
- containers_detail::advanced_insert_aux_emplace<value_type, T*> proxy;
- priv_range_insert(back_pos, 1, proxy);
- }
- }
-
- iterator emplace(const_iterator position)
- {
- size_type pos_n = position - cbegin();
- containers_detail::advanced_insert_aux_emplace<value_type, T*> proxy;
- priv_range_insert(containers_detail::get_pointer(position.get_ptr()), 1, proxy);
- return iterator(this->members_.m_start + pos_n);
- }
-
    #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
- T* back_pos = containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size; \
+ T* back_pos = container_detail::to_raw_pointer \
+ (this->members_.m_start) + this->members_.m_size; \
       if (this->members_.m_size < this->members_.m_capacity){ \
- new((void*)(back_pos))value_type \
- (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ allocator_traits_type::construct (this->alloc() \
+ , back_pos BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \
          ++this->members_.m_size; \
       } \
       else{ \
- containers_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
- <value_type, T*, BOOST_PP_ENUM_PARAMS(n, P)> \
- proxy(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ container_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
+ <A, T* BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> proxy \
+ (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
          priv_range_insert(back_pos, 1, proxy); \
       } \
    } \
                                                                                                 \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace(const_iterator pos, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace(const_iterator pos \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
    { \
       size_type pos_n = pos - cbegin(); \
- containers_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
- <value_type, T*, BOOST_PP_ENUM_PARAMS(n, P)> \
- proxy(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
- priv_range_insert(containers_detail::get_pointer(pos.get_ptr()), 1, proxy); \
+ container_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
+ <A, T* BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> proxy \
+ (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
+ priv_range_insert(container_detail::to_raw_pointer(pos.get_ptr()), 1, proxy); \
       return iterator(this->members_.m_start + pos_n); \
    } \
    //!
- #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
 
- #endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
   
    //! <b>Effects</b>: Swaps the contents of *this and x.
    //! If this->allocator_type() != x.allocator_type()
@@ -1061,15 +1088,11 @@
    //! <b>Complexity</b>: Constant.
    void swap(vector& x)
    {
- allocator_type &this_al = this->alloc(), &other_al = x.alloc();
       //Just swap internals
- containers_detail::do_swap(this->members_.m_start, x.members_.m_start);
- containers_detail::do_swap(this->members_.m_size, x.members_.m_size);
- containers_detail::do_swap(this->members_.m_capacity, x.members_.m_capacity);
-
- if (this_al != other_al){
- containers_detail::do_swap(this_al, other_al);
- }
+ this->swap_members(x);
+ //And now the allocator
+ container_detail::bool_<allocator_traits_type::propagate_on_container_swap::value> flag;
+ container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
    }
 
    #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -1077,7 +1100,7 @@
    //!
    //! <b>Effects</b>: Insert a copy of x before position.
    //!
- //! <b>Throws</b>: If memory allocation throws or x's copy constructor throws.
+ //! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment throws.
    //!
    //! <b>Complexity</b>: If position is end(), amortized constant time
    //! Linear time otherwise.
@@ -1101,15 +1124,15 @@
    //! <b>Effects</b>: Insert a copy of the [first, last) range before pos.
    //!
    //! <b>Throws</b>: If memory allocation throws, T's constructor from a
- //! dereferenced InpIt throws or T's copy constructor throws.
+ //! dereferenced InpIt throws or T's copy/move constructor/assignment throws.
    //!
    //! <b>Complexity</b>: Linear to std::distance [first, last).
    template <class InIt>
    void insert(const_iterator pos, InIt first, InIt last)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InIt, size_type>::value;
- typedef containers_detail::bool_<aux_boolean> Result;
+ const bool aux_boolean = container_detail::is_convertible<InIt, size_type>::value;
+ typedef container_detail::bool_<aux_boolean> Result;
       this->priv_insert_dispatch(pos, first, last, Result());
    }
 
@@ -1132,7 +1155,7 @@
    {
       //Destroy last element
       --this->members_.m_size;
- this->destroy(containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size);
+ this->destroy(container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size);
    }
 
    //! <b>Effects</b>: Erases the element at position pos.
@@ -1143,12 +1166,12 @@
    //! last element. Constant if pos is the last element.
    iterator erase(const_iterator position)
    {
- T *pos = containers_detail::get_pointer(position.get_ptr());
- T *beg = containers_detail::get_pointer(this->members_.m_start);
+ T *pos = container_detail::to_raw_pointer(position.get_ptr());
+ T *beg = container_detail::to_raw_pointer(this->members_.m_start);
       ::boost::move(pos + 1, beg + this->members_.m_size, pos);
       --this->members_.m_size;
       //Destroy last element
- base_t::destroy(containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size);
+ base_t::destroy(container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size);
       return iterator(position.get_ptr());
    }
 
@@ -1161,11 +1184,11 @@
    iterator erase(const_iterator first, const_iterator last)
    {
       if (first != last){ // worth doing, copy down over hole
- T* end_pos = containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size;
- T* ptr = containers_detail::get_pointer(boost::move
- (containers_detail::get_pointer(last.get_ptr())
+ T* end_pos = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
+ T* ptr = container_detail::to_raw_pointer(boost::move
+ (container_detail::to_raw_pointer(last.get_ptr())
             ,end_pos
- ,containers_detail::get_pointer(first.get_ptr())
+ ,container_detail::to_raw_pointer(first.get_ptr())
             ));
          size_type destroyed = (end_pos - ptr);
          this->destroy_n(ptr, destroyed);
@@ -1208,7 +1231,7 @@
       else{
          size_type n = new_size - this->size();
          this->reserve(new_size);
- containers_detail::default_construct_aux_proxy<T, T*, size_type> proxy(n);
+ container_detail::default_construct_aux_proxy<A, T*> proxy(this->alloc(), n);
          priv_range_insert(this->cend().get_ptr(), n, proxy);
       }
    }
@@ -1218,7 +1241,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Linear to the number of elements in the vector.
- void clear()
+ void clear() BOOST_CONTAINER_NOEXCEPT
    { this->prot_destroy_all(); }
 
    //! <b>Effects</b>: Tries to deallocate the excess of memory created
@@ -1256,7 +1279,10 @@
    {
       if (this->members_.m_size < this->members_.m_capacity){
          //There is more memory, just construct a new object at the end
- new((void*)containers_detail::get_pointer(this->members_.m_start + this->members_.m_size))value_type(::boost::forward<U>(x));
+ allocator_traits_type::construct
+ ( this->alloc()
+ , container_detail::to_raw_pointer(this->members_.m_start + this->members_.m_size)
+ , ::boost::forward<U>(x) );
          ++this->members_.m_size;
       }
       else{
@@ -1264,7 +1290,10 @@
       }
    }
 
- void priv_shrink_to_fit(allocator_v1)
+ template<class AllocVersion>
+ void priv_shrink_to_fit( AllocVersion
+ , typename container_detail::enable_if_c<
+ container_detail::is_same<AllocVersion, allocator_v1>::value >::type * = 0)
    {
       if(this->members_.m_capacity){
          if(!size()){
@@ -1278,16 +1307,16 @@
                   (allocate_new, this->size(), this->size(), real_cap, this->members_.m_start);
             if(real_cap < this->capacity()){
                //We will reuse insert code, so create a dummy input iterator
- T *dummy_it(containers_detail::get_pointer(this->members_.m_start));
- containers_detail::advanced_insert_aux_proxy<T, boost::move_iterator<T*>, T*>
- proxy(::boost::make_move_iterator(dummy_it), ::boost::make_move_iterator(dummy_it));
- #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+ T *dummy_it(container_detail::to_raw_pointer(this->members_.m_start));
+ container_detail::advanced_insert_aux_proxy<A, boost::move_iterator<T*>, T*>
+ proxy(this->alloc(), ::boost::make_move_iterator(dummy_it), ::boost::make_move_iterator(dummy_it));
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
                ++this->num_alloc;
                #endif
                this->priv_range_insert_new_allocation
- ( containers_detail::get_pointer(ret.first)
+ ( container_detail::to_raw_pointer(ret.first)
                   , real_cap
- , containers_detail::get_pointer(this->members_.m_start)
+ , container_detail::to_raw_pointer(this->members_.m_start)
                   , 0
                   , proxy);
             }
@@ -1298,7 +1327,10 @@
       }
    }
 
- void priv_shrink_to_fit(allocator_v2)
+ template<class AllocVersion>
+ void priv_shrink_to_fit(AllocVersion
+ , typename container_detail::enable_if_c<
+ container_detail::is_same<AllocVersion, allocator_v2>::value >::type * = 0)
    {
       if(this->members_.m_capacity){
          if(!size()){
@@ -1311,7 +1343,7 @@
                , this->capacity(), this->size()
                , received_size, this->members_.m_start).first){
                this->members_.m_capacity = received_size;
- #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
                ++this->num_shrink;
                #endif
             }
@@ -1324,7 +1356,7 @@
    {
       if(first != last){
          const size_type n = std::distance(first, last);
- containers_detail::advanced_insert_aux_proxy<T, FwdIt, T*> proxy(first, last);
+ container_detail::advanced_insert_aux_proxy<A, FwdIt, T*> proxy(this->alloc(), first, last);
          priv_range_insert(pos.get_ptr(), n, proxy);
       }
    }
@@ -1366,33 +1398,33 @@
       
       //If we had room or we have expanded forward
       if (same_buffer_start){
- #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
          ++this->num_expand_fwd;
          #endif
          this->priv_range_insert_expand_forward
- (containers_detail::get_pointer(pos), n, interf);
+ (container_detail::to_raw_pointer(pos), n, interf);
       }
       //Backwards (and possibly forward) expansion
       else if(ret.second){
- #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
          ++this->num_expand_bwd;
          #endif
          this->priv_range_insert_expand_backwards
- ( containers_detail::get_pointer(ret.first)
+ ( container_detail::to_raw_pointer(ret.first)
             , real_cap
- , containers_detail::get_pointer(pos)
+ , container_detail::to_raw_pointer(pos)
             , n
             , interf);
       }
       //New buffer
       else{
- #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
          ++this->num_alloc;
          #endif
          this->priv_range_insert_new_allocation
- ( containers_detail::get_pointer(ret.first)
+ ( container_detail::to_raw_pointer(ret.first)
             , real_cap
- , containers_detail::get_pointer(pos)
+ , container_detail::to_raw_pointer(pos)
             , n
             , interf);
       }
@@ -1403,18 +1435,19 @@
       //n can't be 0, because there is nothing to do in that case
       if(!n) return;
       //There is enough memory
- T* old_finish = containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size;
+ T* old_finish = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
       const size_type elems_after = old_finish - pos;
 
- if (elems_after > n){
+ if (elems_after >= n){
          //New elements can be just copied.
          //Move to uninitialized memory last objects
- ::boost::uninitialized_move(old_finish - n, old_finish, old_finish);
+ ::boost::container::uninitialized_move_alloc
+ (this->alloc(), old_finish - n, old_finish, old_finish);
          this->members_.m_size += n;
          //Copy previous to last objects to the initialized end
          boost::move_backward(pos, old_finish - n, old_finish);
          //Insert new objects in the pos
- interf.copy_all_to(pos);
+ interf.copy_remaining_to(pos);
       }
       else {
          //The new elements don't fit in the [pos, end()) range. Copy
@@ -1422,11 +1455,11 @@
          interf.uninitialized_copy_some_and_update(old_finish, elems_after, false);
          this->members_.m_size += n - elems_after;
          //Copy old [pos, end()) elements to the uninitialized memory
- ::boost::uninitialized_move
- ( pos, old_finish, containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size);
+ ::boost::container::uninitialized_move_alloc
+ (this->alloc(), pos, old_finish, container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size);
          this->members_.m_size += elems_after;
          //Copy first new elements in pos
- interf.copy_all_to(pos);
+ interf.copy_remaining_to(pos);
       }
    }
 
@@ -1438,25 +1471,25 @@
       T *old_finish;
       //Anti-exception rollbacks
       typename value_traits::ArrayDeallocator scoped_alloc(new_start, this->alloc(), new_cap);
- typename value_traits::ArrayDestructor constructed_values_destroyer(new_start, 0u);
+ typename value_traits::ArrayDestructor constructed_values_destroyer(new_start, this->alloc(), 0u);
 
       //Initialize with [begin(), pos) old buffer
       //the start of the new buffer
- T *old_buffer = containers_detail::get_pointer(this->members_.m_start);
+ T *old_buffer = container_detail::to_raw_pointer(this->members_.m_start);
       if(old_buffer){
- new_finish = ::boost::uninitialized_move
- (containers_detail::get_pointer(this->members_.m_start), pos, old_finish = new_finish);
+ new_finish = ::boost::container::uninitialized_move_alloc
+ (this->alloc(), container_detail::to_raw_pointer(this->members_.m_start), pos, old_finish = new_finish);
          constructed_values_destroyer.increment_size(new_finish - old_finish);
       }
       //Initialize new objects, starting from previous point
- interf.uninitialized_copy_all_to(old_finish = new_finish);
+ interf.uninitialized_copy_remaining_to(old_finish = new_finish);
       new_finish += n;
       constructed_values_destroyer.increment_size(new_finish - old_finish);
       //Initialize from the rest of the old buffer,
       //starting from previous point
       if(old_buffer){
- new_finish = ::boost::uninitialized_move
- (pos, old_buffer + this->members_.m_size, new_finish);
+ new_finish = ::boost::container::uninitialized_move_alloc
+ (this->alloc(), pos, old_buffer + this->members_.m_size, new_finish);
          //Destroy and deallocate old elements
          //If there is allocated memory, destroy and deallocate
          if(!value_traits::trivial_dctr_after_move)
@@ -1477,7 +1510,7 @@
    {
       //n can be zero to just expand capacity
       //Backup old data
- T* old_start = containers_detail::get_pointer(this->members_.m_start);
+ T* old_start = container_detail::to_raw_pointer(this->members_.m_start);
       T* old_finish = old_start + this->members_.m_size;
       size_type old_size = this->members_.m_size;
 
@@ -1492,13 +1525,13 @@
 
       //If anything goes wrong, this object will destroy
       //all the old objects to fulfill previous vector state
- typename value_traits::OldArrayDestructor old_values_destroyer(old_start, old_size);
+ typename value_traits::OldArrayDestructor old_values_destroyer(old_start, this->alloc(), old_size);
       //Check if s_before is big enough to hold the beginning of old data + new data
       if(difference_type(s_before) >= difference_type(elemsbefore + n)){
          //Copy first old values before pos, after that the new objects
- ::boost::uninitialized_move(old_start, pos, new_start);
+ ::boost::container::uninitialized_move_alloc(this->alloc(), old_start, pos, new_start);
          this->members_.m_size = elemsbefore;
- interf.uninitialized_copy_all_to(new_start + elemsbefore);
+ interf.uninitialized_copy_remaining_to(new_start + elemsbefore);
          this->members_.m_size += n;
          //Check if s_before is so big that even copying the old data + new data
          //there is a gap between the new data and the old data
@@ -1514,8 +1547,8 @@
             //|___________|__________|_________|________________________|
             //
             //Now initialize the rest of memory with the last old values
- ::boost::uninitialized_move
- (pos, old_finish, new_start + elemsbefore + n);
+ ::boost::container::uninitialized_move_alloc
+ (this->alloc(), pos, old_finish, new_start + elemsbefore + n);
             //All new elements correctly constructed, avoid new element destruction
             this->members_.m_size = old_size + n;
             //Old values destroyed automatically with "old_values_destroyer"
@@ -1541,7 +1574,8 @@
             size_type raw_gap = s_before - (elemsbefore + n);
             //Now initialize the rest of s_before memory with the
             //first of elements after new values
- ::boost::uninitialized_move(pos, pos + raw_gap, new_start + elemsbefore + n);
+ ::boost::container::uninitialized_move_alloc
+ (this->alloc(), pos, pos + raw_gap, new_start + elemsbefore + n);
             //Update size since we have a contiguous buffer
             this->members_.m_size = old_size + s_before;
             //All new elements correctly constructed, avoid old element destruction
@@ -1606,7 +1640,8 @@
             //
             //Copy the first part of old_begin to raw_mem
             T *start_n = old_start + difference_type(s_before);
- ::boost::uninitialized_move(old_start, start_n, new_start);
+ ::boost::container::uninitialized_move_alloc
+ (this->alloc(), old_start, start_n, new_start);
             //The buffer is all constructed until old_end,
             //release destroyer and update size
             old_values_destroyer.release();
@@ -1619,7 +1654,7 @@
             }
             else{
                //Now copy the all the new elements
- interf.copy_all_to(next);
+ interf.copy_remaining_to(next);
                T* move_start = next + n;
                //Now displace old_end elements
                T* move_end = ::boost::move(pos, old_finish, move_start);
@@ -1658,7 +1693,8 @@
             //|___________|_____|_________|__________________________|
             //
             //First copy whole old_begin and part of new to raw_mem
- ::boost::uninitialized_move(old_start, pos, new_start);
+ ::boost::container::uninitialized_move_alloc
+ (this->alloc(), old_start, pos, new_start);
             this->members_.m_size = elemsbefore;
 
             const size_type mid_n = difference_type(s_before) - elemsbefore;
@@ -1674,7 +1710,7 @@
             }
             else{
                //Copy all new elements
- interf.copy_all_to(old_start);
+ interf.copy_remaining_to(old_start);
                T* move_start = old_start + (n-mid_n);
                //Displace old_end
                T* move_end = ::boost::move(pos, old_finish, move_start);
@@ -1728,13 +1764,14 @@
                //
                //First copy the part of old_end raw_mem
                T* finish_n = old_finish - difference_type(n_after);
- ::boost::uninitialized_move(finish_n, old_finish, old_finish);
+ ::boost::container::uninitialized_move_alloc
+ (this->alloc(), finish_n, old_finish, old_finish);
                this->members_.m_size += n_after;
                //Displace the rest of old_end to the new position
                boost::move_backward(pos, finish_n, old_finish);
                //Now overwrite with new_end
                //The new_end part is [first + (n - n_after), last)
- interf.copy_all_to(pos);
+ interf.copy_remaining_to(pos);
             }
             else {
                //The raw_mem from end will divide new_end part
@@ -1754,10 +1791,11 @@
                //The new_end part is [first + (n - n_after), last)
                interf.uninitialized_copy_some_and_update(old_finish, elemsafter, false);
                this->members_.m_size += mid_last_dist;
- ::boost::uninitialized_move(pos, old_finish, old_finish + mid_last_dist);
+ ::boost::container::uninitialized_move_alloc
+ (this->alloc(), pos, old_finish, old_finish + mid_last_dist);
                this->members_.m_size += n_after - mid_last_dist;
                //Now copy the part of new_end over constructed elements
- interf.copy_all_to(pos);
+ interf.copy_remaining_to(pos);
             }
          }
       }
@@ -1812,7 +1850,7 @@
       }
       
       if(same_buffer_start){
- T *start = containers_detail::get_pointer(this->members_.m_start);
+ T *start = container_detail::to_raw_pointer(this->members_.m_start);
          if (this->size() >= n){
             //There is memory, but there are more old elements than new ones
             //Overwrite old elements with new ones
@@ -1829,19 +1867,17 @@
             // iG T *end = std::copy(first, mid, start);
             T *end = std::copy(first, mid, start);
             //Initialize the remaining new elements in the uninitialized memory
- // iG std::uninitialized_copy(mid, last, end);
- ::boost::uninitialized_copy_or_move(mid, last, end);
+ ::boost::container::uninitialized_copy_or_move_alloc(this->alloc(), mid, last, end);
             this->members_.m_size = n;
          }
       }
       else if(!ret.second){
          typename value_traits::ArrayDeallocator scoped_alloc(ret.first, this->alloc(), real_cap);
- // iG std::uninitialized_copy(first, last, containers_detail::get_pointer(ret.first));
- ::boost::uninitialized_copy_or_move(first, last, containers_detail::get_pointer(ret.first));
+ ::boost::container::uninitialized_copy_or_move_alloc(this->alloc(), first, last, container_detail::to_raw_pointer(ret.first));
          scoped_alloc.release();
          //Destroy and deallocate old buffer
          if(this->members_.m_start != 0){
- this->destroy_n(containers_detail::get_pointer(this->members_.m_start), this->members_.m_size);
+ this->destroy_n(container_detail::to_raw_pointer(this->members_.m_start), this->members_.m_size);
             this->alloc().deallocate(this->members_.m_start, this->members_.m_capacity);
          }
          this->members_.m_start = ret.first;
@@ -1851,9 +1887,9 @@
       else{
          //Backwards expansion
          //If anything goes wrong, this object will destroy old objects
- T *old_start = containers_detail::get_pointer(this->members_.m_start);
+ T *old_start = container_detail::to_raw_pointer(this->members_.m_start);
          size_type old_size = this->members_.m_size;
- typename value_traits::OldArrayDestructor old_values_destroyer(old_start, old_size);
+ typename value_traits::OldArrayDestructor old_values_destroyer(old_start, this->alloc(), old_size);
          //If something goes wrong size will be 0
          //but holding the whole buffer
          this->members_.m_size = 0;
@@ -1861,13 +1897,13 @@
          this->members_.m_capacity = real_cap;
          
          //Backup old buffer data
- size_type old_offset = old_start - containers_detail::get_pointer(ret.first);
- size_type first_count = containers_detail::min_value(n, old_offset);
+ size_type old_offset = old_start - container_detail::to_raw_pointer(ret.first);
+ size_type first_count = container_detail::min_value(n, old_offset);
 
          FwdIt mid = first;
          std::advance(mid, first_count);
- // iG std::uninitialized_copy(first, mid, containers_detail::get_pointer(ret.first));
- ::boost::uninitialized_copy_or_move(first, mid, containers_detail::get_pointer(ret.first));
+ ::boost::container::uninitialized_copy_or_move_alloc
+ (this->alloc(), first, mid, container_detail::to_raw_pointer(ret.first));
 
          if(old_offset > n){
             //All old elements will be destroyed by "old_values_destroyer"
@@ -1880,7 +1916,7 @@
             this->members_.m_start = ret.first;
             this->members_.m_size = first_count + old_size;
             //Now overwrite the old values
- size_type second_count = containers_detail::min_value(old_size, n - first_count);
+ size_type second_count = container_detail::min_value(old_size, n - first_count);
             FwdIt mid2 = mid;
             std::advance(mid2, second_count);
             // iG std::copy(mid, mid2, old_start);
@@ -1904,11 +1940,11 @@
    }
 
    template <class Integer>
- void priv_assign_dispatch(Integer n, Integer val, containers_detail::true_)
+ void priv_assign_dispatch(Integer n, Integer val, container_detail::true_)
    { this->assign((size_type) n, (value_type)val); }
 
    template <class InIt>
- void priv_assign_dispatch(InIt first, InIt last, containers_detail::false_)
+ void priv_assign_dispatch(InIt first, InIt last, container_detail::false_)
    {
       //Dispatch depending on integer/iterator
       typedef typename std::iterator_traits<InIt>::iterator_category ItCat;
@@ -1916,12 +1952,12 @@
    }
 
    template <class Integer>
- void priv_insert_dispatch(const_iterator pos, Integer n, Integer val, containers_detail::true_)
+ void priv_insert_dispatch(const_iterator pos, Integer n, Integer val, container_detail::true_)
    { this->insert(pos, (size_type)n, (T)val); }
 
    template <class InIt>
    void priv_insert_dispatch(const_iterator pos, InIt first,
- InIt last, containers_detail::false_)
+ InIt last, container_detail::false_)
    {
       //Dispatch depending on integer/iterator
       typedef typename std::iterator_traits<InIt>::iterator_category ItCat;
@@ -1935,7 +1971,7 @@
          throw std::out_of_range("vector::at");
    }
 
- #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
    public:
    unsigned int num_expand_fwd;
    unsigned int num_expand_bwd;
@@ -1998,5 +2034,5 @@
 
 #include <boost/container/detail/config_end.hpp>
 
-#endif // #ifndef BOOST_CONTAINERS_CONTAINERS_VECTOR_HPP
+#endif // #ifndef BOOST_CONTAINER_CONTAINER_VECTOR_HPP
 

Modified: trunk/boost/interprocess/allocators/adaptive_pool.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/adaptive_pool.hpp (original)
+++ trunk/boost/interprocess/allocators/adaptive_pool.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -96,7 +96,7 @@
    typedef typename segment_manager::difference_type difference_type;
 
    typedef boost::interprocess::version_type<adaptive_pool_base, Version> version;
- typedef boost::container::containers_detail::transform_multiallocation_chain
+ typedef boost::container::container_detail::transform_multiallocation_chain
       <typename SegmentManager::multiallocation_chain, T>multiallocation_chain;
 
    //!Obtains adaptive_pool_base from
@@ -128,7 +128,7 @@
    adaptive_pool_base(const adaptive_pool_base &other)
       : mp_node_pool(other.get_node_pool())
    {
- node_pool<0>::get(ipcdetail::get_pointer(mp_node_pool))->inc_ref_count();
+ node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->inc_ref_count();
    }
 
    //!Assignment from other adaptive_pool_base
@@ -150,17 +150,17 @@
    //!Destructor, removes node_pool_t from memory
    //!if its reference count reaches to zero. Never throws
    ~adaptive_pool_base()
- { ipcdetail::destroy_node_pool_if_last_link(node_pool<0>::get(ipcdetail::get_pointer(mp_node_pool))); }
+ { ipcdetail::destroy_node_pool_if_last_link(node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))); }
 
    //!Returns a pointer to the node pool.
    //!Never throws
    void* get_node_pool() const
- { return ipcdetail::get_pointer(mp_node_pool); }
+ { return ipcdetail::to_raw_pointer(mp_node_pool); }
 
    //!Returns the segment manager.
    //!Never throws
    segment_manager* get_segment_manager()const
- { return node_pool<0>::get(ipcdetail::get_pointer(mp_node_pool))->get_segment_manager(); }
+ { return node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->get_segment_manager(); }
 
    //!Swaps allocators. Does not throw. If each allocator is placed in a
    //!different memory segment, the result is undefined.
@@ -372,7 +372,7 @@
    //!Returns address of non mutable object.
    //!Never throws
    const_pointer address(const_reference value) const;
-
+/*
    //!Copy construct an object.
    //!Throws if T's copy constructor throws
    void construct(const pointer &ptr, const_reference v);
@@ -380,7 +380,7 @@
    //!Destroys object. Throws if object's
    //!destructor throws
    void destroy(const pointer &ptr);
-
+*/
    //!Returns maximum the number of objects the previously allocated memory
    //!pointed by p can hold. This size only works for memory allocated with
    //!allocate, allocation_command and allocate_many.

Modified: trunk/boost/interprocess/allocators/allocator.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/allocator.hpp (original)
+++ trunk/boost/interprocess/allocators/allocator.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -32,6 +32,7 @@
 #include <boost/interprocess/detail/type_traits.hpp>
 
 #include <memory>
+#include <new>
 #include <algorithm>
 #include <cstddef>
 #include <stdexcept>
@@ -103,7 +104,7 @@
    /// @cond
 
    //Experimental. Don't use.
- typedef boost::container::containers_detail::transform_multiallocation_chain
+ typedef boost::container::container_detail::transform_multiallocation_chain
       <typename SegmentManager::multiallocation_chain, T>multiallocation_chain;
    /// @endcond
 
@@ -118,7 +119,7 @@
    //!Returns the segment manager.
    //!Never throws
    segment_manager* get_segment_manager()const
- { return ipcdetail::get_pointer(mp_mngr); }
+ { return ipcdetail::to_raw_pointer(mp_mngr); }
 
    //!Constructor from the segment manager.
    //!Never throws
@@ -149,7 +150,7 @@
    //!Deallocates memory previously allocated.
    //!Never throws
    void deallocate(const pointer &ptr, size_type)
- { mp_mngr->deallocate((void*)ipcdetail::get_pointer(ptr)); }
+ { mp_mngr->deallocate((void*)ipcdetail::to_raw_pointer(ptr)); }
 
    //!Returns the number of elements that could be allocated.
    //!Never throws
@@ -166,7 +167,7 @@
    //!allocate, allocation_command and allocate_many.
    size_type size(const pointer &p) const
    {
- return (size_type)mp_mngr->size(ipcdetail::get_pointer(p))/sizeof(T);
+ return (size_type)mp_mngr->size(ipcdetail::to_raw_pointer(p))/sizeof(T);
    }
 
    std::pair<pointer, bool>
@@ -176,7 +177,7 @@
                          size_type &received_size, const pointer &reuse = 0)
    {
       return mp_mngr->allocation_command
- (command, limit_size, preferred_size, received_size, ipcdetail::get_pointer(reuse));
+ (command, limit_size, preferred_size, received_size, ipcdetail::to_raw_pointer(reuse));
    }
 
    //!Allocates many elements of size elem_size in a contiguous block
@@ -240,7 +241,7 @@
    //!will be assigned to received_size. Memory allocated with this function
    //!must be deallocated only with deallocate_one().
    void deallocate_individual(multiallocation_chain chain)
- { return this->deallocate_many(boost::interprocess::move(chain)); }
+ { return this->deallocate_many(boost::move(chain)); }
 
    //!Returns address of mutable object.
    //!Never throws
@@ -252,20 +253,18 @@
    const_pointer address(const_reference value) const
    { return const_pointer(boost::addressof(value)); }
 
- //!Copy construct an object
- //!Throws if T's copy constructor throws
- void construct(const pointer &ptr, const_reference v)
- { new((void*)ipcdetail::get_pointer(ptr)) value_type(v); }
-
- //!Default construct an object.
- //!Throws if T's default constructor throws
- void construct(const pointer &ptr)
- { new((void*)ipcdetail::get_pointer(ptr)) value_type; }
+ //!Constructs an object
+ //!Throws if T's constructor throws
+ //!For backwards compatibility with libraries using C++03 allocators
+ template<class P>
+ void construct(const pointer &ptr, BOOST_FWD_REF(P) p)
+ { ::new((void*)ipcdetail::to_raw_pointer(ptr)) value_type(::boost::forward<P>(p)); }
 
    //!Destroys object. Throws if object's
    //!destructor throws
    void destroy(const pointer &ptr)
    { BOOST_ASSERT(ptr != 0); (*ptr).~value_type(); }
+
 };
 
 //!Equality test for same type
@@ -293,7 +292,7 @@
 struct has_trivial_destructor
    <boost::interprocess::allocator <T, SegmentManager> >
 {
- enum { value = true };
+ static const bool value = true;
 };
 /// @endcond
 

Modified: trunk/boost/interprocess/allocators/cached_adaptive_pool.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/cached_adaptive_pool.hpp (original)
+++ trunk/boost/interprocess/allocators/cached_adaptive_pool.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //

Modified: trunk/boost/interprocess/allocators/cached_node_allocator.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/cached_node_allocator.hpp (original)
+++ trunk/boost/interprocess/allocators/cached_node_allocator.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //

Modified: trunk/boost/interprocess/allocators/detail/adaptive_node_pool.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/detail/adaptive_node_pool.hpp (original)
+++ trunk/boost/interprocess/allocators/detail/adaptive_node_pool.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -45,10 +45,10 @@
         , unsigned char OverheadPercent
>
 class private_adaptive_node_pool
- : public boost::container::containers_detail::private_adaptive_node_pool_impl
+ : public boost::container::container_detail::private_adaptive_node_pool_impl
          <typename SegmentManager::segment_manager_base_type>
 {
- typedef boost::container::containers_detail::private_adaptive_node_pool_impl
+ typedef boost::container::container_detail::private_adaptive_node_pool_impl
       <typename SegmentManager::segment_manager_base_type> base_t;
    //Non-copyable
    private_adaptive_node_pool();

Modified: trunk/boost/interprocess/allocators/detail/allocator_common.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/detail/allocator_common.hpp (original)
+++ trunk/boost/interprocess/allocators/detail/allocator_common.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -17,22 +17,21 @@
 #include <boost/pointer_to_other.hpp>
 
 #include <boost/interprocess/interprocess_fwd.hpp>
-#include <boost/interprocess/detail/utilities.hpp> //get_pointer
-#include <utility> //std::pair
+#include <boost/interprocess/detail/utilities.hpp> //to_raw_pointer
 #include <boost/utility/addressof.hpp> //boost::addressof
 #include <boost/assert.hpp> //BOOST_ASSERT
-#include <boost/assert.hpp>
 #include <boost/interprocess/exceptions.hpp> //bad_alloc
 #include <boost/interprocess/sync/scoped_lock.hpp> //scoped_lock
 #include <boost/interprocess/containers/allocation_type.hpp> //boost::interprocess::allocation_type
 #include <boost/container/detail/multiallocation_chain.hpp>
 #include <boost/interprocess/mem_algo/detail/mem_algo_common.hpp>
 #include <boost/interprocess/detail/segment_manager_helper.hpp>
-#include <algorithm> //std::swap
-#include <boost/interprocess/detail/move.hpp>
-
+#include <boost/move/move.hpp>
 #include <boost/interprocess/detail/type_traits.hpp>
 #include <boost/interprocess/detail/utilities.hpp>
+#include <algorithm> //std::swap
+#include <utility> //std::pair
+#include <new>
 
 namespace boost {
 namespace interprocess {
@@ -173,11 +172,11 @@
    ~cache_impl()
    {
       this->deallocate_all_cached_nodes();
- ipcdetail::destroy_node_pool_if_last_link(ipcdetail::get_pointer(mp_node_pool));
+ ipcdetail::destroy_node_pool_if_last_link(ipcdetail::to_raw_pointer(mp_node_pool));
    }
 
    NodePool *get_node_pool() const
- { return ipcdetail::get_pointer(mp_node_pool); }
+ { return ipcdetail::to_raw_pointer(mp_node_pool); }
 
    segment_manager *get_segment_manager() const
    { return mp_node_pool->get_segment_manager(); }
@@ -191,7 +190,7 @@
       if(m_cached_nodes.empty()){
          m_cached_nodes = mp_node_pool->allocate_nodes(m_max_cached_nodes/2);
       }
- void *ret = ipcdetail::get_pointer(m_cached_nodes.front());
+ void *ret = ipcdetail::to_raw_pointer(m_cached_nodes.front());
       m_cached_nodes.pop_front();
       return ret;
    }
@@ -203,7 +202,7 @@
       BOOST_TRY{
          //If don't have any cached node, we have to get a new list of free nodes from the pool
          while(!m_cached_nodes.empty() && count--){
- void *ret = ipcdetail::get_pointer(m_cached_nodes.front());
+ void *ret = ipcdetail::to_raw_pointer(m_cached_nodes.front());
             m_cached_nodes.pop_front();
             chain.push_back(ret);
             ++allocated;
@@ -213,10 +212,10 @@
             multiallocation_chain chain2(mp_node_pool->allocate_nodes(n - allocated));
             chain.splice_after(chain.last(), chain2, chain2.before_begin(), chain2.last(), n - allocated);
          }
- return boost::interprocess::move(chain);
+ return boost::move(chain);
       }
       BOOST_CATCH(...){
- this->cached_deallocation(boost::interprocess::move(chain));
+ this->cached_deallocation(boost::move(chain));
          BOOST_RETHROW
       }
       BOOST_CATCH_END
@@ -262,7 +261,7 @@
    void deallocate_all_cached_nodes()
    {
       if(m_cached_nodes.empty()) return;
- mp_node_pool->deallocate_nodes(boost::interprocess::move(m_cached_nodes));
+ mp_node_pool->deallocate_nodes(boost::move(m_cached_nodes));
    }
 
    private:
@@ -290,7 +289,7 @@
       multiallocation_chain chain;
       chain.splice_after(chain.before_begin(), m_cached_nodes, m_cached_nodes.before_begin(), it, n);
       //Deallocate all new linked list at once
- mp_node_pool->deallocate_nodes(boost::interprocess::move(chain));
+ mp_node_pool->deallocate_nodes(boost::move(chain));
    }
 
    public:
@@ -324,7 +323,7 @@
                      <const value_type>::type const_reference;
    typedef typename SegmentManager::size_type size_type;
    typedef typename SegmentManager::difference_type difference_type;
- typedef boost::container::containers_detail::transform_multiallocation_chain
+ typedef boost::container::container_detail::transform_multiallocation_chain
       <typename SegmentManager::multiallocation_chain, T>multiallocation_chain;
 
 
@@ -334,7 +333,7 @@
    //!allocate, allocation_command and allocate_many.
    size_type size(const pointer &p) const
    {
- return (size_type)this->derived()->get_segment_manager()->size(ipcdetail::get_pointer(p))/sizeof(T);
+ return (size_type)this->derived()->get_segment_manager()->size(ipcdetail::to_raw_pointer(p))/sizeof(T);
    }
 
    std::pair<pointer, bool>
@@ -344,7 +343,7 @@
                          size_type &received_size, const pointer &reuse = 0)
    {
       return this->derived()->get_segment_manager()->allocation_command
- (command, limit_size, preferred_size, received_size, ipcdetail::get_pointer(reuse));
+ (command, limit_size, preferred_size, received_size, ipcdetail::to_raw_pointer(reuse));
    }
 
    //!Allocates many elements of size elem_size in a contiguous block
@@ -373,7 +372,7 @@
    //!will be assigned to received_size. The elements must be deallocated
    //!with deallocate(...)
    void deallocate_many(multiallocation_chain chain)
- { return this->derived()->get_segment_manager()->deallocate_many(boost::interprocess::move(chain)); }
+ { return this->derived()->get_segment_manager()->deallocate_many(boost::move(chain)); }
 
    //!Returns the number of elements that could be
    //!allocated. Never throws
@@ -390,15 +389,12 @@
    const_pointer address(const_reference value) const
    { return const_pointer(boost::addressof(value)); }
 
- //!Default construct an object.
- //!Throws if T's default constructor throws
- void construct(const pointer &ptr)
- { new((void*)ipcdetail::get_pointer(ptr)) value_type; }
-
- //!Copy construct an object
- //!Throws if T's copy constructor throws
- void construct(const pointer &ptr, const_reference v)
- { new((void*)ipcdetail::get_pointer(ptr)) value_type(v); }
+ //!Constructs an object
+ //!Throws if T's constructor throws
+ //!For backwards compatibility with libraries using C++03 allocators
+ template<class P>
+ void construct(const pointer &ptr, BOOST_FWD_REF(P) p)
+ { ::new((void*)ipcdetail::to_raw_pointer(ptr)) value_type(::boost::forward<P>(p)); }
 
    //!Destroys object. Throws if object's
    //!destructor throws
@@ -435,7 +431,7 @@
                      <const value_type>::type const_reference;
    typedef typename SegmentManager::size_type size_type;
    typedef typename SegmentManager::difference_type difference_type;
- typedef boost::container::containers_detail::transform_multiallocation_chain
+ typedef boost::container::container_detail::transform_multiallocation_chain
       <typename SegmentManager::multiallocation_chain, T>multiallocation_chain;
 
 
@@ -472,9 +468,9 @@
       typedef typename node_pool<0>::type node_pool_t;
       node_pool_t *pool = node_pool<0>::get(this->derived()->get_node_pool());
       if(Version == 1 && count == 1)
- pool->deallocate_node(ipcdetail::get_pointer(ptr));
+ pool->deallocate_node(ipcdetail::to_raw_pointer(ptr));
       else
- pool->get_segment_manager()->deallocate((void*)ipcdetail::get_pointer(ptr));
+ pool->get_segment_manager()->deallocate((void*)ipcdetail::to_raw_pointer(ptr));
    }
 
    //!Allocates just one object. Memory allocated with this function
@@ -507,7 +503,7 @@
    {
       typedef typename node_pool<0>::type node_pool_t;
       node_pool_t *pool = node_pool<0>::get(this->derived()->get_node_pool());
- pool->deallocate_node(ipcdetail::get_pointer(p));
+ pool->deallocate_node(ipcdetail::to_raw_pointer(p));
    }
 
    //!Allocates many elements of size == 1 in a contiguous block
@@ -556,7 +552,7 @@
    typedef typename base_t::value_type value_type;
 
    public:
- enum { DEFAULT_MAX_CACHED_NODES = 64 };
+ static const std::size_t DEFAULT_MAX_CACHED_NODES = 64;
 
    cached_allocator_impl(segment_manager *segment_mngr, size_type max_cached_nodes)
       : m_cache(segment_mngr, max_cached_nodes)
@@ -618,10 +614,10 @@
    {
       (void)count;
       if(Version == 1 && count == 1){
- m_cache.cached_deallocation(ipcdetail::get_pointer(ptr));
+ m_cache.cached_deallocation(ipcdetail::to_raw_pointer(ptr));
       }
       else{
- this->get_segment_manager()->deallocate((void*)ipcdetail::get_pointer(ptr));
+ this->get_segment_manager()->deallocate((void*)ipcdetail::to_raw_pointer(ptr));
       }
    }
 
@@ -644,7 +640,7 @@
    //!You should never use deallocate_one to deallocate memory allocated
    //!with other functions different from allocate_one(). Never throws
    void deallocate_one(const pointer &p)
- { this->m_cache.cached_deallocation(ipcdetail::get_pointer(p)); }
+ { this->m_cache.cached_deallocation(ipcdetail::to_raw_pointer(p)); }
 
    //!Allocates many elements of size == 1 in a contiguous block
    //!of memory. The minimum number to be allocated is min_elements,
@@ -656,7 +652,7 @@
    {
       typename node_pool_t::multiallocation_chain mem
          (chain.extract_multiallocation_chain());
- m_cache.cached_deallocation(boost::interprocess::move(mem));
+ m_cache.cached_deallocation(boost::move(mem));
    }
 
    //!Deallocates all free blocks of the pool
@@ -778,7 +774,7 @@
       //-----------------------
       boost::interprocess::scoped_lock<mutex_type> guard(m_header);
       //-----------------------
- private_node_allocator_t::deallocate_nodes(boost::interprocess::move(chain));
+ private_node_allocator_t::deallocate_nodes(boost::move(chain));
    }
 
    //!Deallocates all the free blocks of memory. Never throws

Modified: trunk/boost/interprocess/allocators/detail/node_pool.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/detail/node_pool.hpp (original)
+++ trunk/boost/interprocess/allocators/detail/node_pool.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -44,10 +44,10 @@
 template< class SegmentManager, std::size_t NodeSize, std::size_t NodesPerBlock >
 class private_node_pool
    //Inherit from the implementation to avoid template bloat
- : public boost::container::containers_detail::
+ : public boost::container::container_detail::
          private_node_pool_impl<typename SegmentManager::segment_manager_base_type>
 {
- typedef boost::container::containers_detail::private_node_pool_impl
+ typedef boost::container::container_detail::private_node_pool_impl
       <typename SegmentManager::segment_manager_base_type> base_t;
    //Non-copyable
    private_node_pool();

Modified: trunk/boost/interprocess/allocators/detail/node_tools.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/detail/node_tools.hpp (original)
+++ trunk/boost/interprocess/allocators/detail/node_tools.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2007-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2007-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)
 //

Modified: trunk/boost/interprocess/allocators/node_allocator.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/node_allocator.hpp (original)
+++ trunk/boost/interprocess/allocators/node_allocator.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -93,7 +93,7 @@
    typedef typename segment_manager::difference_type difference_type;
 
    typedef boost::interprocess::version_type<node_allocator_base, Version> version;
- typedef boost::container::containers_detail::transform_multiallocation_chain
+ typedef boost::container::container_detail::transform_multiallocation_chain
       <typename SegmentManager::multiallocation_chain, T>multiallocation_chain;
 
    //!Obtains node_allocator_base from
@@ -127,7 +127,7 @@
    node_allocator_base(const node_allocator_base &other)
       : mp_node_pool(other.get_node_pool())
    {
- node_pool<0>::get(ipcdetail::get_pointer(mp_node_pool))->inc_ref_count();
+ node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->inc_ref_count();
    }
 
    //!Copy constructor from related node_allocator_base. If not present, constructs
@@ -149,17 +149,17 @@
    //!Destructor, removes node_pool_t from memory
    //!if its reference count reaches to zero. Never throws
    ~node_allocator_base()
- { ipcdetail::destroy_node_pool_if_last_link(node_pool<0>::get(ipcdetail::get_pointer(mp_node_pool))); }
+ { ipcdetail::destroy_node_pool_if_last_link(node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))); }
 
    //!Returns a pointer to the node pool.
    //!Never throws
    void* get_node_pool() const
- { return ipcdetail::get_pointer(mp_node_pool); }
+ { return ipcdetail::to_raw_pointer(mp_node_pool); }
 
    //!Returns the segment manager.
    //!Never throws
    segment_manager* get_segment_manager()const
- { return node_pool<0>::get(ipcdetail::get_pointer(mp_node_pool))->get_segment_manager(); }
+ { return node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->get_segment_manager(); }
 
    //!Swaps allocators. Does not throw. If each allocator is placed in a
    //!different memory segment, the result is undefined.

Modified: trunk/boost/interprocess/allocators/private_adaptive_pool.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/private_adaptive_pool.hpp (original)
+++ trunk/boost/interprocess/allocators/private_adaptive_pool.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -94,7 +94,7 @@
    typedef typename segment_manager::size_type difference_type;
    typedef boost::interprocess::version_type
       <private_adaptive_pool_base, Version> version;
- typedef boost::container::containers_detail::transform_multiallocation_chain
+ typedef boost::container::container_detail::transform_multiallocation_chain
       <typename SegmentManager::multiallocation_chain, T>multiallocation_chain;
 
    //!Obtains node_allocator from other node_allocator

Modified: trunk/boost/interprocess/allocators/private_node_allocator.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/private_node_allocator.hpp (original)
+++ trunk/boost/interprocess/allocators/private_node_allocator.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -88,7 +88,7 @@
    typedef typename segment_manager::difference_type difference_type;
    typedef boost::interprocess::version_type
       <private_node_allocator_base, Version> version;
- typedef boost::container::containers_detail::transform_multiallocation_chain
+ typedef boost::container::container_detail::transform_multiallocation_chain
       <typename SegmentManager::multiallocation_chain, T>multiallocation_chain;
 
    //!Obtains node_allocator from other node_allocator

Modified: trunk/boost/interprocess/anonymous_shared_memory.hpp
==============================================================================
--- trunk/boost/interprocess/anonymous_shared_memory.hpp (original)
+++ trunk/boost/interprocess/anonymous_shared_memory.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -14,7 +14,7 @@
 #include <boost/interprocess/detail/config_begin.hpp>
 #include <boost/interprocess/detail/workaround.hpp>
 #include <boost/interprocess/creation_tags.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/interprocess/interprocess_fwd.hpp>
 #include <boost/interprocess/mapped_region.hpp>
 #include <cstddef>

Modified: trunk/boost/interprocess/containers/allocation_type.hpp
==============================================================================
--- trunk/boost/interprocess/containers/allocation_type.hpp (original)
+++ trunk/boost/interprocess/containers/allocation_type.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //

Modified: trunk/boost/interprocess/containers/deque.hpp
==============================================================================
--- trunk/boost/interprocess/containers/deque.hpp (original)
+++ trunk/boost/interprocess/containers/deque.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //

Modified: trunk/boost/interprocess/containers/flat_map.hpp
==============================================================================
--- trunk/boost/interprocess/containers/flat_map.hpp (original)
+++ trunk/boost/interprocess/containers/flat_map.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //

Modified: trunk/boost/interprocess/containers/flat_set.hpp
==============================================================================
--- trunk/boost/interprocess/containers/flat_set.hpp (original)
+++ trunk/boost/interprocess/containers/flat_set.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //

Modified: trunk/boost/interprocess/containers/list.hpp
==============================================================================
--- trunk/boost/interprocess/containers/list.hpp (original)
+++ trunk/boost/interprocess/containers/list.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //

Modified: trunk/boost/interprocess/containers/map.hpp
==============================================================================
--- trunk/boost/interprocess/containers/map.hpp (original)
+++ trunk/boost/interprocess/containers/map.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //

Modified: trunk/boost/interprocess/containers/pair.hpp
==============================================================================
--- trunk/boost/interprocess/containers/pair.hpp (original)
+++ trunk/boost/interprocess/containers/pair.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //
@@ -22,8 +22,8 @@
 namespace boost {
 namespace interprocess {
 
-using boost::container::containers_detail::pair;
-using boost::container::containers_detail::piecewise_construct;
+using boost::container::container_detail::pair;
+using boost::container::container_detail::piecewise_construct;
 
 } //namespace interprocess {
 } //namespace boost {

Modified: trunk/boost/interprocess/containers/set.hpp
==============================================================================
--- trunk/boost/interprocess/containers/set.hpp (original)
+++ trunk/boost/interprocess/containers/set.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //

Modified: trunk/boost/interprocess/containers/slist.hpp
==============================================================================
--- trunk/boost/interprocess/containers/slist.hpp (original)
+++ trunk/boost/interprocess/containers/slist.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //

Modified: trunk/boost/interprocess/containers/stable_vector.hpp
==============================================================================
--- trunk/boost/interprocess/containers/stable_vector.hpp (original)
+++ trunk/boost/interprocess/containers/stable_vector.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //

Modified: trunk/boost/interprocess/containers/string.hpp
==============================================================================
--- trunk/boost/interprocess/containers/string.hpp (original)
+++ trunk/boost/interprocess/containers/string.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //

Modified: trunk/boost/interprocess/containers/vector.hpp
==============================================================================
--- trunk/boost/interprocess/containers/vector.hpp (original)
+++ trunk/boost/interprocess/containers/vector.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //

Modified: trunk/boost/interprocess/containers/version_type.hpp
==============================================================================
--- trunk/boost/interprocess/containers/version_type.hpp (original)
+++ trunk/boost/interprocess/containers/version_type.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //
@@ -21,8 +21,8 @@
 namespace boost {
 namespace interprocess {
 
-using boost::container::containers_detail::version_type;
-using boost::container::containers_detail::version;
+using boost::container::container_detail::version_type;
+using boost::container::container_detail::version;
 
 } //namespace interprocess {
 } //namespace boost {

Modified: trunk/boost/interprocess/creation_tags.hpp
==============================================================================
--- trunk/boost/interprocess/creation_tags.hpp (original)
+++ trunk/boost/interprocess/creation_tags.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //

Modified: trunk/boost/interprocess/detail/atomic.hpp
==============================================================================
--- trunk/boost/interprocess/detail/atomic.hpp (original)
+++ trunk/boost/interprocess/detail/atomic.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2011
 // (C) Copyright Markus Schoepflin 2007
 // (C) Copyright Bryce Lelbach 2010
 //

Modified: trunk/boost/interprocess/detail/cast_tags.hpp
==============================================================================
--- trunk/boost/interprocess/detail/cast_tags.hpp (original)
+++ trunk/boost/interprocess/detail/cast_tags.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //

Modified: trunk/boost/interprocess/detail/config_begin.hpp
==============================================================================
--- trunk/boost/interprocess/detail/config_begin.hpp (original)
+++ trunk/boost/interprocess/detail/config_begin.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //

Modified: trunk/boost/interprocess/detail/config_end.hpp
==============================================================================
--- trunk/boost/interprocess/detail/config_end.hpp (original)
+++ trunk/boost/interprocess/detail/config_end.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //

Modified: trunk/boost/interprocess/detail/file_wrapper.hpp
==============================================================================
--- trunk/boost/interprocess/detail/file_wrapper.hpp (original)
+++ trunk/boost/interprocess/detail/file_wrapper.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -15,7 +15,7 @@
 #include <boost/interprocess/detail/workaround.hpp>
 #include <boost/interprocess/detail/os_file_functions.hpp>
 #include <boost/interprocess/creation_tags.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/interprocess/creation_tags.hpp>
 
 namespace boost {
@@ -61,7 +61,7 @@
    //!Does not throw
    file_wrapper &operator=(BOOST_RV_REF(file_wrapper) moved)
    {
- file_wrapper tmp(boost::interprocess::move(moved));
+ file_wrapper tmp(boost::move(moved));
       this->swap(tmp);
       return *this;
    }

Modified: trunk/boost/interprocess/detail/in_place_interface.hpp
==============================================================================
--- trunk/boost/interprocess/detail/in_place_interface.hpp (original)
+++ trunk/boost/interprocess/detail/in_place_interface.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //

Modified: trunk/boost/interprocess/detail/intermodule_singleton.hpp
==============================================================================
--- trunk/boost/interprocess/detail/intermodule_singleton.hpp (original)
+++ trunk/boost/interprocess/detail/intermodule_singleton.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2009-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2009-2011. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -18,10 +18,22 @@
 #include <boost/interprocess/detail/config_begin.hpp>
 #include <boost/interprocess/detail/workaround.hpp>
 
-#include <boost/interprocess/managed_shared_memory.hpp>
-#ifdef BOOST_INTERPROCESS_WINDOWS
-#include <boost/interprocess/managed_windows_shared_memory.hpp>
+#if defined(BOOST_INTERPROCESS_WINDOWS)
+#include <boost/interprocess/windows_shared_memory.hpp>
 #endif
+
+#include <boost/interprocess/shared_memory_object.hpp>
+
+#include <boost/interprocess/sync/spin/mutex.hpp>
+#include <boost/interprocess/sync/spin/recursive_mutex.hpp>
+#include <boost/interprocess/detail/managed_memory_impl.hpp>
+#include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
+#include <boost/interprocess/mem_algo/rbtree_best_fit.hpp>
+#include <boost/interprocess/indexes/iset_index.hpp>
+#include <boost/interprocess/creation_tags.hpp>
+#include <boost/interprocess/permissions.hpp>
+
+
 #include <boost/interprocess/detail/atomic.hpp>
 #include <boost/interprocess/detail/os_thread_functions.hpp>
 #include <boost/interprocess/detail/tmp_dir_helpers.hpp>
@@ -38,7 +50,7 @@
 #include <sys/stat.h>
 #include <errno.h>
 
-#if defined (BOOST_INTERPROCESS_WINDOWS)
+#if defined(BOOST_INTERPROCESS_WINDOWS)
 #include <fcntl.h>
 #include <io.h>
 
@@ -53,6 +65,130 @@
 namespace interprocess{
 namespace ipcdetail{
 
+struct intermodule_singleton_mutex_family
+{
+ typedef boost::interprocess::ipcdetail::spin_mutex mutex_type;
+ typedef boost::interprocess::ipcdetail::spin_recursive_mutex recursive_mutex_type;
+};
+
+struct intermodule_types
+{
+ typedef rbtree_best_fit<intermodule_singleton_mutex_family, void*> mem_algo;
+ template<class Device, bool FileBased>
+ struct open_or_create
+ {
+ typedef managed_open_or_create_impl
+ <Device, mem_algo::Alignment, FileBased> type;
+ };
+};
+
+template<class Device, bool FileBased>
+class basic_managed_global_memory
+ : public basic_managed_memory_impl
+ < char
+ , intermodule_types::mem_algo
+ , iset_index
+ , intermodule_types::open_or_create<Device, FileBased>::type::ManagedOpenOrCreateUserOffset
+ >
+ , private intermodule_types::open_or_create<Device, FileBased>::type
+{
+ /// @cond
+ typedef typename intermodule_types::template open_or_create<Device, FileBased>::type base2_t;
+
+ typedef basic_managed_memory_impl
+ < char
+ , intermodule_types::mem_algo
+ , iset_index
+ , base2_t::ManagedOpenOrCreateUserOffset
+ > base_t;
+
+ typedef create_open_func<base_t> create_open_func_t;
+
+ basic_managed_global_memory *get_this_pointer()
+ { return this; }
+
+ public:
+ typedef typename base_t::size_type size_type;
+
+ private:
+ typedef typename base_t::char_ptr_holder_t char_ptr_holder_t;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_managed_global_memory)
+ /// @endcond
+
+ public: //functions
+/*
+ basic_managed_global_memory()
+ {}
+
+ basic_managed_global_memory(create_only_t create_only, const char *name,
+ size_type size, const void *addr = 0, const permissions& perm = permissions())
+ : base_t()
+ , base2_t(create_only, name, size, read_write, addr,
+ create_open_func_t(get_this_pointer(), DoCreate), perm)
+ {}
+*/
+ basic_managed_global_memory (open_or_create_t open_or_create,
+ const char *name, size_type size,
+ const void *addr = 0, const permissions& perm = permissions())
+ : base_t()
+ , base2_t(open_or_create, name, size, read_write, addr,
+ create_open_func_t(get_this_pointer(),
+ DoOpenOrCreate), perm)
+ {}
+
+ basic_managed_global_memory (open_only_t open_only, const char* name,
+ const void *addr = 0)
+ : base_t()
+ , base2_t(open_only, name, read_write, addr,
+ create_open_func_t(get_this_pointer(),
+ DoOpen))
+ {}
+
+/*
+ basic_managed_global_memory (open_copy_on_write_t, const char* name,
+ const void *addr = 0)
+ : base_t()
+ , base2_t(open_only, name, copy_on_write, addr,
+ create_open_func_t(get_this_pointer(),
+ DoOpen))
+ {}
+
+ //!Connects to a created shared memory and its segment manager.
+ //!in read-only mode.
+ //!This can throw.
+ basic_managed_global_memory (open_read_only_t, const char* name,
+ const void *addr = 0)
+ : base_t()
+ , base2_t(open_only, name, read_only, addr,
+ create_open_func_t(get_this_pointer(),
+ DoOpen))
+ {}
+
+ //!Moves the ownership of "moved"'s managed memory to *this.
+ //!Does not throw
+ basic_managed_global_memory(BOOST_RV_REF(basic_managed_global_memory) moved)
+ {
+ basic_managed_global_memory tmp;
+ this->swap(moved);
+ tmp.swap(moved);
+ }
+
+ //!Moves the ownership of "moved"'s managed memory to *this.
+ //!Does not throw
+ basic_managed_global_memory &operator=(BOOST_RV_REF(basic_managed_global_memory) moved)
+ {
+ basic_managed_global_memory tmp(boost::move(moved));
+ this->swap(tmp);
+ return *this;
+ }*/
+};
+
+#if defined(BOOST_INTERPROCESS_WINDOWS)
+typedef basic_managed_global_memory<windows_shared_memory, false> windows_managed_global_memory;
+#endif
+
+typedef basic_managed_global_memory<shared_memory_object, true> managed_global_memory;
+
 namespace file_locking_helpers {
 
 inline void get_pid_creation_time_str(std::string &s)
@@ -172,10 +308,10 @@
    }
 };
 
-#if (defined BOOST_INTERPROCESS_WINDOWS)
+#if defined(BOOST_INTERPROCESS_WINDOWS)
 
 template<>
-struct managed_sh_dependant<managed_windows_shared_memory>
+struct managed_sh_dependant<windows_managed_global_memory>
 {
    static void apply_gmem_erase_logic(const char *, const char *){}
 
@@ -581,12 +717,12 @@
    bool retry_with_new_shm;
 };
 
-#if defined (BOOST_INTERPROCESS_WINDOWS)
+#if defined(BOOST_INTERPROCESS_WINDOWS)
 
 template<>
-struct lock_file_logic<managed_windows_shared_memory>
+struct lock_file_logic<windows_managed_global_memory>
 {
- lock_file_logic(managed_windows_shared_memory &)
+ lock_file_logic(windows_managed_global_memory &)
       : retry_with_new_shm(false)
    {}
 
@@ -634,10 +770,10 @@
    private:
    static ManagedShMem &get_shm()
    {
- return *static_cast<ManagedShMem *>(static_cast<void *>(&shm_mem));
+ return *static_cast<ManagedShMem *>(static_cast<void *>(&mem_holder.shm_mem));
    }
 
- enum { MemSize = ((sizeof(ManagedShMem)-1)/sizeof(::boost::detail::max_align))+1u };
+ static const std::size_t MemSize = ((sizeof(ManagedShMem)-1)/sizeof(::boost::detail::max_align))+1u;
 
    static void initialize_shm();
    static void destroy_shm();
@@ -646,7 +782,10 @@
    static volatile boost::uint32_t this_module_singleton_count;
    //this_module_shm_initialized is the state of this module's shm class object
    static volatile boost::uint32_t this_module_shm_initialized;
- static ::boost::detail::max_align shm_mem[MemSize];
+ static struct mem_holder_t
+ {
+ ::boost::detail::max_align shm_mem[MemSize];
+ } mem_holder;
 };
 
 template<class ManagedShMem>
@@ -656,7 +795,11 @@
 volatile boost::uint32_t intermodule_singleton_common<ManagedShMem>::this_module_shm_initialized;
 
 template<class ManagedShMem>
-::boost::detail::max_align intermodule_singleton_common<ManagedShMem>::shm_mem[intermodule_singleton_common<ManagedShMem>::MemSize];
+const std::size_t intermodule_singleton_common<ManagedShMem>::MemSize;
+
+template<class ManagedShMem>
+typename intermodule_singleton_common<ManagedShMem>::mem_holder_t
+ intermodule_singleton_common<ManagedShMem>::mem_holder;
 
 template<class ManagedShMem>
 void intermodule_singleton_common<ManagedShMem>::initialize_shm()
@@ -734,12 +877,12 @@
    ManagedShMem &mshm_;
 };
 
-#if defined (BOOST_INTERPROCESS_WINDOWS)
+#if defined(BOOST_INTERPROCESS_WINDOWS)
 
 template<>
-struct unlink_shmlogic<managed_windows_shared_memory>
+struct unlink_shmlogic<windows_managed_global_memory>
 {
- unlink_shmlogic(managed_windows_shared_memory &)
+ unlink_shmlogic(windows_managed_global_memory &)
    {}
    void operator()(){}
 };
@@ -823,7 +966,7 @@
                break;
             }
             else if(previous_module_singleton_initialized == Initializing){
- ipcdetail::thread_yield();
+ thread_yield();
             }
             else{
                //This can't be happening!
@@ -985,14 +1128,14 @@
 };
 
 template <typename C, bool L, class ManagedShMem>
-volatile int intermodule_singleton_impl<C, L, ManagedShMem>::lifetime_type_lazy::m_dummy;
+volatile int intermodule_singleton_impl<C, L, ManagedShMem>::lifetime_type_lazy::m_dummy = 0;
 
 //These will be zero-initialized by the loader
 template <typename C, bool L, class ManagedShMem>
-void *intermodule_singleton_impl<C, L, ManagedShMem>::this_module_singleton_ptr;
+void *intermodule_singleton_impl<C, L, ManagedShMem>::this_module_singleton_ptr = 0;
 
 template <typename C, bool L, class ManagedShMem>
-volatile boost::uint32_t intermodule_singleton_impl<C, L, ManagedShMem>::this_module_singleton_initialized;
+volatile boost::uint32_t intermodule_singleton_impl<C, L, ManagedShMem>::this_module_singleton_initialized = 0;
 
 template <typename C, bool L, class ManagedShMem>
 typename intermodule_singleton_impl<C, L, ManagedShMem>::lifetime_type
@@ -1000,14 +1143,18 @@
 
 template<typename C, bool LazyInit = false>
 class portable_intermodule_singleton
- : public intermodule_singleton_impl<C, LazyInit, managed_shared_memory>
+ : public intermodule_singleton_impl<C, LazyInit, managed_global_memory>
 {};
 
-#ifdef BOOST_INTERPROCESS_WINDOWS
+#if defined(BOOST_INTERPROCESS_WINDOWS)
 
 template<typename C, bool LazyInit = false>
 class windows_intermodule_singleton
- : public intermodule_singleton_impl<C, LazyInit, managed_windows_shared_memory>
+ : public intermodule_singleton_impl
+ < C
+ , LazyInit
+ , windows_managed_global_memory
+ >
 {};
 
 #endif
@@ -1019,7 +1166,6 @@
 class intermodule_singleton
    #ifdef BOOST_INTERPROCESS_WINDOWS
    : public windows_intermodule_singleton<C, LazyInit>
-// : public portable_intermodule_singleton<C, LazyInit>
    #else
    : public portable_intermodule_singleton<C, LazyInit>
    #endif

Modified: trunk/boost/interprocess/detail/interprocess_tester.hpp
==============================================================================
--- trunk/boost/interprocess/detail/interprocess_tester.hpp (original)
+++ trunk/boost/interprocess/detail/interprocess_tester.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2007-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2007-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)
 //

Modified: trunk/boost/interprocess/detail/intersegment_ptr.hpp
==============================================================================
--- trunk/boost/interprocess/detail/intersegment_ptr.hpp (original)
+++ trunk/boost/interprocess/detail/intersegment_ptr.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -226,7 +226,7 @@
 
    //!Obtains the address pointed
    //!by the object
- void *get_pointer() const
+ void *to_raw_pointer() const
    {
       if(is_null()){
          return 0;
@@ -259,23 +259,23 @@
    //!This only works with two basic_intersegment_ptr pointing
    //!to the same segment. Otherwise undefined
    std::ptrdiff_t diff(const self_t &other) const
- { return static_cast<char*>(this->get_pointer()) - static_cast<char*>(other.get_pointer()); }
+ { return static_cast<char*>(this->to_raw_pointer()) - static_cast<char*>(other.to_raw_pointer()); }
 
    //!Returns true if both point to
    //!the same object
    bool equal(const self_t &y) const
- { return this->get_pointer() == y.get_pointer(); }
+ { return this->to_raw_pointer() == y.to_raw_pointer(); }
 
    //!Returns true if *this is less than other.
    //!This only works with two basic_intersegment_ptr pointing
    //!to the same segment group. Otherwise undefined. Never throws
    bool less(const self_t &y) const
- { return this->get_pointer() < y.get_pointer(); }
+ { return this->to_raw_pointer() < y.to_raw_pointer(); }
 
    void swap(self_t &other)
    {
- void *ptr_this = this->get_pointer();
- void *ptr_other = other.get_pointer();
+ void *ptr_this = this->to_raw_pointer();
+ void *ptr_other = other.to_raw_pointer();
       other.set_from_pointer(ptr_this);
       this->set_from_pointer(ptr_other);
    }
@@ -344,21 +344,21 @@
    //!by another flat_map_intersegment
    void set_from_other(const self_t &other)
    {
- this->set_from_pointer(other.get_pointer());
+ this->set_from_pointer(other.to_raw_pointer());
    }
 
    //!Increments internal
    //!offset
    void inc_offset(std::ptrdiff_t bytes)
    {
- this->set_from_pointer(static_cast<char*>(this->get_pointer()) + bytes);
+ this->set_from_pointer(static_cast<char*>(this->to_raw_pointer()) + bytes);
    }
 
    //!Decrements internal
    //!offset
    void dec_offset(std::ptrdiff_t bytes)
    {
- this->set_from_pointer(static_cast<char*>(this->get_pointer()) - bytes);
+ this->set_from_pointer(static_cast<char*>(this->to_raw_pointer()) - bytes);
    }
 
    //////////////////////////////////////
@@ -659,7 +659,7 @@
    //!Obtains raw pointer from offset.
    //!Never throws.
    pointer get()const
- { return static_cast<pointer>(base_t::get_pointer()); }
+ { return static_cast<pointer>(base_t::to_raw_pointer()); }
 
    //!Pointer-like -> operator. It can return 0 pointer.
    //!Never throws.
@@ -865,10 +865,10 @@
            boost::interprocess::intersegment_ptr<T> &pt2)
 { pt.swap(pt2); }
 
-//!get_pointer() enables boost::mem_fn to recognize intersegment_ptr.
+//!to_raw_pointer() enables boost::mem_fn to recognize intersegment_ptr.
 //!Never throws.
 template<class T> inline
-T * get_pointer(boost::interprocess::intersegment_ptr<T> const & p)
+T * to_raw_pointer(boost::interprocess::intersegment_ptr<T> const & p)
 { return p.get(); }
 
 //!Simulation of static_cast between pointers.
@@ -907,10 +907,10 @@
 } //namespace interprocess {
 
 #if defined(_MSC_VER) && (_MSC_VER < 1400)
-//!get_pointer() enables boost::mem_fn to recognize intersegment_ptr.
+//!to_raw_pointer() enables boost::mem_fn to recognize intersegment_ptr.
 //!Never throws.
 template<class T> inline
-T * get_pointer(boost::interprocess::intersegment_ptr<T> const & p)
+T * to_raw_pointer(boost::interprocess::intersegment_ptr<T> const & p)
 { return p.get(); }
 #endif
 
@@ -930,8 +930,6 @@
 
 } //namespace boost {
 
-#include <boost/interprocess/detail/config_end.hpp>
-
 #if 0
 
 //bits
@@ -982,7 +980,7 @@
 
 //!Obtains the address pointed by the
 //!object
-void *get_pointer() const
+void *to_raw_pointer() const
 {
    if(this->is_pointee_outside() || this->is_in_stack()){
       return raw_address();
@@ -1033,7 +1031,7 @@
 }
 
 void set_from_other(const self_t &other)
-{ this->set_from_pointer(other.get_pointer()); }
+{ this->set_from_pointer(other.to_raw_pointer()); }
 
 #endif
 

Modified: trunk/boost/interprocess/detail/managed_memory_impl.hpp
==============================================================================
--- trunk/boost/interprocess/detail/managed_memory_impl.hpp (original)
+++ trunk/boost/interprocess/detail/managed_memory_impl.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -19,14 +19,10 @@
 #include <boost/interprocess/detail/workaround.hpp>
 
 #include <boost/interprocess/interprocess_fwd.hpp>
-#include <boost/interprocess/mem_algo/rbtree_best_fit.hpp>
-#include <boost/interprocess/sync/mutex_family.hpp>
 #include <boost/interprocess/detail/utilities.hpp>
 #include <boost/interprocess/detail/os_file_functions.hpp>
 #include <boost/interprocess/creation_tags.hpp>
-#include <boost/interprocess/sync/interprocess_mutex.hpp>
 #include <boost/interprocess/exceptions.hpp>
-#include <boost/interprocess/offset_ptr.hpp>
 #include <boost/interprocess/segment_manager.hpp>
 #include <boost/interprocess/sync/scoped_lock.hpp>
 //
@@ -137,10 +133,10 @@
    static bool shrink_to_fit(const char *filename)
    {
       typedef typename ManagedMemory::device_type device_type;
- size_type new_size, old_size;
+ size_type new_size;
       try{
          ManagedMemory managed_memory(open_only, filename);
- old_size = managed_memory.get_size();
+ managed_memory.get_size();
          managed_memory.self_t::shrink_to_fit();
          new_size = managed_memory.get_size();
       }
@@ -329,7 +325,7 @@
 
    //!Allocates n_elements, each one of elem_sizes[i] bytes.
    void deallocate_many(multiallocation_chain chain)
- { return mp_header->deallocate_many(boost::interprocess::move(chain)); }
+ { return mp_header->deallocate_many(boost::move(chain)); }
 
    /// @endcond
 
@@ -583,7 +579,7 @@
    //!For all theses reasons, classes with throwing destructors are not
    //!recommended for memory.
    template <class T>
- bool destroy(const ipcdetail::unique_instance_t *const )
+ bool destroy(const unique_instance_t *const )
    { return mp_header->template destroy<T>(unique_instance); }
 
    //!Destroys the object (named, unique, or anonymous)
@@ -724,13 +720,13 @@
 class create_open_func
 {
    public:
- create_open_func(BasicManagedMemoryImpl * const frontend, ipcdetail::create_enum_t type)
+ create_open_func(BasicManagedMemoryImpl * const frontend, create_enum_t type)
       : m_frontend(frontend), m_type(type){}
 
    bool operator()(void *addr, typename BasicManagedMemoryImpl::size_type size, bool created) const
    {
- if(((m_type == ipcdetail::DoOpen) && created) ||
- ((m_type == ipcdetail::DoCreate) && !created))
+ if(((m_type == DoOpen) && created) ||
+ ((m_type == DoCreate) && !created))
          return false;
 
       if(created)
@@ -741,7 +737,7 @@
 
    private:
    BasicManagedMemoryImpl *m_frontend;
- ipcdetail::create_enum_t m_type;
+ create_enum_t m_type;
 };
 
 } //namespace ipcdetail {

Modified: trunk/boost/interprocess/detail/managed_multi_shared_memory.hpp
==============================================================================
--- trunk/boost/interprocess/detail/managed_multi_shared_memory.hpp (original)
+++ trunk/boost/interprocess/detail/managed_multi_shared_memory.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -34,6 +34,10 @@
 #include <boost/interprocess/streams/vectorstream.hpp>
 #include <memory>
 #include <boost/assert.hpp>
+//These includes needed to fulfill default template parameters of
+//predeclarations in interprocess_fwd.hpp
+#include <boost/interprocess/mem_algo/rbtree_best_fit.hpp>
+#include <boost/interprocess/sync/mutex_family.hpp>
 
 //!\file
 //!Describes a named shared memory object allocation user class.
@@ -68,7 +72,7 @@
    
    typedef typename MemoryAlgorithm::void_pointer void_pointer;
    typedef typename ipcdetail::
- managed_open_or_create_impl<shared_memory_object> managed_impl;
+ managed_open_or_create_impl<shared_memory_object, MemoryAlgorithm::Alignment> managed_impl;
    typedef typename void_pointer::segment_group_id segment_group_id;
    typedef typename base_t::size_type size_type;
 
@@ -116,7 +120,8 @@
          : mp_frontend(frontend), m_group(0), m_min_segment_size(0){}
 
       virtual std::pair<void *, size_type> create_new_segment(size_type alloc_size)
- {
+ { (void)alloc_size;
+ /*
          //We should allocate an extra byte so that the
          //[base_addr + alloc_size] byte belongs to this segment
          alloc_size += 1;
@@ -126,9 +131,9 @@
                        m_min_segment_size : alloc_size;
          if(mp_frontend->priv_new_segment(create_open_func::DoCreate,
                                           alloc_size, 0, permissions())){
- shmem_list_t::value_type &m_impl = *mp_frontend->m_shmem_list.rbegin();
+ typename shmem_list_t::value_type &m_impl = *mp_frontend->m_shmem_list.rbegin();
             return result_type(m_impl.get_real_address(), m_impl.get_real_size()-1);
- }
+ }*/
          return result_type(static_cast<void *>(0), 0);
       }
 
@@ -153,7 +158,7 @@
 
       frontend_t * const mp_frontend;
       segment_group_id m_group;
- size_type m_min_segment_size;
+ size_type m_min_segment_size;
    };
 
    //!Functor to execute atomically when opening or creating a shared memory
@@ -328,21 +333,21 @@
             case create_open_func::DoCreate:
             {
                managed_impl shm(create_only, name, size, read_write, addr, func, perm);
- mshm = boost::interprocess::move(shm);
+ mshm = boost::move(shm);
             }
             break;
 
             case create_open_func::DoOpen:
             {
                managed_impl shm(open_only, name,read_write, addr, func);
- mshm = boost::interprocess::move(shm);
+ mshm = boost::move(shm);
             }
             break;
 
             case create_open_func::DoOpenOrCreate:
             {
                managed_impl shm(open_or_create, name, size, read_write, addr, func, perm);
- mshm = boost::interprocess::move(shm);
+ mshm = boost::move(shm);
             }
             break;
 
@@ -352,7 +357,7 @@
          }
 
          //This can throw.
- m_shmem_list.push_back(boost::interprocess::move(mshm));
+ m_shmem_list.push_back(boost::move(mshm));
          return true;
       }
       BOOST_CATCH(const std::bad_alloc&){
@@ -369,12 +374,13 @@
          //Obtain group identifier
          segment_group_id group = m_group_services.get_group();
          //Erase main segment and its resources
- shmem_list_t::iterator itbeg = m_shmem_list.begin(),
- itend = m_shmem_list.end(),
- it = itbeg;
+ //typename shmem_list_t::iterator itbeg = m_shmem_list.begin(),
+ // itend = m_shmem_list.end(),
+ // it = itbeg;
          //(*itbeg)->close_with_func(close_func(this));
          //Delete group. All mappings are erased too.
          ret = void_pointer::delete_group(group);
+ (void)ret;
          BOOST_ASSERT(ret);
          m_shmem_list.clear();
       }

Modified: trunk/boost/interprocess/detail/managed_open_or_create_impl.hpp
==============================================================================
--- trunk/boost/interprocess/detail/managed_open_or_create_impl.hpp (original)
+++ trunk/boost/interprocess/detail/managed_open_or_create_impl.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -22,10 +22,10 @@
 #include <boost/interprocess/detail/interprocess_tester.hpp>
 #include <boost/interprocess/creation_tags.hpp>
 #include <boost/interprocess/detail/mpl.hpp>
-#include <boost/interprocess/detail/move.hpp>
 #include <boost/interprocess/permissions.hpp>
 #include <boost/type_traits/alignment_of.hpp>
 #include <boost/type_traits/type_with_alignment.hpp>
+#include <boost/move/move.hpp>
 #include <boost/cstdint.hpp>
 
 namespace boost {
@@ -84,7 +84,7 @@
    DeviceAbstraction dev;
 };
 
-template<class DeviceAbstraction, bool FileBased = true, bool StoreDevice = true>
+template<class DeviceAbstraction, std::size_t MemAlignment = 0, bool FileBased = true, bool StoreDevice = true>
 class managed_open_or_create_impl
    : public managed_open_or_create_impl_device_holder<StoreDevice, DeviceAbstraction>
 {
@@ -104,9 +104,11 @@
    public:
    static const std::size_t
       ManagedOpenOrCreateUserOffset =
- ipcdetail::ct_rounded_size
+ ct_rounded_size
             < sizeof(boost::uint32_t)
- , ::boost::alignment_of< ::boost::detail::max_align >::value >::value;
+ , MemAlignment ? (MemAlignment) :
+ (::boost::alignment_of< ::boost::detail::max_align >::value)
+ >::value;
 
    managed_open_or_create_impl()
    {}
@@ -119,7 +121,7 @@
                  const permissions &perm)
    {
       priv_open_or_create
- ( ipcdetail::DoCreate
+ ( DoCreate
          , id
          , size
          , mode
@@ -134,7 +136,7 @@
                  const void *addr)
    {
       priv_open_or_create
- ( ipcdetail::DoOpen
+ ( DoOpen
          , id
          , 0
          , mode
@@ -152,7 +154,7 @@
                  const permissions &perm)
    {
       priv_open_or_create
- ( ipcdetail::DoOpenOrCreate
+ ( DoOpenOrCreate
          , id
          , size
          , mode
@@ -171,7 +173,7 @@
                  const permissions &perm)
    {
       priv_open_or_create
- (ipcdetail::DoCreate
+ (DoCreate
          , id
          , size
          , mode
@@ -188,7 +190,7 @@
                  const ConstructFunc &construct_func)
    {
       priv_open_or_create
- ( ipcdetail::DoOpen
+ ( DoOpen
          , id
          , 0
          , mode
@@ -207,7 +209,7 @@
                  const permissions &perm)
    {
       priv_open_or_create
- ( ipcdetail::DoOpenOrCreate
+ ( DoOpenOrCreate
          , id
          , size
          , mode
@@ -221,7 +223,7 @@
 
    managed_open_or_create_impl &operator=(BOOST_RV_REF(managed_open_or_create_impl) moved)
    {
- managed_open_or_create_impl tmp(boost::interprocess::move(moved));
+ managed_open_or_create_impl tmp(boost::move(moved));
       this->swap(tmp);
       return *this;
    }
@@ -263,47 +265,49 @@
 
    //These are templatized to allow explicit instantiations
    template<bool dummy>
- static void truncate_device(DeviceAbstraction &, offset_t, ipcdetail::false_)
+ static void truncate_device(DeviceAbstraction &, offset_t, false_)
    {} //Empty
 
    template<bool dummy>
- static void truncate_device(DeviceAbstraction &dev, offset_t size, ipcdetail::true_)
+ static void truncate_device(DeviceAbstraction &dev, offset_t size, true_)
    { dev.truncate(size); }
 
 
    template<bool dummy>
- static bool check_offset_t_size(std::size_t , ipcdetail::false_)
+ static bool check_offset_t_size(std::size_t , false_)
    { return true; } //Empty
 
    template<bool dummy>
- static bool check_offset_t_size(std::size_t size, ipcdetail::true_)
+ static bool check_offset_t_size(std::size_t size, true_)
    { return size == std::size_t(offset_t(size)); }
 
    //These are templatized to allow explicit instantiations
    template<bool dummy>
- static void create_device(DeviceAbstraction &dev, const device_id_t & id, std::size_t size, const permissions &perm, ipcdetail::false_)
+ static void create_device(DeviceAbstraction &dev, const device_id_t & id, std::size_t size, const permissions &perm, false_ file_like)
    {
+ (void)file_like;
       DeviceAbstraction tmp(create_only, id, read_write, size, perm);
       tmp.swap(dev);
    }
 
    template<bool dummy>
- static void create_device(DeviceAbstraction &dev, const device_id_t & id, std::size_t, const permissions &perm, ipcdetail::true_)
+ static void create_device(DeviceAbstraction &dev, const device_id_t & id, std::size_t, const permissions &perm, true_ file_like)
    {
+ (void)file_like;
       DeviceAbstraction tmp(create_only, id, read_write, perm);
       tmp.swap(dev);
    }
 
    template <class ConstructFunc> inline
    void priv_open_or_create
- (ipcdetail::create_enum_t type,
+ (create_enum_t type,
        const device_id_t & id,
        std::size_t size,
        mode_t mode, const void *addr,
        const permissions &perm,
        ConstructFunc construct_func)
    {
- typedef ipcdetail::bool_<FileBased> file_like_t;
+ typedef bool_<FileBased> file_like_t;
       (void)mode;
       error_info err;
       bool created = false;
@@ -311,35 +315,35 @@
       bool cow = false;
       DeviceAbstraction dev;
 
- if(type != ipcdetail::DoOpen && size < ManagedOpenOrCreateUserOffset){
+ if(type != DoOpen && size < ManagedOpenOrCreateUserOffset){
          throw interprocess_exception(error_info(size_error));
       }
       //Check size can be represented by offset_t (used by truncate)
- if(type != ipcdetail::DoOpen && !check_offset_t_size<FileBased>(size, file_like_t())){
+ if(type != DoOpen && !check_offset_t_size<FileBased>(size, file_like_t())){
          throw interprocess_exception(error_info(size_error));
       }
- if(type == ipcdetail::DoOpen && mode == read_write){
+ if(type == DoOpen && mode == read_write){
          DeviceAbstraction tmp(open_only, id, read_write);
          tmp.swap(dev);
          created = false;
       }
- else if(type == ipcdetail::DoOpen && mode == read_only){
+ else if(type == DoOpen && mode == read_only){
          DeviceAbstraction tmp(open_only, id, read_only);
          tmp.swap(dev);
          created = false;
          ronly = true;
       }
- else if(type == ipcdetail::DoOpen && mode == copy_on_write){
+ else if(type == DoOpen && mode == copy_on_write){
          DeviceAbstraction tmp(open_only, id, read_only);
          tmp.swap(dev);
          created = false;
          cow = true;
       }
- else if(type == ipcdetail::DoCreate){
+ else if(type == DoCreate){
          create_device<FileBased>(dev, id, size, perm, file_like_t());
          created = true;
       }
- else if(type == ipcdetail::DoOpenOrCreate){
+ else if(type == DoOpenOrCreate){
          //This loop is very ugly, but brute force is sometimes better
          //than diplomacy. If someone knows how to open or create a
          //file and know if we have really created it or just open it
@@ -367,9 +371,15 @@
                         throw;
                      }
                   }
+ catch(...){
+ throw;
+ }
                }
             }
- ipcdetail::thread_yield();
+ catch(...){
+ throw;
+ }
+ thread_yield();
          }
       }
 
@@ -382,7 +392,7 @@
             mapped_region region(dev, read_write, 0, 0, addr);
             boost::uint32_t *patomic_word = 0; //avoid gcc warning
             patomic_word = static_cast<boost::uint32_t*>(region.get_address());
- boost::uint32_t previous = ipcdetail::atomic_cas32(patomic_word, InitializingSegment, UninitializedSegment);
+ boost::uint32_t previous = atomic_cas32(patomic_word, InitializingSegment, UninitializedSegment);
 
             if(previous == UninitializedSegment){
                try{
@@ -391,10 +401,10 @@
                   m_mapped_region.swap(region);
                }
                catch(...){
- ipcdetail::atomic_write32(patomic_word, CorruptedSegment);
+ atomic_write32(patomic_word, CorruptedSegment);
                   throw;
                }
- ipcdetail::atomic_write32(patomic_word, InitializedSegment);
+ atomic_write32(patomic_word, InitializedSegment);
             }
             else if(previous == InitializingSegment || previous == InitializedSegment){
                throw interprocess_exception(error_info(already_exists_error));
@@ -416,10 +426,10 @@
          if(FileBased){
             offset_t filesize = 0;
             while(filesize == 0){
- if(!ipcdetail::get_file_size(ipcdetail::file_handle_from_mapping_handle(dev.get_mapping_handle()), filesize)){
+ if(!get_file_size(file_handle_from_mapping_handle(dev.get_mapping_handle()), filesize)){
                   throw interprocess_exception(error_info(system_error_code()));
                }
- ipcdetail::thread_yield();
+ thread_yield();
             }
             if(filesize == 1){
                throw interprocess_exception(error_info(corrupted_error));
@@ -429,11 +439,11 @@
          mapped_region region(dev, ronly ? read_only : (cow ? copy_on_write : read_write), 0, 0, addr);
 
          boost::uint32_t *patomic_word = static_cast<boost::uint32_t*>(region.get_address());
- boost::uint32_t value = ipcdetail::atomic_read32(patomic_word);
+ boost::uint32_t value = atomic_read32(patomic_word);
 
          while(value == InitializingSegment || value == UninitializedSegment){
- ipcdetail::thread_yield();
- value = ipcdetail::atomic_read32(patomic_word);
+ thread_yield();
+ value = atomic_read32(patomic_word);
          }
 
          if(value != InitializedSegment)
@@ -446,14 +456,14 @@
          m_mapped_region.swap(region);
       }
       if(StoreDevice){
- this->DevHolder::get_device() = boost::interprocess::move(dev);
+ this->DevHolder::get_device() = boost::move(dev);
       }
    }
 
    private:
- friend class ipcdetail::interprocess_tester;
+ friend class interprocess_tester;
    void dont_close_on_destruction()
- { ipcdetail::interprocess_tester::dont_close_on_destruction(m_mapped_region); }
+ { interprocess_tester::dont_close_on_destruction(m_mapped_region); }
 
    mapped_region m_mapped_region;
 };

Modified: trunk/boost/interprocess/detail/math_functions.hpp
==============================================================================
--- trunk/boost/interprocess/detail/math_functions.hpp (original)
+++ trunk/boost/interprocess/detail/math_functions.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,7 +1,7 @@
 //////////////////////////////////////////////////////////////////////////////
 //
 // (C) Copyright Stephen Cleary 2000.
-// (C) Copyright Ion Gaztanaga 2007-2009.
+// (C) Copyright Ion Gaztanaga 2007-2011.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at

Modified: trunk/boost/interprocess/detail/min_max.hpp
==============================================================================
--- trunk/boost/interprocess/detail/min_max.hpp (original)
+++ trunk/boost/interprocess/detail/min_max.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009.
+// (C) Copyright Ion Gaztanaga 2005-2011.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at

Modified: trunk/boost/interprocess/detail/mpl.hpp
==============================================================================
--- trunk/boost/interprocess/detail/mpl.hpp (original)
+++ trunk/boost/interprocess/detail/mpl.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009.
+// (C) Copyright Ion Gaztanaga 2005-2011.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
@@ -71,7 +71,7 @@
    static false_t dispatch(...);
    static T trigger();
    public:
- enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) };
+ static const bool value = sizeof(dispatch(trigger())) == sizeof(true_t);
 };
 
 template<

Modified: trunk/boost/interprocess/detail/multi_segment_services.hpp
==============================================================================
--- trunk/boost/interprocess/detail/multi_segment_services.hpp (original)
+++ trunk/boost/interprocess/detail/multi_segment_services.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //

Modified: trunk/boost/interprocess/detail/named_proxy.hpp
==============================================================================
--- trunk/boost/interprocess/detail/named_proxy.hpp (original)
+++ trunk/boost/interprocess/detail/named_proxy.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -26,7 +26,7 @@
 #ifndef BOOST_INTERPROCESS_PERFECT_FORWARDING
 #include <boost/interprocess/detail/preprocessor.hpp>
 #else
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/interprocess/detail/variadic_templates_tools.hpp>
 #endif //#ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING
 
@@ -42,7 +42,7 @@
 template<class T, bool is_iterator, class ...Args>
 struct CtorNArg : public placement_destroy<T>
 {
- typedef ipcdetail::bool_<is_iterator> IsIterator;
+ typedef bool_<is_iterator> IsIterator;
    typedef CtorNArg<T, is_iterator, Args...> self_t;
    typedef typename build_number_seq<sizeof...(Args)>::type index_tuple_t;
 
@@ -71,15 +71,15 @@
 
    private:
    template<int ...IdxPack>
- void construct(void *mem, ipcdetail::true_, const index_tuple<IdxPack...>&)
- { new((void*)mem)T(*boost::interprocess::forward<Args>(get<IdxPack>(args_))...); }
+ void construct(void *mem, true_, const index_tuple<IdxPack...>&)
+ { new((void*)mem)T(*boost::forward<Args>(get<IdxPack>(args_))...); }
 
    template<int ...IdxPack>
- void construct(void *mem, ipcdetail::false_, const index_tuple<IdxPack...>&)
- { new((void*)mem)T(boost::interprocess::forward<Args>(get<IdxPack>(args_))...); }
+ void construct(void *mem, false_, const index_tuple<IdxPack...>&)
+ { new((void*)mem)T(boost::forward<Args>(get<IdxPack>(args_))...); }
 
    template<int ...IdxPack>
- void do_increment(ipcdetail::true_, const index_tuple<IdxPack...>&)
+ void do_increment(true_, const index_tuple<IdxPack...>&)
    {
       this->expansion_helper(++get<IdxPack>(args_)...);
    }
@@ -89,7 +89,7 @@
    {}
 
    template<int ...IdxPack>
- void do_increment(ipcdetail::false_, const index_tuple<IdxPack...>&)
+ void do_increment(false_, const index_tuple<IdxPack...>&)
    {}
 
    tuple<Args&...> args_;
@@ -121,7 +121,7 @@
    T *operator()(Args &&...args) const
    {
       CtorNArg<T, is_iterator, Args...> &&ctor_obj = CtorNArg<T, is_iterator, Args...>
- (boost::interprocess::forward<Args>(args)...);
+ (boost::forward<Args>(args)...);
       return mp_mngr->template
          generic_construct<T>(mp_name, m_num, m_find, m_dothrow, ctor_obj);
    }
@@ -163,13 +163,13 @@
 // struct Ctor2Arg
 // : public placement_destroy<T>
 // {
-// typedef ipcdetail::bool_<is_iterator> IsIterator;
+// typedef bool_<is_iterator> IsIterator;
 // typedef Ctor2Arg self_t;
 //
-// void do_increment(ipcdetail::false_)
+// void do_increment(false_)
 // { ++m_p1; ++m_p2; }
 //
-// void do_increment(ipcdetail::true_){}
+// void do_increment(true_){}
 //
 // self_t& operator++()
 // {
@@ -197,10 +197,10 @@
 // }
 //
 // private:
-// void construct(void *mem, ipcdetail::true_)
+// void construct(void *mem, true_)
 // { new((void*)mem)T(*m_p1, *m_p2); }
 //
-// void construct(void *mem, ipcdetail::false_)
+// void construct(void *mem, false_)
 // { new((void*)mem)T(m_p1, m_p2); }
 //
 // P1 &m_p1; P2 &m_p2;
@@ -218,13 +218,13 @@
    struct BOOST_PP_CAT(BOOST_PP_CAT(Ctor, n), Arg) \
       : public placement_destroy<T> \
    { \
- typedef ipcdetail::bool_<is_iterator> IsIterator; \
+ typedef bool_<is_iterator> IsIterator; \
       typedef BOOST_PP_CAT(BOOST_PP_CAT(Ctor, n), Arg) self_t; \
                                                                            \
- void do_increment(ipcdetail::true_) \
- { BOOST_PP_ENUM(n, BOOST_INTERPROCESS_AUX_PARAM_INC, _); } \
+ void do_increment(true_) \
+ { BOOST_PP_ENUM(n, BOOST_INTERPROCESS_PP_PARAM_INC, _); } \
                                                                            \
- void do_increment(ipcdetail::false_){} \
+ void do_increment(false_){} \
                                                                            \
       self_t& operator++() \
       { \
@@ -236,7 +236,7 @@
                                                                            \
       BOOST_PP_CAT(BOOST_PP_CAT(Ctor, n), Arg) \
          ( BOOST_PP_ENUM(n, BOOST_INTERPROCESS_PP_PARAM_LIST, _) ) \
- : BOOST_PP_ENUM(n, BOOST_INTERPROCESS_AUX_PARAM_INIT, _) {} \
+ : BOOST_PP_ENUM(n, BOOST_INTERPROCESS_PP_PARAM_INIT, _) {} \
                                                                            \
       virtual void construct_n(void *mem \
                         , std::size_t num \
@@ -250,19 +250,19 @@
       } \
                                                                            \
       private: \
- void construct(void *mem, ipcdetail::true_) \
+ void construct(void *mem, true_) \
       { \
          new((void*)mem) T \
          (BOOST_PP_ENUM(n, BOOST_INTERPROCESS_PP_MEMBER_IT_FORWARD, _)); \
       } \
                                                                            \
- void construct(void *mem, ipcdetail::false_) \
+ void construct(void *mem, false_) \
       { \
          new((void*)mem) T \
             (BOOST_PP_ENUM(n, BOOST_INTERPROCESS_PP_MEMBER_FORWARD, _)); \
       } \
                                                                            \
- BOOST_PP_REPEAT(n, BOOST_INTERPROCESS_AUX_PARAM_DEFINE, _) \
+ BOOST_PP_REPEAT(n, BOOST_INTERPROCESS_PP_PARAM_DEFINE, _) \
    }; \
 //!
 #define BOOST_PP_LOCAL_LIMITS (1, BOOST_INTERPROCESS_MAX_CONSTRUCTOR_PARAMETERS)

Modified: trunk/boost/interprocess/detail/os_file_functions.hpp
==============================================================================
--- trunk/boost/interprocess/detail/os_file_functions.hpp (original)
+++ trunk/boost/interprocess/detail/os_file_functions.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -128,12 +128,13 @@
    if(!winapi::get_file_size(hnd, filesize))
       return false;
 
- if(size > (std::numeric_limits<offset_t>::max)()){
+ const offset_t max_filesize = (std::numeric_limits<offset_t>::max)();
+ if( sizeof(std::size_t) >= sizeof(offset_t) && size > std::size_t(max_filesize) ){
       winapi::set_last_error(winapi::error_file_too_large);
       return false;
    }
 
- if(size > (unsigned long long)filesize){
+ if(offset_t(size) > filesize){
       if(!winapi::set_file_pointer_ex(hnd, filesize, 0, winapi::file_begin)){
          return false;
       }

Modified: trunk/boost/interprocess/detail/os_thread_functions.hpp
==============================================================================
--- trunk/boost/interprocess/detail/os_thread_functions.hpp (original)
+++ trunk/boost/interprocess/detail/os_thread_functions.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -23,6 +23,7 @@
 # include <pthread.h>
 # include <unistd.h>
 # include <sched.h>
+# include <time.h>
 # else
 # error Unknown platform
 # endif
@@ -58,6 +59,9 @@
 inline void thread_yield()
 { winapi::sched_yield(); }
 
+inline void thread_sleep(unsigned int ms)
+{ winapi::Sleep(ms); }
+
 //systemwide thread
 inline OS_systemwide_thread_id_t get_current_systemwide_thread_id()
 {
@@ -160,6 +164,12 @@
 inline void thread_yield()
 { ::sched_yield(); }
 
+inline void thread_sleep(unsigned int ms)
+{
+ const struct timespec rqt = { ms/1000u, (ms%1000u)*1000000u };
+ ::nanosleep(&rqt, 0);
+}
+
 //systemwide thread
 inline OS_systemwide_thread_id_t get_current_systemwide_thread_id()
 {

Modified: trunk/boost/interprocess/detail/pointer_type.hpp
==============================================================================
--- trunk/boost/interprocess/detail/pointer_type.hpp (original)
+++ trunk/boost/interprocess/detail/pointer_type.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009.
+// (C) Copyright Ion Gaztanaga 2005-2011.
 // (C) Copyright Gennaro Prota 2003 - 2004.
 //
 // Distributed under the Boost Software License, Version 1.0.

Modified: trunk/boost/interprocess/detail/posix_time_types_wrk.hpp
==============================================================================
--- trunk/boost/interprocess/detail/posix_time_types_wrk.hpp (original)
+++ trunk/boost/interprocess/detail/posix_time_types_wrk.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //

Modified: trunk/boost/interprocess/detail/preprocessor.hpp
==============================================================================
--- trunk/boost/interprocess/detail/preprocessor.hpp (original)
+++ trunk/boost/interprocess/detail/preprocessor.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //
@@ -15,7 +15,7 @@
 # pragma once
 #endif
 
-#include "config_begin.hpp"
+#include <boost/interprocess/detail/config_begin.hpp>
 
 #ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING
 #error "This file is not needed when perfect forwarding is available"
@@ -46,11 +46,11 @@
 #endif
 
 #ifndef BOOST_NO_RVALUE_REFERENCES
- #define BOOST_INTERPROCESS_PARAM(U, u) \
+ #define BOOST_INTERPROCESS_PP_PARAM(U, u) \
    U && u \
    //!
 #else
- #define BOOST_INTERPROCESS_PARAM(U, u) \
+ #define BOOST_INTERPROCESS_PP_PARAM(U, u) \
    const U & u \
    //!
 #endif
@@ -59,25 +59,25 @@
 
 #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
 
-#define BOOST_INTERPROCESS_AUX_PARAM_INIT(z, n, data) \
+#define BOOST_INTERPROCESS_PP_PARAM_INIT(z, n, data) \
   BOOST_PP_CAT(m_p, n) (BOOST_INTERPROCESS_MOVE_NAMESPACE::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \
 //!
 
 #else
 
-#define BOOST_INTERPROCESS_AUX_PARAM_INIT(z, n, data) \
+#define BOOST_INTERPROCESS_PP_PARAM_INIT(z, n, data) \
   BOOST_PP_CAT(m_p, n) (BOOST_PP_CAT(p, n)) \
 //!
 
 #endif
 
 #else
-#define BOOST_INTERPROCESS_AUX_PARAM_INIT(z, n, data) \
+#define BOOST_INTERPROCESS_PP_PARAM_INIT(z, n, data) \
   BOOST_PP_CAT(m_p, n) (const_cast<BOOST_PP_CAT(P, n) &>(BOOST_PP_CAT(p, n))) \
 //!
 #endif
 
-#define BOOST_INTERPROCESS_AUX_PARAM_INC(z, n, data) \
+#define BOOST_INTERPROCESS_PP_PARAM_INC(z, n, data) \
   BOOST_PP_CAT(++m_p, n) \
 //!
 
@@ -85,13 +85,13 @@
 
 #if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
 
-#define BOOST_INTERPROCESS_AUX_PARAM_DEFINE(z, n, data) \
+#define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data) \
   BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \
 //!
 
 #else
 
-#define BOOST_INTERPROCESS_AUX_PARAM_DEFINE(z, n, data) \
+#define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data) \
   BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n); \
 //!
 
@@ -99,13 +99,13 @@
 
 
 #else
-#define BOOST_INTERPROCESS_AUX_PARAM_DEFINE(z, n, data) \
+#define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data) \
   BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \
 //!
 #endif
 
 #define BOOST_INTERPROCESS_PP_PARAM_FORWARD(z, n, data) \
-::boost::interprocess::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \
+::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \
 //!
 
 #if !defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
@@ -113,13 +113,13 @@
 #include <boost/container/detail/stored_ref.hpp>
 
 #define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) \
-::boost::container::containers_detail::stored_ref< BOOST_PP_CAT(P, n) >::forward( BOOST_PP_CAT(m_p, n) ) \
+::boost::container::container_detail::stored_ref< BOOST_PP_CAT(P, n) >::forward( BOOST_PP_CAT(m_p, n) ) \
 //!
 
 #else
 
 #define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) \
-::boost::interprocess::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \
+::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \
 //!
 
 #endif //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)

Modified: trunk/boost/interprocess/detail/robust_emulation.hpp
==============================================================================
--- trunk/boost/interprocess/detail/robust_emulation.hpp (original)
+++ trunk/boost/interprocess/detail/robust_emulation.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2010-2010. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2010-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)
 //
@@ -173,9 +173,9 @@
 
 //This is the mutex class. Mutex should follow mutex concept
 //with an additonal "take_ownership()" function to take ownership of the
-//mutex when robust_emulation_mutex determines the previous owner was dead.
+//mutex when robust_spin_mutex determines the previous owner was dead.
 template<class Mutex>
-class robust_emulation_mutex
+class robust_spin_mutex
 {
    public:
    static const boost::uint32_t correct_state = 0;
@@ -184,7 +184,7 @@
 
    typedef robust_emulation_helpers::mutex_traits<Mutex> mutex_traits_t;
 
- robust_emulation_mutex();
+ robust_spin_mutex();
    void lock();
    bool try_lock();
    bool timed_lock(const boost::posix_time::ptime &abs_time);
@@ -208,12 +208,12 @@
 };
 
 template<class Mutex>
-inline robust_emulation_mutex<Mutex>::robust_emulation_mutex()
+inline robust_spin_mutex<Mutex>::robust_spin_mutex()
    : mtx(), owner(get_invalid_process_id()), state(correct_state)
 {}
 
 template<class Mutex>
-inline void robust_emulation_mutex<Mutex>::lock()
+inline void robust_spin_mutex<Mutex>::lock()
 {
    //If the mutex is broken (recovery didn't call consistent()),
    //then throw an exception
@@ -252,7 +252,7 @@
 }
 
 template<class Mutex>
-inline bool robust_emulation_mutex<Mutex>::try_lock()
+inline bool robust_spin_mutex<Mutex>::try_lock()
 {
    //Same as lock() but without spinning
    if(atomic_read32(&this->state) == broken_state){
@@ -278,7 +278,7 @@
 }
 
 template<class Mutex>
-inline bool robust_emulation_mutex<Mutex>::timed_lock
+inline bool robust_spin_mutex<Mutex>::timed_lock
    (const boost::posix_time::ptime &abs_time)
 {
    //Same as lock() but with an additional timeout
@@ -309,13 +309,13 @@
 }
 
 template<class Mutex>
-inline void robust_emulation_mutex<Mutex>::owner_to_filename(boost::uint32_t owner, std::string &s)
+inline void robust_spin_mutex<Mutex>::owner_to_filename(boost::uint32_t owner, std::string &s)
 {
    robust_emulation_helpers::create_and_get_robust_lock_file_path(s, owner);
 }
 
 template<class Mutex>
-inline bool robust_emulation_mutex<Mutex>::robust_check()
+inline bool robust_spin_mutex<Mutex>::robust_check()
 {
    //If the old owner was dead, and we've acquired ownership, mark
    //the mutex as 'fixing'. This means that a "consistent()" is needed
@@ -328,7 +328,7 @@
 }
 
 template<class Mutex>
-inline bool robust_emulation_mutex<Mutex>::check_if_owner_dead_and_take_ownership_atomically()
+inline bool robust_spin_mutex<Mutex>::check_if_owner_dead_and_take_ownership_atomically()
 {
    boost::uint32_t cur_owner = get_current_process_id();
    boost::uint32_t old_owner = atomic_read32(&this->owner), old_owner2;
@@ -349,7 +349,7 @@
 }
 
 template<class Mutex>
-inline bool robust_emulation_mutex<Mutex>::is_owner_dead(boost::uint32_t owner)
+inline bool robust_spin_mutex<Mutex>::is_owner_dead(boost::uint32_t owner)
 {
    //If owner is an invalid id, then it's clear it's dead
    if(owner == (boost::uint32_t)get_invalid_process_id()){
@@ -387,7 +387,7 @@
 }
 
 template<class Mutex>
-inline void robust_emulation_mutex<Mutex>::consistent()
+inline void robust_spin_mutex<Mutex>::consistent()
 {
    //This function supposes the previous state was "fixing"
    //and the current process holds the mutex
@@ -400,14 +400,14 @@
 }
 
 template<class Mutex>
-inline bool robust_emulation_mutex<Mutex>::previous_owner_dead()
+inline bool robust_spin_mutex<Mutex>::previous_owner_dead()
 {
    //Notifies if a owner recovery has been performed in the last lock()
    return atomic_read32(&this->state) == fixing_state;
 };
 
 template<class Mutex>
-inline void robust_emulation_mutex<Mutex>::unlock()
+inline void robust_spin_mutex<Mutex>::unlock()
 {
    //If in "fixing" state, unlock and mark the mutex as unrecoverable
    //so next locks will fail and all threads will be notified that the
@@ -421,7 +421,7 @@
 }
 
 template<class Mutex>
-inline bool robust_emulation_mutex<Mutex>::lock_own_unique_file()
+inline bool robust_spin_mutex<Mutex>::lock_own_unique_file()
 {
    //This function forces instantiation of the singleton
    robust_emulation_helpers::robust_mutex_lock_file* dummy =

Modified: trunk/boost/interprocess/detail/segment_manager_helper.hpp
==============================================================================
--- trunk/boost/interprocess/detail/segment_manager_helper.hpp (original)
+++ trunk/boost/interprocess/detail/segment_manager_helper.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -27,6 +27,7 @@
 #include <boost/interprocess/exceptions.hpp>
 #include <boost/type_traits/make_unsigned.hpp>
 #include <boost/type_traits/alignment_of.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <cstddef> //std::size_t
 #include <string> //char_traits
 #include <new> //std::nothrow
@@ -207,7 +208,7 @@
    }
 };
 
-inline void array_construct(void *mem, std::size_t num, ipcdetail::in_place_interface &table)
+inline void array_construct(void *mem, std::size_t num, in_place_interface &table)
 {
    //Try constructors
    std::size_t constructed = 0;
@@ -281,7 +282,7 @@
    {
       return const_cast<block_header<size_type>*>
          (reinterpret_cast<const block_header<size_type> *>(reinterpret_cast<const char*>(this) +
- ::boost::interprocess::ipcdetail::get_rounded_size(size_type(sizeof(*this)), size_type(BlockHdrAlignment))));
+ get_rounded_size(size_type(sizeof(*this)), size_type(BlockHdrAlignment))));
    }
 
    bool operator <(const intrusive_value_type_impl<Hook, CharType, SizeType> & other) const
@@ -314,11 +315,11 @@
       : m_name(name)
    {}
 
- char_ptr_holder(const ipcdetail::anonymous_instance_t *)
+ char_ptr_holder(const anonymous_instance_t *)
       : m_name(static_cast<CharType*>(0))
    {}
 
- char_ptr_holder(const ipcdetail::unique_instance_t *)
+ char_ptr_holder(const unique_instance_t *)
       : m_name(reinterpret_cast<CharType*>(-1))
    {}
 
@@ -337,7 +338,7 @@
    typedef typename boost::
       pointer_to_other<VoidPointer, const CharT>::type const_char_ptr_t;
    typedef CharT char_type;
- typedef typename std::iterator_traits<const_char_ptr_t>::difference_type difference_type;
+ typedef typename boost::intrusive::pointer_traits<const_char_ptr_t>::difference_type difference_type;
    typedef typename boost::make_unsigned<difference_type>::type size_type;
 
    private:
@@ -357,8 +358,8 @@
       return (m_len < right.m_len) ||
                (m_len == right.m_len &&
                std::char_traits<char_type>::compare
- (ipcdetail::get_pointer(mp_str)
- ,ipcdetail::get_pointer(right.mp_str), m_len) < 0);
+ (to_raw_pointer(mp_str)
+ ,to_raw_pointer(right.mp_str), m_len) < 0);
    }
 
    //!Equal to function for index ordering
@@ -366,8 +367,8 @@
    {
       return m_len == right.m_len &&
                std::char_traits<char_type>::compare
- (ipcdetail::get_pointer(mp_str),
- ipcdetail::get_pointer(right.mp_str), m_len) == 0;
+ (to_raw_pointer(mp_str),
+ to_raw_pointer(right.mp_str), m_len) == 0;
    }
 
    void name(const CharT *name)
@@ -377,7 +378,7 @@
    { m_len = len; }
 
    const CharT *name() const
- { return ipcdetail::get_pointer(mp_str); }
+ { return to_raw_pointer(mp_str); }
 
    size_type name_length() const
    { return m_len; }
@@ -393,7 +394,7 @@
    index_data(void *ptr) : m_ptr(ptr){}
 
    void *value() const
- { return static_cast<void*>(ipcdetail::get_pointer(m_ptr)); }
+ { return static_cast<void*>(to_raw_pointer(m_ptr)); }
 };
 
 template<class MemoryAlgorithm>
@@ -405,14 +406,14 @@
 {
    typedef typename MemoryAlgorithm::void_pointer void_pointer;
    typedef CharT char_type;
- typedef ipcdetail::index_key<CharT, void_pointer> key_type;
- typedef ipcdetail::index_data<void_pointer> mapped_type;
+ typedef index_key<CharT, void_pointer> key_type;
+ typedef index_data<void_pointer> mapped_type;
    typedef typename segment_manager_base_type
       <MemoryAlgorithm>::type segment_manager_base;
 
    template<class HeaderBase>
    struct intrusive_value_type
- { typedef ipcdetail::intrusive_value_type_impl<HeaderBase, CharT, typename segment_manager_base::size_type> type; };
+ { typedef intrusive_value_type_impl<HeaderBase, CharT, typename segment_manager_base::size_type> type; };
 
    typedef intrusive_compare_key<CharT> intrusive_compare_key_type;
 };
@@ -464,7 +465,7 @@
    const void *value() const
    {
       return reinterpret_cast<block_header<size_type>*>
- (ipcdetail::get_pointer(m_val->second.m_ptr))->value();
+ (to_raw_pointer(m_val->second.m_ptr))->value();
    }
 
    const typename Iterator::value_type *m_val;

Modified: trunk/boost/interprocess/detail/tmp_dir_helpers.hpp
==============================================================================
--- trunk/boost/interprocess/detail/tmp_dir_helpers.hpp (original)
+++ trunk/boost/interprocess/detail/tmp_dir_helpers.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2007-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2007-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)
 //
@@ -43,7 +43,7 @@
       s += bootstamp;
    }
    else{
- s = bootstamp;
+ s.swap(bootstamp);
    }
 }
 #elif defined(BOOST_INTERPROCESS_HAS_BSD_KERNEL_BOOTTIME)
@@ -64,9 +64,10 @@
       , '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
 
    std::size_t char_counter = 0;
- long long fields[2] = { result.tv_sec, result.tv_usec };
+ //32 bit values to allow 32 and 64 bit process IPC
+ boost::uint32_t fields[2] = { boost::uint32_t(result.tv_sec), boost::uint32_t(result.tv_usec) };
    for(std::size_t field = 0; field != 2; ++field){
- for(std::size_t i = 0; i != sizeof(long long); ++i){
+ for(std::size_t i = 0; i != sizeof(fields[0]); ++i){
          const char *ptr = (const char *)&fields[field];
          bootstamp_str[char_counter++] = Characters[(ptr[i]&0xF0)>>4];
          bootstamp_str[char_counter++] = Characters[(ptr[i]&0x0F)];

Modified: trunk/boost/interprocess/detail/transform_iterator.hpp
==============================================================================
--- trunk/boost/interprocess/detail/transform_iterator.hpp (original)
+++ trunk/boost/interprocess/detail/transform_iterator.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009.
+// (C) Copyright Ion Gaztanaga 2005-2011.
 // (C) Copyright Gennaro Prota 2003 - 2004.
 //
 // Distributed under the Boost Software License, Version 1.0.

Modified: trunk/boost/interprocess/detail/type_traits.hpp
==============================================================================
--- trunk/boost/interprocess/detail/type_traits.hpp (original)
+++ trunk/boost/interprocess/detail/type_traits.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 // (C) Copyright John Maddock 2000.
-// (C) Copyright Ion Gaztanaga 2005-2009.
+// (C) Copyright Ion Gaztanaga 2005-2011.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
@@ -40,25 +40,25 @@
 template<class T>
 struct is_reference
 {
- enum { value = false };
+ static const bool value = false;
 };
 
 template<class T>
 struct is_reference<T&>
 {
- enum { value = true };
+ static const bool value = true;
 };
 
 template<class T>
 struct is_pointer
 {
- enum { value = false };
+ static const bool value = false;
 };
 
 template<class T>
 struct is_pointer<T*>
 {
- enum { value = true };
+ static const bool value = true;
 };
 
 template <typename T>
@@ -93,6 +93,30 @@
 struct add_const_reference<T&>
 { typedef T& type; };
 
+template<class T>
+struct remove_const
+{
+ typedef T type;
+};
+
+template<class T>
+struct remove_const<const T>
+{
+ typedef T type;
+};
+
+template<class T>
+struct remove_volatile
+{
+ typedef T type;
+};
+
+template<class T>
+struct remove_volatile<volatile T>
+{
+ typedef T type;
+};
+
 template <typename T, typename U>
 struct is_same
 {
@@ -116,7 +140,6 @@
 } //namespace interprocess {
 } //namespace boost {
 
-#endif //#ifndef BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_HPP
-
 #include <boost/interprocess/detail/config_end.hpp>
 
+#endif //#ifndef BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_HPP

Modified: trunk/boost/interprocess/detail/utilities.hpp
==============================================================================
--- trunk/boost/interprocess/detail/utilities.hpp (original)
+++ trunk/boost/interprocess/detail/utilities.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009.
+// (C) Copyright Ion Gaztanaga 2005-2011.
 // (C) Copyright Gennaro Prota 2003 - 2004.
 //
 // Distributed under the Boost Software License, Version 1.0.
@@ -22,14 +22,15 @@
 #include <boost/interprocess/detail/workaround.hpp>
 
 #include <boost/interprocess/interprocess_fwd.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/type_traits/has_trivial_destructor.hpp>
 #include <boost/interprocess/detail/min_max.hpp>
 #include <boost/interprocess/detail/type_traits.hpp>
 #include <boost/interprocess/detail/transform_iterator.hpp>
 #include <boost/interprocess/detail/mpl.hpp>
 #include <boost/interprocess/containers/version_type.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
+#include <boost/move/move.hpp>
 #include <utility>
 #include <algorithm>
 
@@ -37,29 +38,14 @@
 namespace interprocess {
 namespace ipcdetail {
 
-template<class SmartPtr>
-struct smart_ptr_type
-{
- typedef typename SmartPtr::value_type value_type;
- typedef value_type *pointer;
- static pointer get (const SmartPtr &smartptr)
- { return smartptr.get();}
-};
-
-template<class T>
-struct smart_ptr_type<T*>
-{
- typedef T value_type;
- typedef value_type *pointer;
- static pointer get (pointer ptr)
- { return ptr;}
-};
+template <class T>
+inline T* to_raw_pointer(T* p)
+{ return p; }
 
-//!Overload for smart pointers to avoid ADL problems with get_pointer
-template<class Ptr>
-inline typename smart_ptr_type<Ptr>::pointer
-get_pointer(const Ptr &ptr)
-{ return smart_ptr_type<Ptr>::get(ptr); }
+template <class Pointer>
+inline typename boost::intrusive::pointer_traits<Pointer>::element_type*
+to_raw_pointer(const Pointer &p)
+{ return boost::interprocess::ipcdetail::to_raw_pointer(p.operator->()); }
 
 //!To avoid ADL problems with swap
 template <class T>
@@ -100,14 +86,14 @@
 template <std::size_t OrigSize, std::size_t RoundTo>
 struct ct_rounded_size
 {
- enum { value = ((OrigSize-1)/RoundTo+1)*RoundTo };
+ static const std::size_t value = ((OrigSize-1)/RoundTo+1)*RoundTo;
 };
 
 // Gennaro Prota wrote this. Thanks!
 template <int p, int n = 4>
 struct ct_max_pow2_less
 {
- enum { c = 2*n < p };
+ static const std::size_t c = 2*n < p;
 
    static const std::size_t value =
          c ? (ct_max_pow2_less< c*p, 2*c*n>::value) : n;
@@ -127,7 +113,7 @@
 template <class Index>
 struct is_node_index
 {
- enum { value = false };
+ static const bool value = false;
 };
 
 //!Trait class to detect if an index is an intrusive
@@ -137,7 +123,7 @@
 template <class Index>
 struct is_intrusive_index
 {
- enum { value = false };
+ static const bool value = false;
 };
 
 template <typename T> T*

Modified: trunk/boost/interprocess/detail/variadic_templates_tools.hpp
==============================================================================
--- trunk/boost/interprocess/detail/variadic_templates_tools.hpp (original)
+++ trunk/boost/interprocess/detail/variadic_templates_tools.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //

Modified: trunk/boost/interprocess/detail/win32_api.hpp
==============================================================================
--- trunk/boost/interprocess/detail/win32_api.hpp (original)
+++ trunk/boost/interprocess/detail/win32_api.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -8,11 +8,12 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_INTERPROCESS_WIN32_SYNC_PRIMITIVES_HPP
-#define BOOST_INTERPROCESS_WIN32_SYNC_PRIMITIVES_HPP
+#ifndef BOOST_INTERPROCESS_WIN32_PRIMITIVES_HPP
+#define BOOST_INTERPROCESS_WIN32_PRIMITIVES_HPP
 
 #include <boost/interprocess/detail/config_begin.hpp>
 #include <boost/interprocess/detail/workaround.hpp>
+#include <boost/date_time/filetime_functions.hpp>
 #include <cstddef>
 #include <cstring>
 #include <cassert>
@@ -164,18 +165,20 @@
 static unsigned long key_query_value = 0x0001;
 
 //COM API
-const long RPC_C_AUTHN_LEVEL_PKT_IG = 4;
-const long RPC_C_IMP_LEVEL_IMPERSONATE_IG = 3;
-const long EOAC_NONE_IG = 0;
-const long CLSCTX_INPROC_SERVER_IG = 0x1;
-const long CLSCTX_LOCAL_SERVER_IG = 0x4;
-const long WBEM_FLAG_RETURN_IMMEDIATELY_IG = 0x10;
-const long WBEM_FLAG_RETURN_WHEN_COMPLETE_IG = 0x0;
-const long WBEM_FLAG_FORWARD_ONLY_IG = 0x20;
-const long WBEM_INFINITE_IG = 0xffffffffL;
-const long RPC_E_TOO_LATE_IG = 0x80010119L;
-const long S_OK_IG = 0L;
-const long S_FALSE_IG = 1;
+const unsigned long RPC_C_AUTHN_LEVEL_PKT_BIPC = 4;
+const unsigned long RPC_C_AUTHN_DEFAULT_BIPC = 0xffffffffL;
+const unsigned long RPC_C_AUTHZ_DEFAULT_BIPC = 0xffffffffL;
+const unsigned long RPC_C_IMP_LEVEL_IMPERSONATE_BIPC = 3;
+const signed long EOAC_NONE_BIPC = 0;
+const signed long CLSCTX_INPROC_SERVER_BIPC = 0x1;
+const signed long CLSCTX_LOCAL_SERVER_BIPC = 0x4;
+const signed long WBEM_FLAG_RETURN_IMMEDIATELY_BIPC = 0x10;
+const signed long WBEM_FLAG_RETURN_WHEN_COMPLETE_BIPC = 0x0;
+const signed long WBEM_FLAG_FORWARD_ONLY_BIPC = 0x20;
+const signed long WBEM_INFINITE_BIPC = 0xffffffffL;
+const signed long RPC_E_TOO_LATE_BIPC = 0x80010119L;
+const signed long S_OK_BIPC = 0L;
+const signed long S_FALSE_BIPC = 1;
 
 } //namespace winapi {
 } //namespace interprocess {
@@ -186,7 +189,7 @@
 namespace interprocess {
 namespace winapi {
 
-struct GUID_IG
+struct GUID_BIPC
 {
    unsigned long Data1;
    unsigned short Data2;
@@ -194,10 +197,10 @@
    unsigned char Data4[8];
 };
 
-const GUID_IG CLSID_WbemAdministrativeLocator =
+const GUID_BIPC CLSID_WbemAdministrativeLocator =
    { 0xcb8555cc, 0x9128, 0x11d1, {0xad, 0x9b, 0x00, 0xc0, 0x4f, 0xd8, 0xfd, 0xff}};
 
-const GUID_IG IID_IUnknown = { 0x00000000, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
+const GUID_BIPC IID_IUnknown = { 0x00000000, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
 
 struct wchar_variant
 {
@@ -208,11 +211,11 @@
    } value;
 };
 
- struct IUnknown_IG
+ struct IUnknown_BIPC
    {
       public:
       virtual long __stdcall QueryInterface(
- /* [in] */ const GUID_IG &riid,
+ /* [in] */ const GUID_BIPC &riid,
             /* [iid_is][out] */ void **ppvObject) = 0;
       
       virtual unsigned long __stdcall AddRef( void) = 0;
@@ -220,7 +223,7 @@
       virtual unsigned long __stdcall Release( void) = 0;
    };
 
-struct IWbemClassObject_IG : public IUnknown_IG
+struct IWbemClassObject_BIPC : public IUnknown_BIPC
 {
    public:
    virtual long __stdcall GetQualifierSet(
@@ -265,7 +268,7 @@
       /* [out] */ void **ppQualSet) = 0;
    
    virtual long __stdcall Clone(
- /* [out] */ IWbemClassObject_IG **ppCopy) = 0;
+ /* [out] */ IWbemClassObject_BIPC **ppCopy) = 0;
    
    virtual long __stdcall GetObjectText(
       /* [in] */ long lFlags,
@@ -273,15 +276,15 @@
    
    virtual long __stdcall SpawnDerivedClass(
       /* [in] */ long lFlags,
- /* [out] */ IWbemClassObject_IG **ppNewClass) = 0;
+ /* [out] */ IWbemClassObject_BIPC **ppNewClass) = 0;
    
    virtual long __stdcall SpawnInstance(
       /* [in] */ long lFlags,
- /* [out] */ IWbemClassObject_IG **ppNewInstance) = 0;
+ /* [out] */ IWbemClassObject_BIPC **ppNewInstance) = 0;
    
    virtual long __stdcall CompareTo(
       /* [in] */ long lFlags,
- /* [in] */ IWbemClassObject_IG *pCompareTo) = 0;
+ /* [in] */ IWbemClassObject_BIPC *pCompareTo) = 0;
    
    virtual long __stdcall GetPropertyOrigin(
       /* [string][in] */ const wchar_t * wszName,
@@ -293,14 +296,14 @@
    virtual long __stdcall GetMethod(
       /* [string][in] */ const wchar_t * wszName,
       /* [in] */ long lFlags,
- /* [out] */ IWbemClassObject_IG **ppInSignature,
- /* [out] */ IWbemClassObject_IG **ppOutSignature) = 0;
+ /* [out] */ IWbemClassObject_BIPC **ppInSignature,
+ /* [out] */ IWbemClassObject_BIPC **ppOutSignature) = 0;
    
    virtual long __stdcall PutMethod(
       /* [string][in] */ const wchar_t * wszName,
       /* [in] */ long lFlags,
- /* [in] */ IWbemClassObject_IG *pInSignature,
- /* [in] */ IWbemClassObject_IG *pOutSignature) = 0;
+ /* [in] */ IWbemClassObject_BIPC *pInSignature,
+ /* [in] */ IWbemClassObject_BIPC *pOutSignature) = 0;
    
    virtual long __stdcall DeleteMethod(
       /* [string][in] */ const wchar_t * wszName) = 0;
@@ -311,8 +314,8 @@
    virtual long __stdcall NextMethod(
       /* [in] */ long lFlags,
       /* [unique][in][out] */ wchar_t * *pstrName,
- /* [unique][in][out] */ IWbemClassObject_IG **ppInSignature,
- /* [unique][in][out] */ IWbemClassObject_IG **ppOutSignature) = 0;
+ /* [unique][in][out] */ IWbemClassObject_BIPC **ppInSignature,
+ /* [unique][in][out] */ IWbemClassObject_BIPC **ppOutSignature) = 0;
    
    virtual long __stdcall EndMethodEnumeration( void) = 0;
    
@@ -327,11 +330,11 @@
 };
 
 
-struct IWbemContext_IG : public IUnknown_IG
+struct IWbemContext_BIPC : public IUnknown_BIPC
 {
 public:
    virtual long __stdcall Clone(
- /* [out] */ IWbemContext_IG **ppNewCopy) = 0;
+ /* [out] */ IWbemContext_BIPC **ppNewCopy) = 0;
    
    virtual long __stdcall GetNames(
       /* [in] */ long lFlags,
@@ -366,7 +369,7 @@
 };
 
 
-struct IEnumWbemClassObject_IG : public IUnknown_IG
+struct IEnumWbemClassObject_BIPC : public IUnknown_BIPC
 {
 public:
    virtual long __stdcall Reset( void) = 0;
@@ -374,7 +377,7 @@
    virtual long __stdcall Next(
       /* [in] */ long lTimeout,
       /* [in] */ unsigned long uCount,
- /* [length_is][size_is][out] */ IWbemClassObject_IG **apObjects,
+ /* [length_is][size_is][out] */ IWbemClassObject_BIPC **apObjects,
       /* [out] */ unsigned long *puReturned) = 0;
    
    virtual long __stdcall NextAsync(
@@ -390,7 +393,7 @@
    
 };
 
-struct IWbemServices_IG : public IUnknown_IG
+struct IWbemServices_BIPC : public IUnknown_BIPC
 {
 public:
    virtual long __stdcall OpenNamespace(
@@ -421,13 +424,13 @@
       /* [in] */ void *pResponseHandler) = 0;
    
    virtual long __stdcall PutClass(
- /* [in] */ IWbemClassObject_IG *pObject,
+ /* [in] */ IWbemClassObject_BIPC *pObject,
       /* [in] */ long lFlags,
       /* [in] */ void *pCtx,
       /* [unique][in][out] */ void **ppCallResult) = 0;
    
    virtual long __stdcall PutClassAsync(
- /* [in] */ IWbemClassObject_IG *pObject,
+ /* [in] */ IWbemClassObject_BIPC *pObject,
       /* [in] */ long lFlags,
       /* [in] */ void *pCtx,
       /* [in] */ void *pResponseHandler) = 0;
@@ -496,50 +499,50 @@
       /* [in] */ const wchar_t * strQueryLanguage,
       /* [in] */ const wchar_t * strQuery,
       /* [in] */ long lFlags,
- /* [in] */ IWbemContext_IG *pCtx,
- /* [out] */ IEnumWbemClassObject_IG **ppEnum) = 0;
+ /* [in] */ IWbemContext_BIPC *pCtx,
+ /* [out] */ IEnumWbemClassObject_BIPC **ppEnum) = 0;
 
    virtual long __stdcall ExecQueryAsync(
       /* [in] */ const wchar_t * strQueryLanguage,
       /* [in] */ const wchar_t * strQuery,
       /* [in] */ long lFlags,
- /* [in] */ IWbemContext_IG *pCtx,
+ /* [in] */ IWbemContext_BIPC *pCtx,
       /* [in] */ void *pResponseHandler) = 0;
    
    virtual long __stdcall ExecNotificationQuery(
       /* [in] */ const wchar_t * strQueryLanguage,
       /* [in] */ const wchar_t * strQuery,
       /* [in] */ long lFlags,
- /* [in] */ IWbemContext_IG *pCtx,
+ /* [in] */ IWbemContext_BIPC *pCtx,
       /* [out] */ void **ppEnum) = 0;
    
    virtual long __stdcall ExecNotificationQueryAsync(
       /* [in] */ const wchar_t * strQueryLanguage,
       /* [in] */ const wchar_t * strQuery,
       /* [in] */ long lFlags,
- /* [in] */ IWbemContext_IG *pCtx,
+ /* [in] */ IWbemContext_BIPC *pCtx,
       /* [in] */ void *pResponseHandler) = 0;
    
    virtual long __stdcall ExecMethod(
       /* [in] */ const wchar_t * strObjectPath,
       /* [in] */ const wchar_t * strMethodName,
       /* [in] */ long lFlags,
- /* [in] */ IWbemContext_IG *pCtx,
- /* [in] */ IWbemClassObject_IG *pInParams,
- /* [unique][in][out] */ IWbemClassObject_IG **ppOutParams,
+ /* [in] */ IWbemContext_BIPC *pCtx,
+ /* [in] */ IWbemClassObject_BIPC *pInParams,
+ /* [unique][in][out] */ IWbemClassObject_BIPC **ppOutParams,
       /* [unique][in][out] */ void **ppCallResult) = 0;
    
    virtual long __stdcall ExecMethodAsync(
       /* [in] */ const wchar_t * strObjectPath,
       /* [in] */ const wchar_t * strMethodName,
       /* [in] */ long lFlags,
- /* [in] */ IWbemContext_IG *pCtx,
- /* [in] */ IWbemClassObject_IG *pInParams,
+ /* [in] */ IWbemContext_BIPC *pCtx,
+ /* [in] */ IWbemClassObject_BIPC *pInParams,
       /* [in] */ void *pResponseHandler) = 0;
    
 };
 
-struct IWbemLocator_IG : public IUnknown_IG
+struct IWbemLocator_BIPC : public IUnknown_BIPC
 {
 public:
    virtual long __stdcall ConnectServer(
@@ -550,7 +553,7 @@
       /* [in] */ long lSecurityFlags,
       /* [in] */ const wchar_t * strAuthority,
       /* [in] */ void *pCtx,
- /* [out] */ IWbemServices_IG **ppNamespace) = 0;
+ /* [out] */ IWbemServices_BIPC **ppNamespace) = 0;
    
 };
  
@@ -803,8 +806,8 @@
 extern "C" __declspec(dllimport) void *__stdcall FindFirstFileA(const char *lpFileName, win32_find_data_t *lpFindFileData);
 extern "C" __declspec(dllimport) int __stdcall FindNextFileA(void *hFindFile, win32_find_data_t *lpFindFileData);
 extern "C" __declspec(dllimport) int __stdcall FindClose(void *hFindFile);
-extern "C" __declspec(dllimport) void __stdcall GetSystemTimeAsFileTime(interprocess_filetime*);
-extern "C" __declspec(dllimport) int __stdcall FileTimeToLocalFileTime(const interprocess_filetime *in, const interprocess_filetime *out);
+//extern "C" __declspec(dllimport) void __stdcall GetSystemTimeAsFileTime(interprocess_filetime*);
+//extern "C" __declspec(dllimport) int __stdcall FileTimeToLocalFileTime(const interprocess_filetime *in, const interprocess_filetime *out);
 extern "C" __declspec(dllimport) void * __stdcall CreateMutexA(interprocess_security_attributes*, int, const char *);
 extern "C" __declspec(dllimport) void * __stdcall OpenMutexA(unsigned long, int, const char *);
 extern "C" __declspec(dllimport) unsigned long __stdcall WaitForSingleObject(void *, unsigned long);
@@ -852,6 +855,7 @@
 extern "C" __declspec(dllimport) long __stdcall RegOpenKeyExA(void *, const char *, unsigned long, unsigned long, void **);
 extern "C" __declspec(dllimport) long __stdcall RegQueryValueExA(void *, const char *, unsigned long*, unsigned long*, unsigned char *, unsigned long*);
 extern "C" __declspec(dllimport) long __stdcall RegCloseKey(void *);
+extern "C" __declspec(dllimport) int __stdcall QueryPerformanceCounter(__int64 *lpPerformanceCount);
 
 //COM API
 extern "C" __declspec(dllimport) long __stdcall CoInitialize(void *pvReserved);
@@ -866,9 +870,19 @@
                     unsigned long dwCapabilities,
                     void *pReserved3 );
 
+ extern "C" __declspec(dllimport) long __stdcall CoSetProxyBlanket(
+ IUnknown_BIPC *pProxy,
+ unsigned long dwAuthnSvc,
+ unsigned long dwAuthzSvc,
+ wchar_t *pServerPrincName,
+ unsigned long dwAuthnLevel,
+ unsigned long dwImpLevel,
+ void *pAuthInfo,
+ unsigned long dwCapabilities);
+
 extern "C" __declspec(dllimport) long __stdcall VariantClear(wchar_variant * pvarg);
-extern "C" __declspec(dllimport) long __stdcall CoCreateInstance(const GUID_IG & rclsid, IUnknown_IG *pUnkOuter,
- unsigned long dwClsContext, const GUID_IG & riid, void** ppv);
+extern "C" __declspec(dllimport) long __stdcall CoCreateInstance(const GUID_BIPC & rclsid, IUnknown_BIPC *pUnkOuter,
+ unsigned long dwClsContext, const GUID_BIPC & riid, void** ppv);
 extern "C" __declspec(dllimport) void __stdcall CoUninitialize(void);
 
 
@@ -928,6 +942,9 @@
    }
 }
 
+inline void sleep(unsigned long ms)
+{ Sleep(ms); }
+
 inline unsigned long get_current_thread_id()
 { return GetCurrentThreadId(); }
 
@@ -960,19 +977,16 @@
       , lpTargetHandle, 0, 0
       , duplicate_same_access);
 }
-
+/*
 inline void get_system_time_as_file_time(interprocess_filetime *filetime)
 { GetSystemTimeAsFileTime(filetime); }
 
 inline bool file_time_to_local_file_time
    (const interprocess_filetime *in, const interprocess_filetime *out)
 { return 0 != FileTimeToLocalFileTime(in, out); }
-
-inline void *create_mutex(const char *name)
-{ return CreateMutexA(0, 0, name); }
-
-inline void *open_mutex(const char *name)
-{ return OpenMutexA(mutex_all_access, 0, name); }
+*/
+inline void *open_or_create_mutex(const char *name, bool initial_owner, interprocess_security_attributes *attr)
+{ return CreateMutexA(attr, (int)initial_owner, name); }
 
 inline unsigned long wait_for_single_object(void *handle, unsigned long time)
 { return WaitForSingleObject(handle, time); }
@@ -983,15 +997,12 @@
 inline int unmap_view_of_file(void *address)
 { return UnmapViewOfFile(address); }
 
-inline void *create_semaphore(long initialCount, const char *name)
-{ return CreateSemaphoreA(0, initialCount, (long)(((unsigned long)(-1))>>1), name); }
+inline void *open_or_create_semaphore(const char *name, long initial_count, long maximum_count, interprocess_security_attributes *attr)
+{ return CreateSemaphoreA(attr, initial_count, maximum_count, name); }
 
 inline int release_semaphore(void *handle, long release_count, long *prev_count)
 { return ReleaseSemaphore(handle, release_count, prev_count); }
 
-inline void *open_semaphore(const char *name)
-{ return OpenSemaphoreA(semaphore_all_access, 1, name); }
-
 class interprocess_all_access_security
 {
    interprocess_security_attributes sa;
@@ -1136,6 +1147,11 @@
 inline long reg_close_key(void *hKey)
 { return RegCloseKey(hKey); }
 
+inline bool query_performance_counter(__int64 *lpPerformanceCount)
+{
+ return 0 != QueryPerformanceCounter(lpPerformanceCount);
+}
+
 inline void initialize_object_attributes
 ( object_attributes_t *pobject_attr, unicode_string_t *name
  , unsigned long attr, void *rootdir, void *security_descr)
@@ -1181,7 +1197,7 @@
    static void *get_module(const unsigned int id)
    {
       assert(id < (unsigned int)NumModule);
- while(ModuleStates[id] < 2u){
+ while(ModuleStates[id] < 2){
          if(interlocked_compare_exchange(&ModuleStates[id], 1, 0) == 0){
             ModuleAddresses[id] = get_module_from_id(id);
             interlocked_increment(&ModuleStates[id]);
@@ -1207,7 +1223,7 @@
    static void *get(const unsigned int id)
    {
       assert(id < (unsigned int)NumFunction);
- while(FunctionStates[id] < 2u){
+ while(FunctionStates[id] < 2){
          if(interlocked_compare_exchange(&FunctionStates[id], 1, 0) == 0){
             FunctionAddresses[id] = get_address_from_dll(id);
             interlocked_increment(&FunctionStates[id]);
@@ -1600,7 +1616,7 @@
 {
    //See example http://msdn.microsoft.com/en-us/library/aa390423%28v=VS.85%29.aspx
    long co_init_ret = CoInitialize(0);
- if(co_init_ret != S_OK_IG && co_init_ret != S_FALSE_IG)
+ if(co_init_ret != S_OK_BIPC && co_init_ret != S_FALSE_BIPC)
       return false;
    co_uninitializer co_initialize_end;
    (void)co_initialize_end;
@@ -1611,28 +1627,28 @@
       ,-1 //cAuthSvc
       , 0 //asAuthSvc
       , 0 //pReserved1
- , RPC_C_AUTHN_LEVEL_PKT_IG //dwAuthnLevel
- , RPC_C_IMP_LEVEL_IMPERSONATE_IG //dwImpLevel
+ , RPC_C_AUTHN_LEVEL_PKT_BIPC //dwAuthnLevel
+ , RPC_C_IMP_LEVEL_IMPERSONATE_BIPC //dwImpLevel
       , 0 //pAuthList
- , EOAC_NONE_IG //dwCapabilities
+ , EOAC_NONE_BIPC //dwCapabilities
       , 0 //pReserved3
       );
- if( 0 == sec_init_ret || RPC_E_TOO_LATE_IG == sec_init_ret)
+ if( 0 == sec_init_ret || RPC_E_TOO_LATE_BIPC == sec_init_ret)
    {
- IWbemLocator_IG * pIWbemLocator = 0;
+ IWbemLocator_BIPC * pIWbemLocator = 0;
       const wchar_t * bstrNamespace = L"root\\cimv2";
  
       if( 0 != CoCreateInstance(
             CLSID_WbemAdministrativeLocator,
             0,
- CLSCTX_INPROC_SERVER_IG | CLSCTX_LOCAL_SERVER_IG,
+ CLSCTX_INPROC_SERVER_BIPC | CLSCTX_LOCAL_SERVER_BIPC,
             IID_IUnknown, (void **)&pIWbemLocator)){
          return false;
       }
  
- com_releaser<IWbemLocator_IG> IWbemLocator_releaser(pIWbemLocator);
+ com_releaser<IWbemLocator_BIPC> IWbemLocator_releaser(pIWbemLocator);
 
- IWbemServices_IG *pWbemServices = 0;
+ IWbemServices_BIPC *pWbemServices = 0;
 
       if( 0 != pIWbemLocator->ConnectServer(
             bstrNamespace, // Namespace
@@ -1648,7 +1664,21 @@
          return false;
       }
 
- com_releaser<IWbemServices_IG> IWbemServices_releaser(pWbemServices);
+ if( S_OK_BIPC != CoSetProxyBlanket(
+ pWbemServices,
+ RPC_C_AUTHN_DEFAULT_BIPC,
+ RPC_C_AUTHZ_DEFAULT_BIPC,
+ NULL,
+ RPC_C_AUTHN_LEVEL_PKT_BIPC,
+ RPC_C_IMP_LEVEL_IMPERSONATE_BIPC,
+ NULL,
+ EOAC_NONE_BIPC
+ )
+ ){
+ return false;
+ }
+
+ com_releaser<IWbemServices_BIPC> IWbemServices_releaser(pWbemServices);
 
       strValue.clear();
       strValue += L"Select ";
@@ -1656,13 +1686,13 @@
       strValue += L" from ";
       strValue += wmi_class;
 
- IEnumWbemClassObject_IG * pEnumObject = 0;
+ IEnumWbemClassObject_BIPC * pEnumObject = 0;
 
       if ( 0 != pWbemServices->ExecQuery(
             L"WQL",
             strValue.c_str(),
- //WBEM_FLAG_RETURN_IMMEDIATELY_IG,
- WBEM_FLAG_RETURN_WHEN_COMPLETE_IG | WBEM_FLAG_FORWARD_ONLY_IG,
+ //WBEM_FLAG_RETURN_IMMEDIATELY_BIPC,
+ WBEM_FLAG_RETURN_WHEN_COMPLETE_BIPC | WBEM_FLAG_FORWARD_ONLY_BIPC,
             0,
             &pEnumObject
             )
@@ -1670,19 +1700,19 @@
          return false;
       }
 
- com_releaser<IEnumWbemClassObject_IG> IEnumWbemClassObject_releaser(pEnumObject);
+ com_releaser<IEnumWbemClassObject_BIPC> IEnumWbemClassObject_releaser(pEnumObject);
 
- //WBEM_FLAG_FORWARD_ONLY_IG incompatible with Reset
+ //WBEM_FLAG_FORWARD_ONLY_BIPC incompatible with Reset
       //if ( 0 != pEnumObject->Reset() ){
          //return false;
       //}
 
       wchar_variant vwchar;
       unsigned long uCount = 1, uReturned;
- IWbemClassObject_IG * pClassObject = 0;
- while( 0 == pEnumObject->Next( WBEM_INFINITE_IG, uCount, &pClassObject, &uReturned ) )
+ IWbemClassObject_BIPC * pClassObject = 0;
+ while( 0 == pEnumObject->Next( WBEM_INFINITE_BIPC, uCount, &pClassObject, &uReturned ) )
       {
- com_releaser<IWbemClassObject_IG> IWbemClassObject_releaser(pClassObject);
+ com_releaser<IWbemClassObject_BIPC> IWbemClassObject_releaser(pClassObject);
          if ( 0 == pClassObject->Get( L"LastBootUpTime", 0, &vwchar, 0, 0 ) ){
             bRet = true;
             strValue = vwchar.value.pbstrVal;
@@ -1733,4 +1763,4 @@
 
 #include <boost/interprocess/detail/config_end.hpp>
 
-#endif //#ifdef BOOST_INTERPROCESS_WIN32_SYNC_PRIMITIVES_HPP
+#endif //#ifdef BOOST_INTERPROCESS_WIN32_PRIMITIVES_HPP

Modified: trunk/boost/interprocess/detail/workaround.hpp
==============================================================================
--- trunk/boost/interprocess/detail/workaround.hpp (original)
+++ trunk/boost/interprocess/detail/workaround.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -25,7 +25,7 @@
 
 #endif
 
-#if !(defined BOOST_INTERPROCESS_WINDOWS)
+#if !defined(BOOST_INTERPROCESS_WINDOWS)
 
    #include <unistd.h>
 

Modified: trunk/boost/interprocess/detail/xsi_shared_memory_device.hpp
==============================================================================
--- trunk/boost/interprocess/detail/xsi_shared_memory_device.hpp (original)
+++ trunk/boost/interprocess/detail/xsi_shared_memory_device.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2009-2010. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2009-2011. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -75,7 +75,7 @@
 
    xsi_shared_memory_device &operator=(BOOST_RV_REF(xsi_shared_memory_device) moved)
    {
- xsi_shared_memory_device tmp(boost::interprocess::move(moved));
+ xsi_shared_memory_device tmp(boost::move(moved));
       this->swap(tmp);
       return *this;
    }
@@ -204,8 +204,8 @@
    xsi_shared_memory index_shm(open_or_create, xsi_shm_emulation_file_path.c_str(), 1, MemSize, 0666);
    mapped_region r(index_shm, read_write, 0, MemSize, 0);
    xsi_named_mutex m(open_or_create, xsi_shm_emulation_file_path.c_str(), 2, 0666);
- reg = boost::interprocess::move(r);
- mut = boost::interprocess::move(m);
+ reg = boost::move(r);
+ mut = boost::move(m);
    path.swap(xsi_shm_emulation_file_path);
 }
 
@@ -246,17 +246,17 @@
          throw interprocess_exception(err);
       }
       xsi_shared_memory temp(open_only, filepath, id, perm);
- m_shm = boost::interprocess::move(temp);
+ m_shm = boost::move(temp);
    }
    else if(type == ipcdetail::DoCreate){
       //Try to reuse slot
       xsi_shared_memory temp(create_only, filepath, id, size, perm);
       std::strcpy(info->names[target_entry].buf, shmname);
- m_shm = boost::interprocess::move(temp);
+ m_shm = boost::move(temp);
    }
    else{ // if(type == ipcdetail::DoOpenOrCreate){
       xsi_shared_memory temp(open_or_create, filepath, id, size, perm);
- m_shm = boost::interprocess::move(temp);
+ m_shm = boost::move(temp);
    }
 
    m_mode = mode;
@@ -318,7 +318,7 @@
          }
          xsi_shared_memory temp( open_only, xsi_shm_emulation_file_path.c_str()
                                , target_entry+info_constants_t<0>::FirstID, perm);
- m_shm = boost::interprocess::move(temp);
+ m_shm = boost::move(temp);
       }
       else{
 
@@ -327,7 +327,7 @@
             xsi_shared_memory temp( create_only, xsi_shm_emulation_file_path.c_str()
                                   , target_entry+info_constants_t<0>::FirstID, size, perm);
             std::strcpy(info->names[target_entry].buf, shmname);
- m_shm = boost::interprocess::move(temp);
+ m_shm = boost::move(temp);
          }
          else{ // if(type == ipcdetail::DoOpenOrCreate){
             xsi_shared_memory temp( open_or_create, xsi_shm_emulation_file_path.c_str()
@@ -336,7 +336,7 @@
                std::memset(info->names[target_entry].buf, 0, info_constants_t<0>::MaxName);
                std::strcpy(info->names[target_entry].buf, shmname);
             }
- m_shm = boost::interprocess::move(temp);
+ m_shm = boost::move(temp);
          }
       }
    }

Modified: trunk/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp
==============================================================================
--- trunk/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp (original)
+++ trunk/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2009-2010. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2009-2011. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -62,7 +62,7 @@
 
    xsi_shared_memory_file_wrapper &operator=(BOOST_RV_REF(xsi_shared_memory_file_wrapper) moved)
    {
- xsi_shared_memory_file_wrapper tmp(boost::interprocess::move(moved));
+ xsi_shared_memory_file_wrapper tmp(boost::move(moved));
       this->swap(tmp);
       return *this;
    }

Modified: trunk/boost/interprocess/errors.hpp
==============================================================================
--- trunk/boost/interprocess/errors.hpp (original)
+++ trunk/boost/interprocess/errors.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -114,6 +114,7 @@
    not_such_file_or_directory,
    invalid_argument,
    timeout_when_locking_error,
+ timeout_when_waiting_error,
 };
 
 typedef int native_error_t;

Modified: trunk/boost/interprocess/exceptions.hpp
==============================================================================
--- trunk/boost/interprocess/exceptions.hpp (original)
+++ trunk/boost/interprocess/exceptions.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //

Modified: trunk/boost/interprocess/file_mapping.hpp
==============================================================================
--- trunk/boost/interprocess/file_mapping.hpp (original)
+++ trunk/boost/interprocess/file_mapping.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -19,7 +19,7 @@
 #include <boost/interprocess/detail/utilities.hpp>
 #include <boost/interprocess/creation_tags.hpp>
 #include <boost/interprocess/detail/os_file_functions.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <string> //std::string
 
 //!\file
@@ -59,7 +59,7 @@
    //!Does not throw
    file_mapping &operator=(BOOST_RV_REF(file_mapping) moved)
    {
- file_mapping tmp(boost::interprocess::move(moved));
+ file_mapping tmp(boost::move(moved));
       this->swap(tmp);
       return *this;
    }

Modified: trunk/boost/interprocess/indexes/flat_map_index.hpp
==============================================================================
--- trunk/boost/interprocess/indexes/flat_map_index.hpp (original)
+++ trunk/boost/interprocess/indexes/flat_map_index.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //

Modified: trunk/boost/interprocess/indexes/iset_index.hpp
==============================================================================
--- trunk/boost/interprocess/indexes/iset_index.hpp (original)
+++ trunk/boost/interprocess/indexes/iset_index.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -138,7 +138,7 @@
 struct is_intrusive_index
    <boost::interprocess::iset_index<MapConfig> >
 {
- enum{ value = true };
+ static const bool value = true;
 };
 /// @endcond
 

Modified: trunk/boost/interprocess/indexes/iunordered_set_index.hpp
==============================================================================
--- trunk/boost/interprocess/indexes/iunordered_set_index.hpp (original)
+++ trunk/boost/interprocess/indexes/iunordered_set_index.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -16,7 +16,7 @@
 
 #include <functional>
 #include <utility>
-#include <boost/get_pointer.hpp>
+
 #include <boost/interprocess/detail/utilities.hpp>
 #include <boost/interprocess/containers/vector.hpp>
 #include <boost/intrusive/unordered_set.hpp>
@@ -84,7 +84,7 @@
     {
         std::size_t operator()(const value_type &val) const
         {
- const char_type *beg = ipcdetail::get_pointer(val.name()),
+ const char_type *beg = ipcdetail::to_raw_pointer(val.name()),
                             *end = beg + val.name_length();
             return boost::hash_range(beg, end);
         }
@@ -156,7 +156,7 @@
    typedef typename index_aux::
       segment_manager_base segment_manager_base;
 
- enum { InitBufferSize = 64};
+ static const std::size_t InitBufferSize = 64;
 
    static bucket_ptr create_buckets(allocator_type &alloc, size_type num)
    {
@@ -164,7 +164,7 @@
       bucket_ptr buckets = alloc.allocate(num);
       bucket_ptr buckets_init = buckets;
       for(size_type i = 0; i < num; ++i){
- new(get_pointer(buckets_init++))bucket_type();
+ new(to_raw_pointer(buckets_init++))bucket_type();
       }
       return buckets;
    }
@@ -181,8 +181,8 @@
          return old_size;
       }
 
- for( bucket_type *p = ipcdetail::get_pointer(buckets) + received_size
- , *pend = ipcdetail::get_pointer(buckets) + old_size
+ for( bucket_type *p = ipcdetail::to_raw_pointer(buckets) + received_size
+ , *pend = ipcdetail::to_raw_pointer(buckets) + old_size
          ; p != pend
          ; ++p){
          p->~bucket_type();
@@ -194,7 +194,7 @@
 
       bucket_ptr buckets_init = buckets + received_size;
       for(size_type i = 0; i < (old_size - received_size); ++i){
- get_pointer(buckets_init++)->~bucket_type();
+ to_raw_pointer(buckets_init++)->~bucket_type();
       }
       return received_size;
    }
@@ -210,13 +210,13 @@
       if(ret.first == old_buckets){
          bucket_ptr buckets_init = old_buckets + old_num;
          for(size_type i = 0; i < (new_num - old_num); ++i){
- new(get_pointer(buckets_init++))bucket_type();
+ new(to_raw_pointer(buckets_init++))bucket_type();
          }
       }
       else{
          bucket_ptr buckets_init = ret.first;
          for(size_type i = 0; i < new_num; ++i){
- new(get_pointer(buckets_init++))bucket_type();
+ new(to_raw_pointer(buckets_init++))bucket_type();
          }
       }
 
@@ -228,7 +228,7 @@
    {
       bucket_ptr buckets_destroy = buckets;
       for(size_type i = 0; i < num; ++i){
- get_pointer(buckets_destroy++)->~bucket_type();
+ to_raw_pointer(buckets_destroy++)->~bucket_type();
       }
       alloc.deallocate(buckets, num);
    }
@@ -357,7 +357,7 @@
 struct is_intrusive_index
    <boost::interprocess::iunordered_set_index<MapConfig> >
 {
- enum{ value = true };
+ static const bool value = true;
 };
 /// @endcond
 

Modified: trunk/boost/interprocess/indexes/map_index.hpp
==============================================================================
--- trunk/boost/interprocess/indexes/map_index.hpp (original)
+++ trunk/boost/interprocess/indexes/map_index.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -89,7 +89,7 @@
 struct is_node_index
    <boost::interprocess::map_index<MapConfig> >
 {
- enum { value = true };
+ static const bool value = true;
 };
 /// @endcond
 

Modified: trunk/boost/interprocess/indexes/null_index.hpp
==============================================================================
--- trunk/boost/interprocess/indexes/null_index.hpp (original)
+++ trunk/boost/interprocess/indexes/null_index.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //

Modified: trunk/boost/interprocess/indexes/unordered_map_index.hpp
==============================================================================
--- trunk/boost/interprocess/indexes/unordered_map_index.hpp (original)
+++ trunk/boost/interprocess/indexes/unordered_map_index.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -48,7 +48,7 @@
         std::size_t operator()(const key_type &val) const
         {
             typedef typename key_type::char_type char_type;
- const char_type *beg = ipcdetail::get_pointer(val.mp_str),
+ const char_type *beg = ipcdetail::to_raw_pointer(val.mp_str),
                             *end = beg + val.m_len;
             return boost::hash_range(beg, end);
         }
@@ -102,7 +102,7 @@
 struct is_node_index
    <boost::interprocess::unordered_map_index<MapConfig> >
 {
- enum { value = true };
+ static const bool value = true;
 };
 /// @endcond
 

Modified: trunk/boost/interprocess/interprocess_fwd.hpp
==============================================================================
--- trunk/boost/interprocess/interprocess_fwd.hpp (original)
+++ trunk/boost/interprocess/interprocess_fwd.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //

Modified: trunk/boost/interprocess/ipc/message_queue.hpp
==============================================================================
--- trunk/boost/interprocess/ipc/message_queue.hpp (original)
+++ trunk/boost/interprocess/ipc/message_queue.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -28,6 +28,7 @@
 #include <boost/pointer_to_other.hpp>
 #include <boost/type_traits/make_unsigned.hpp>
 #include <boost/type_traits/alignment_of.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <algorithm> //std::lower_bound
 #include <cstddef> //std::size_t
 #include <cstring> //memcpy
@@ -55,7 +56,7 @@
    public:
    typedef VoidPointer void_pointer;
    typedef typename boost::pointer_to_other<void_pointer, char>::type char_ptr;
- typedef typename std::iterator_traits<char_ptr>::difference_type difference_type;
+ typedef typename boost::intrusive::pointer_traits<char_ptr>::difference_type difference_type;
    typedef typename boost::make_unsigned<difference_type>::type size_type;
 
    //!Creates a process shared message queue with name "name". For this message queue,
@@ -185,11 +186,11 @@
 template<class VoidPointer>
 class msg_hdr_t
 {
- typedef VoidPointer void_pointer;
+ typedef VoidPointer void_pointer;
    typedef typename boost::
- pointer_to_other<VoidPointer, char>::type char_ptr;
- typedef typename std::iterator_traits<char_ptr>::difference_type difference_type;
- typedef typename boost::make_unsigned<difference_type>::type size_type;
+ pointer_to_other<VoidPointer, char>::type char_ptr;
+ typedef typename boost::intrusive::pointer_traits<char_ptr>::difference_type difference_type;
+ typedef typename boost::make_unsigned<difference_type>::type size_type;
 
    public:
    size_type len; // Message length
@@ -247,12 +248,13 @@
 class mq_hdr_t
    : public ipcdetail::priority_functor<VoidPointer>
 {
- typedef VoidPointer void_pointer;
- typedef msg_hdr_t<void_pointer> msg_header;
+ typedef VoidPointer void_pointer;
+ typedef msg_hdr_t<void_pointer> msg_header;
    typedef typename boost::
- pointer_to_other<void_pointer, msg_header>::type msg_hdr_ptr_t;
- typedef typename std::iterator_traits<msg_hdr_ptr_t>::difference_type difference_type;
- typedef typename boost::make_unsigned<difference_type>::type size_type;
+ pointer_to_other<void_pointer, msg_header>::type msg_hdr_ptr_t;
+ typedef typename boost::intrusive::pointer_traits
+ <msg_hdr_ptr_t>::difference_type difference_type;
+ typedef typename boost::make_unsigned<difference_type>::type size_type;
    typedef typename boost::
       pointer_to_other<void_pointer, msg_hdr_ptr_t>::type msg_hdr_ptr_ptr_t;
 
@@ -374,7 +376,7 @@
 {
    public:
    typedef typename boost::pointer_to_other<VoidPointer, char>::type char_ptr;
- typedef typename std::iterator_traits<char_ptr>::difference_type difference_type;
+ typedef typename boost::intrusive::pointer_traits<char_ptr>::difference_type difference_type;
    typedef typename boost::make_unsigned<difference_type>::type size_type;
 
    initialization_func_t(size_type maxmsg = 0,

Modified: trunk/boost/interprocess/managed_external_buffer.hpp
==============================================================================
--- trunk/boost/interprocess/managed_external_buffer.hpp (original)
+++ trunk/boost/interprocess/managed_external_buffer.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -19,8 +19,13 @@
 #include <boost/interprocess/detail/workaround.hpp>
 #include <boost/interprocess/creation_tags.hpp>
 #include <boost/interprocess/detail/managed_memory_impl.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/assert.hpp>
+//These includes needed to fulfill default template parameters of
+//predeclarations in interprocess_fwd.hpp
+#include <boost/interprocess/mem_algo/rbtree_best_fit.hpp>
+#include <boost/interprocess/sync/mutex_family.hpp>
+#include <boost/interprocess/indexes/iset_index.hpp>
 
 //!\file
 //!Describes a named user memory allocation user class.
@@ -85,7 +90,7 @@
    //!Moves the ownership of "moved"'s managed memory to *this. Does not throw
    basic_managed_external_buffer &operator=(BOOST_RV_REF(basic_managed_external_buffer) moved)
    {
- basic_managed_external_buffer tmp(boost::interprocess::move(moved));
+ basic_managed_external_buffer tmp(boost::move(moved));
       this->swap(tmp);
       return *this;
    }

Modified: trunk/boost/interprocess/managed_heap_memory.hpp
==============================================================================
--- trunk/boost/interprocess/managed_heap_memory.hpp (original)
+++ trunk/boost/interprocess/managed_heap_memory.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -18,10 +18,15 @@
 #include <boost/interprocess/detail/config_begin.hpp>
 #include <boost/interprocess/detail/workaround.hpp>
 #include <boost/interprocess/creation_tags.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <vector>
 #include <boost/interprocess/detail/managed_memory_impl.hpp>
 #include <boost/detail/no_exceptions_support.hpp>
+//These includes needed to fulfill default template parameters of
+//predeclarations in interprocess_fwd.hpp
+#include <boost/interprocess/mem_algo/rbtree_best_fit.hpp>
+#include <boost/interprocess/sync/mutex_family.hpp>
+#include <boost/interprocess/indexes/iset_index.hpp>
 
 //!\file
 //!Describes a named heap memory allocation user class.
@@ -79,7 +84,7 @@
    //!Moves the ownership of "moved"'s managed memory to *this. Does not throw
    basic_managed_heap_memory &operator=(BOOST_RV_REF(basic_managed_heap_memory) moved)
    {
- basic_managed_heap_memory tmp(boost::interprocess::move(moved));
+ basic_managed_heap_memory tmp(boost::move(moved));
       this->swap(tmp);
       return *this;
    }

Modified: trunk/boost/interprocess/managed_mapped_file.hpp
==============================================================================
--- trunk/boost/interprocess/managed_mapped_file.hpp (original)
+++ trunk/boost/interprocess/managed_mapped_file.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -21,9 +21,14 @@
 #include <boost/interprocess/detail/managed_memory_impl.hpp>
 #include <boost/interprocess/creation_tags.hpp>
 #include <boost/interprocess/detail/file_wrapper.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/interprocess/file_mapping.hpp>
 #include <boost/interprocess/permissions.hpp>
+//These includes needed to fulfill default template parameters of
+//predeclarations in interprocess_fwd.hpp
+#include <boost/interprocess/mem_algo/rbtree_best_fit.hpp>
+#include <boost/interprocess/sync/mutex_family.hpp>
+#include <boost/interprocess/indexes/iset_index.hpp>
 
 namespace boost {
 namespace interprocess {
@@ -40,20 +45,25 @@
 class basic_managed_mapped_file
    : public ipcdetail::basic_managed_memory_impl
       <CharType, AllocationAlgorithm, IndexType
- ,ipcdetail::managed_open_or_create_impl<ipcdetail::file_wrapper>::ManagedOpenOrCreateUserOffset>
+ ,ipcdetail::managed_open_or_create_impl< ipcdetail::file_wrapper
+ , AllocationAlgorithm::Alignment>::ManagedOpenOrCreateUserOffset
+ >
 {
    /// @cond
    public:
    typedef ipcdetail::basic_managed_memory_impl
       <CharType, AllocationAlgorithm, IndexType,
- ipcdetail::managed_open_or_create_impl<ipcdetail::file_wrapper>::ManagedOpenOrCreateUserOffset> base_t;
+ ipcdetail::managed_open_or_create_impl
+ <ipcdetail::file_wrapper, AllocationAlgorithm::Alignment>::ManagedOpenOrCreateUserOffset
+ > base_t;
    typedef ipcdetail::file_wrapper device_type;
    typedef typename base_t::size_type size_type;
 
    private:
 
    typedef ipcdetail::create_open_func<base_t> create_open_func_t;
- typedef ipcdetail::managed_open_or_create_impl<ipcdetail::file_wrapper> managed_open_or_create_type;
+ typedef ipcdetail::managed_open_or_create_impl< ipcdetail::file_wrapper
+ , AllocationAlgorithm::Alignment> managed_open_or_create_type;
 
    basic_managed_mapped_file *get_this_pointer()
    { return this; }
@@ -130,7 +140,7 @@
    //!Does not throw
    basic_managed_mapped_file &operator=(BOOST_RV_REF(basic_managed_mapped_file) moved)
    {
- basic_managed_mapped_file tmp(boost::interprocess::move(moved));
+ basic_managed_mapped_file tmp(boost::move(moved));
       this->swap(tmp);
       return *this;
    }

Modified: trunk/boost/interprocess/managed_shared_memory.hpp
==============================================================================
--- trunk/boost/interprocess/managed_shared_memory.hpp (original)
+++ trunk/boost/interprocess/managed_shared_memory.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -19,11 +19,14 @@
 #include <boost/interprocess/detail/workaround.hpp>
 
 #include <boost/interprocess/detail/managed_memory_impl.hpp>
-#include <boost/interprocess/exceptions.hpp>
 #include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
 #include <boost/interprocess/shared_memory_object.hpp>
 #include <boost/interprocess/creation_tags.hpp>
 #include <boost/interprocess/permissions.hpp>
+//These includes needed to fulfill default template parameters of
+//predeclarations in interprocess_fwd.hpp
+#include <boost/interprocess/mem_algo/rbtree_best_fit.hpp>
+#include <boost/interprocess/sync/mutex_family.hpp>
 
 namespace boost {
 
@@ -41,15 +44,18 @@
 class basic_managed_shared_memory
    : public ipcdetail::basic_managed_memory_impl
       <CharType, AllocationAlgorithm, IndexType
- ,ipcdetail::managed_open_or_create_impl<shared_memory_object>::ManagedOpenOrCreateUserOffset>
- , private ipcdetail::managed_open_or_create_impl<shared_memory_object>
+ ,ipcdetail::managed_open_or_create_impl<shared_memory_object
+ , AllocationAlgorithm::Alignment>::ManagedOpenOrCreateUserOffset>
+ , private ipcdetail::managed_open_or_create_impl<shared_memory_object
+ , AllocationAlgorithm::Alignment>
 {
    /// @cond
    typedef ipcdetail::basic_managed_memory_impl
       <CharType, AllocationAlgorithm, IndexType,
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::ManagedOpenOrCreateUserOffset> base_t;
+ ipcdetail::managed_open_or_create_impl
+ < shared_memory_object, AllocationAlgorithm::Alignment>::ManagedOpenOrCreateUserOffset> base_t;
    typedef ipcdetail::managed_open_or_create_impl
- <shared_memory_object> base2_t;
+ <shared_memory_object, AllocationAlgorithm::Alignment> base2_t;
 
    typedef ipcdetail::create_open_func<base_t> create_open_func_t;
 
@@ -148,7 +154,7 @@
    //!Does not throw
    basic_managed_shared_memory &operator=(BOOST_RV_REF(basic_managed_shared_memory) moved)
    {
- basic_managed_shared_memory tmp(boost::interprocess::move(moved));
+ basic_managed_shared_memory tmp(boost::move(moved));
       this->swap(tmp);
       return *this;
    }

Modified: trunk/boost/interprocess/managed_windows_shared_memory.hpp
==============================================================================
--- trunk/boost/interprocess/managed_windows_shared_memory.hpp (original)
+++ trunk/boost/interprocess/managed_windows_shared_memory.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-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)
 //
@@ -22,7 +22,12 @@
 #include <boost/interprocess/creation_tags.hpp>
 #include <boost/interprocess/windows_shared_memory.hpp>
 #include <boost/interprocess/permissions.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
+//These includes needed to fulfill default template parameters of
+//predeclarations in interprocess_fwd.hpp
+#include <boost/interprocess/mem_algo/rbtree_best_fit.hpp>
+#include <boost/interprocess/sync/mutex_family.hpp>
+#include <boost/interprocess/indexes/iset_index.hpp>
 
 namespace boost {
 namespace interprocess {
@@ -46,14 +51,19 @@
>
 class basic_managed_windows_shared_memory
    : public ipcdetail::basic_managed_memory_impl
- <CharType, AllocationAlgorithm, IndexType
- ,ipcdetail::managed_open_or_create_impl<windows_shared_memory>::ManagedOpenOrCreateUserOffset>
+ < CharType, AllocationAlgorithm, IndexType
+ , ipcdetail::managed_open_or_create_impl
+ < windows_shared_memory
+ , AllocationAlgorithm::Alignment
+ , false>::ManagedOpenOrCreateUserOffset
+ >
 {
    /// @cond
    private:
    typedef ipcdetail::basic_managed_memory_impl
       <CharType, AllocationAlgorithm, IndexType,
- ipcdetail::managed_open_or_create_impl<windows_shared_memory>::ManagedOpenOrCreateUserOffset> base_t;
+ ipcdetail::managed_open_or_create_impl
+ <windows_shared_memory, AllocationAlgorithm::Alignment, false>::ManagedOpenOrCreateUserOffset> base_t;
    typedef ipcdetail::create_open_func<base_t> create_open_func_t;
 
    basic_managed_windows_shared_memory *get_this_pointer()
@@ -133,7 +143,7 @@
    //!Does not throw
    basic_managed_windows_shared_memory &operator=(BOOST_RV_REF(basic_managed_windows_shared_memory) moved)
    {
- basic_managed_windows_shared_memory tmp(boost::interprocess::move(moved));
+ basic_managed_windows_shared_memory tmp(boost::move(moved));
       this->swap(tmp);
       return *this;
    }
@@ -171,7 +181,8 @@
    }
 
    private:
- ipcdetail::managed_open_or_create_impl<windows_shared_memory, false> m_wshm;
+ ipcdetail::managed_open_or_create_impl< windows_shared_memory
+ , AllocationAlgorithm::Alignment, false> m_wshm;
    /// @endcond
 };
 

Modified: trunk/boost/interprocess/managed_xsi_shared_memory.hpp
==============================================================================
--- trunk/boost/interprocess/managed_xsi_shared_memory.hpp (original)
+++ trunk/boost/interprocess/managed_xsi_shared_memory.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-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)
 //
@@ -26,6 +26,11 @@
 #include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
 #include <boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp>
 #include <boost/interprocess/creation_tags.hpp>
+//These includes needed to fulfill default template parameters of
+//predeclarations in interprocess_fwd.hpp
+#include <boost/interprocess/mem_algo/rbtree_best_fit.hpp>
+#include <boost/interprocess/sync/mutex_family.hpp>
+#include <boost/interprocess/indexes/iset_index.hpp>
 
 namespace boost {
 
@@ -43,8 +48,11 @@
 class basic_managed_xsi_shared_memory
    : public ipcdetail::basic_managed_memory_impl
       <CharType, AllocationAlgorithm, IndexType
- ,ipcdetail::managed_open_or_create_impl<xsi_shared_memory_file_wrapper, false, true>::ManagedOpenOrCreateUserOffset>
- , private ipcdetail::managed_open_or_create_impl<xsi_shared_memory_file_wrapper, false, true>
+ ,ipcdetail::managed_open_or_create_impl
+ < xsi_shared_memory_file_wrapper, AllocationAlgorithm::Alignment
+ , false, true>::ManagedOpenOrCreateUserOffset>
+ , private ipcdetail::managed_open_or_create_impl
+ <xsi_shared_memory_file_wrapper, AllocationAlgorithm::Alignment, false, true>
 {
    /// @cond
    public:
@@ -52,7 +60,7 @@
 
    public:
    typedef ipcdetail::managed_open_or_create_impl
- <xsi_shared_memory_file_wrapper, false, true> base2_t;
+ <xsi_shared_memory_file_wrapper, AllocationAlgorithm::Alignment, false, true> base2_t;
    typedef ipcdetail::basic_managed_memory_impl
       <CharType, AllocationAlgorithm, IndexType,
       base2_t::ManagedOpenOrCreateUserOffset> base_t;
@@ -140,7 +148,7 @@
    //!Does not throw
    basic_managed_xsi_shared_memory &operator=(BOOST_RV_REF(basic_managed_xsi_shared_memory) moved)
    {
- basic_managed_xsi_shared_memory tmp(boost::interprocess::move(moved));
+ basic_managed_xsi_shared_memory tmp(boost::move(moved));
&