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));
       this->swap(tmp);
       return *this;
    }

Modified: trunk/boost/interprocess/mapped_region.hpp
==============================================================================
--- trunk/boost/interprocess/mapped_region.hpp (original)
+++ trunk/boost/interprocess/mapped_region.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 <boost/interprocess/interprocess_fwd.hpp>
 #include <boost/interprocess/exceptions.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/interprocess/detail/utilities.hpp>
 #include <boost/interprocess/detail/os_file_functions.hpp>
 #include <string>
@@ -101,7 +101,7 @@
    //!destroyed and it will take ownership of "other"'s memory mapped region.
    mapped_region &operator=(BOOST_RV_REF(mapped_region) other)
    {
- mapped_region tmp(boost::interprocess::move(other));
+ mapped_region tmp(boost::move(other));
       this->swap(tmp);
       return *this;
    }

Modified: trunk/boost/interprocess/mem_algo/detail/mem_algo_common.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/detail/mem_algo_common.hpp (original)
+++ trunk/boost/interprocess/mem_algo/detail/mem_algo_common.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)
 //
@@ -24,7 +24,7 @@
 #include <boost/interprocess/detail/type_traits.hpp>
 #include <boost/interprocess/detail/math_functions.hpp>
 #include <boost/interprocess/detail/utilities.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/interprocess/detail/min_max.hpp>
 #include <boost/assert.hpp>
 #include <boost/static_assert.hpp>
@@ -73,13 +73,13 @@
    { return (((std::size_t)ptr) % Alignment == 0); }
 
    static size_type ceil_units(size_type size)
- { return ipcdetail::get_rounded_size(size, Alignment)/Alignment; }
+ { return get_rounded_size(size, Alignment)/Alignment; }
 
    static size_type floor_units(size_type size)
    { return size/Alignment; }
 
    static size_type multiple_of_units(size_type size)
- { return ipcdetail::get_rounded_size(size, Alignment); }
+ { return get_rounded_size(size, Alignment); }
 
    static multiallocation_chain allocate_many
       (MemoryAlgorithm *memory_algo, size_type elem_bytes, size_type n_elements)
@@ -89,19 +89,19 @@
 
    static void deallocate_many(MemoryAlgorithm *memory_algo, multiallocation_chain chain)
    {
- return this_type::priv_deallocate_many(memory_algo, boost::interprocess::move(chain));
+ return this_type::priv_deallocate_many(memory_algo, boost::move(chain));
    }
 
    static bool calculate_lcm_and_needs_backwards_lcmed
       (size_type backwards_multiple, size_type received_size, size_type size_to_achieve,
       size_type &lcm_out, size_type &needs_backwards_lcmed_out)
    {
- // Now calculate lcm
+ // Now calculate lcm_val
       size_type max = backwards_multiple;
       size_type min = Alignment;
       size_type needs_backwards;
       size_type needs_backwards_lcmed;
- size_type lcm;
+ size_type lcm_val;
       size_type current_forward;
       //Swap if necessary
       if(max < min){
@@ -115,47 +115,47 @@
             return false;
          }
 
- lcm = max;
+ lcm_val = max;
          //If we want to use minbytes data to get a buffer between maxbytes
          //and minbytes if maxbytes can't be achieved, calculate the
          //biggest of all possibilities
- current_forward = ipcdetail::get_truncated_size_po2(received_size, backwards_multiple);
+ current_forward = get_truncated_size_po2(received_size, backwards_multiple);
          needs_backwards = size_to_achieve - current_forward;
          BOOST_ASSERT((needs_backwards % backwards_multiple) == 0);
- needs_backwards_lcmed = ipcdetail::get_rounded_size_po2(needs_backwards, lcm);
- lcm_out = lcm;
+ needs_backwards_lcmed = get_rounded_size_po2(needs_backwards, lcm_val);
+ lcm_out = lcm_val;
          needs_backwards_lcmed_out = needs_backwards_lcmed;
          return true;
       }
       //Check if it's multiple of alignment
       else if((backwards_multiple & (Alignment - 1u)) == 0){
- lcm = backwards_multiple;
- current_forward = ipcdetail::get_truncated_size(received_size, backwards_multiple);
- //No need to round needs_backwards because backwards_multiple == lcm
+ lcm_val = backwards_multiple;
+ current_forward = get_truncated_size(received_size, backwards_multiple);
+ //No need to round needs_backwards because backwards_multiple == lcm_val
          needs_backwards_lcmed = needs_backwards = size_to_achieve - current_forward;
          BOOST_ASSERT((needs_backwards_lcmed & (Alignment - 1u)) == 0);
- lcm_out = lcm;
+ lcm_out = lcm_val;
          needs_backwards_lcmed_out = needs_backwards_lcmed;
          return true;
       }
       //Check if it's multiple of the half of the alignmment
       else if((backwards_multiple & ((Alignment/2u) - 1u)) == 0){
- lcm = backwards_multiple*2u;
- current_forward = ipcdetail::get_truncated_size(received_size, backwards_multiple);
+ lcm_val = backwards_multiple*2u;
+ current_forward = get_truncated_size(received_size, backwards_multiple);
          needs_backwards_lcmed = needs_backwards = size_to_achieve - current_forward;
          if(0 != (needs_backwards_lcmed & (Alignment-1)))
          //while(0 != (needs_backwards_lcmed & (Alignment-1)))
             needs_backwards_lcmed += backwards_multiple;
- BOOST_ASSERT((needs_backwards_lcmed % lcm) == 0);
- lcm_out = lcm;
+ BOOST_ASSERT((needs_backwards_lcmed % lcm_val) == 0);
+ lcm_out = lcm_val;
          needs_backwards_lcmed_out = needs_backwards_lcmed;
          return true;
       }
- //Check if it's multiple of the half of the alignmment
+ //Check if it's multiple of the quarter of the alignmment
       else if((backwards_multiple & ((Alignment/4u) - 1u)) == 0){
          size_type remainder;
- lcm = backwards_multiple*4u;
- current_forward = ipcdetail::get_truncated_size(received_size, backwards_multiple);
+ lcm_val = backwards_multiple*4u;
+ current_forward = get_truncated_size(received_size, backwards_multiple);
          needs_backwards_lcmed = needs_backwards = size_to_achieve - current_forward;
          //while(0 != (needs_backwards_lcmed & (Alignment-1)))
             //needs_backwards_lcmed += backwards_multiple;
@@ -167,22 +167,22 @@
                needs_backwards_lcmed += (4-remainder)*backwards_multiple;
             }
          }
- BOOST_ASSERT((needs_backwards_lcmed % lcm) == 0);
- lcm_out = lcm;
+ BOOST_ASSERT((needs_backwards_lcmed % lcm_val) == 0);
+ lcm_out = lcm_val;
          needs_backwards_lcmed_out = needs_backwards_lcmed;
          return true;
       }
       else{
- lcm = ipcdetail::lcm(max, min);
+ lcm_val = lcm(max, min);
       }
       //If we want to use minbytes data to get a buffer between maxbytes
       //and minbytes if maxbytes can't be achieved, calculate the
       //biggest of all possibilities
- current_forward = ipcdetail::get_truncated_size(received_size, backwards_multiple);
+ current_forward = get_truncated_size(received_size, backwards_multiple);
       needs_backwards = size_to_achieve - current_forward;
       BOOST_ASSERT((needs_backwards % backwards_multiple) == 0);
- needs_backwards_lcmed = ipcdetail::get_rounded_size(needs_backwards, lcm);
- lcm_out = lcm;
+ needs_backwards_lcmed = get_rounded_size(needs_backwards, lcm_val);
+ lcm_out = lcm_val;
       needs_backwards_lcmed_out = needs_backwards_lcmed;
       return true;
    }
@@ -530,15 +530,15 @@
       }
       
       if(low_idx != n_elements){
- priv_deallocate_many(memory_algo, boost::interprocess::move(chain));
+ priv_deallocate_many(memory_algo, boost::move(chain));
       }
- return boost::interprocess::move(chain);
+ return boost::move(chain);
    }
 
    static void priv_deallocate_many(MemoryAlgorithm *memory_algo, multiallocation_chain chain)
    {
       while(!chain.empty()){
- void *addr = ipcdetail::get_pointer(chain.front());
+ void *addr = to_raw_pointer(chain.front());
          chain.pop_front();
          memory_algo->priv_deallocate(addr);
       }

Modified: trunk/boost/interprocess/mem_algo/detail/multi_simple_seq_fit.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/detail/multi_simple_seq_fit.hpp (original)
+++ trunk/boost/interprocess/mem_algo/detail/multi_simple_seq_fit.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/mem_algo/detail/multi_simple_seq_fit_impl.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp (original)
+++ trunk/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_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)
 //
@@ -31,6 +31,7 @@
 #include <boost/type_traits/type_with_alignment.hpp>
 #include <boost/interprocess/detail/min_max.hpp>
 #include <boost/interprocess/sync/scoped_lock.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <algorithm>
 #include <utility>
 #include <cstring>
@@ -68,7 +69,7 @@
    /*!Pointer type to be used with the rest of the Interprocess framework*/
    typedef VoidPointer void_pointer;
 
- 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;
 
 
@@ -222,13 +223,13 @@
    /*!Makes a new memory portion available for allocation*/
    void priv_add_segment(void *addr, size_type size);
 
- enum { Alignment = ::boost::alignment_of<boost::ipcdetail::max_align>::value };
- enum { BlockCtrlBytes = ipcdetail::ct_rounded_size<sizeof(block_ctrl), Alignment>::value };
- enum { BlockCtrlSize = BlockCtrlBytes/Alignment };
- enum { MinBlockSize = BlockCtrlSize + Alignment };
+ static const std::size_t Alignment = ::boost::alignment_of<boost::ipcdetail::max_align>::value;
+ static const std::size_t BlockCtrlBytes = ipcdetail::ct_rounded_size<sizeof(block_ctrl), Alignment>::value;
+ static const std::size_t BlockCtrlSize = BlockCtrlBytes/Alignment;
+ static const std::size_t MinBlockSize = BlockCtrlSize + Alignment;
 
    public:
- enum { PayloadPerAllocation = BlockCtrlBytes };
+ static const std::size_t PayloadPerAllocation = BlockCtrlBytes;
 };
 
 template<class MutexFamily, class VoidPointer>
@@ -319,7 +320,7 @@
    boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
    //-----------------------
    return m_header.m_allocated == 0 &&
- ipcdetail::get_pointer(m_header.m_root.m_next->m_next) == &m_header.m_root;
+ ipcdetail::to_raw_pointer(m_header.m_root.m_next->m_next) == &m_header.m_root;
 }
 
 template<class MutexFamily, class VoidPointer>
@@ -328,7 +329,7 @@
    //-----------------------
    boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
    //-----------------------
- block_ctrl *block = ipcdetail::get_pointer(m_header.m_root.m_next);
+ block_ctrl *block = ipcdetail::to_raw_pointer(m_header.m_root.m_next);
 
    //Iterate through all free portions
    do{
@@ -336,7 +337,7 @@
       std::memset( reinterpret_cast<char*>(block) + BlockCtrlBytes
                  , 0
                  , block->m_size*Alignment - BlockCtrlBytes);
- block = ipcdetail::get_pointer(block->m_next);
+ block = ipcdetail::to_raw_pointer(block->m_next);
    }
    while(block != &m_header.m_root);
 }
@@ -348,14 +349,14 @@
    //-----------------------
    boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
    //-----------------------
- block_ctrl *block = ipcdetail::get_pointer(m_header.m_root.m_next);
+ block_ctrl *block = ipcdetail::to_raw_pointer(m_header.m_root.m_next);
 
    size_type free_memory = 0;
 
    //Iterate through all blocks obtaining their size
    do{
       //Free blocks's next must be always valid
- block_ctrl *next = ipcdetail::get_pointer(block->m_next);
+ block_ctrl *next = ipcdetail::to_raw_pointer(block->m_next);
       if(!next){
          return false;
       }
@@ -566,7 +567,7 @@
 
    //Get the root and the first memory block
    block_ctrl *prev = &m_header.m_root;
- block_ctrl *block = ipcdetail::get_pointer(prev->m_next);
+ block_ctrl *block = ipcdetail::to_raw_pointer(prev->m_next);
    block_ctrl *root = &m_header.m_root;
    block_ctrl *biggest_block = 0;
    block_ctrl *prev_biggest_block = 0;
@@ -595,7 +596,7 @@
          if(addr) return return_type(addr, false);
          //Bad luck, let's check next block
          prev = block;
- block = ipcdetail::get_pointer(block->m_next);
+ block = ipcdetail::to_raw_pointer(block->m_next);
       }
 
       //Bad luck finding preferred_size, now if we have any biggest_block
@@ -652,12 +653,12 @@
    //Take the address where the previous block should go
    block_ctrl *root = &m_header.m_root;
    block_ctrl *prev_2_block = root;
- block_ctrl *prev_block = ipcdetail::get_pointer(root->m_next);
+ block_ctrl *prev_block = ipcdetail::to_raw_pointer(root->m_next);
    while((reinterpret_cast<char*>(prev_block) + prev_block->m_size*Alignment)
             != (reinterpret_cast<char*>(ptr))
          && prev_block != root){
       prev_2_block = prev_block;
- prev_block = ipcdetail::get_pointer(prev_block->m_next);
+ prev_block = ipcdetail::to_raw_pointer(prev_block->m_next);
    }
 
    if(prev_block == root || !prev_block->m_next)
@@ -725,8 +726,8 @@
    
    //Find the previous free block of next_block
    block_ctrl *prev = &m_header.m_root;
- while(ipcdetail::get_pointer(prev->m_next) != next_block){
- prev = ipcdetail::get_pointer(prev->m_next);
+ while(ipcdetail::to_raw_pointer(prev->m_next) != next_block){
+ prev = ipcdetail::to_raw_pointer(prev->m_next);
    }
 
    //Now insert merged block in the free list
@@ -940,15 +941,15 @@
    //This ordering comparison must be done with original pointers
    //types since their mapping to raw pointers can be different
    //in each process
- while((ipcdetail::get_pointer(pos) != &m_header.m_root) && (block > pos)){
+ while((ipcdetail::to_raw_pointer(pos) != &m_header.m_root) && (block > pos)){
       prev = pos;
       pos = pos->m_next;
    }
 
    //Try to combine with upper block
- if ((reinterpret_cast<char*>(ipcdetail::get_pointer(block))
+ if ((reinterpret_cast<char*>(ipcdetail::to_raw_pointer(block))
             + Alignment*block->m_size) ==
- reinterpret_cast<char*>(ipcdetail::get_pointer(pos))){
+ reinterpret_cast<char*>(ipcdetail::to_raw_pointer(pos))){
 
       block->m_size += pos->m_size;
       block->m_next = pos->m_next;
@@ -958,9 +959,9 @@
    }
 
    //Try to combine with lower block
- if ((reinterpret_cast<char*>(ipcdetail::get_pointer(prev))
+ if ((reinterpret_cast<char*>(ipcdetail::to_raw_pointer(prev))
             + Alignment*prev->m_size) ==
- reinterpret_cast<char*>(ipcdetail::get_pointer(block))){
+ reinterpret_cast<char*>(ipcdetail::to_raw_pointer(block))){
       prev->m_size += block->m_size;
       prev->m_next = block->m_next;
    }

Modified: trunk/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp (original)
+++ trunk/boost/interprocess/mem_algo/detail/simple_seq_fit_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)
 //
@@ -30,6 +30,7 @@
 #include <boost/interprocess/detail/min_max.hpp>
 #include <boost/interprocess/detail/type_traits.hpp>
 #include <boost/interprocess/sync/scoped_lock.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/interprocess/mem_algo/detail/mem_algo_common.hpp>
 #include <boost/type_traits/alignment_of.hpp>
 #include <boost/type_traits/type_with_alignment.hpp>
@@ -68,10 +69,10 @@
    typedef MutexFamily mutex_family;
    //!Pointer type to be used with the rest of the Interprocess framework
    typedef VoidPointer void_pointer;
- typedef boost::container::containers_detail::
+ typedef boost::container::container_detail::
       basic_multiallocation_chain<VoidPointer> multiallocation_chain;
 
- 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;
 
 
@@ -339,7 +340,7 @@
 
    m_header.m_root.m_next = reinterpret_cast<block_ctrl*>
       ((reinterpret_cast<char*>(this) + block1_off));
- algo_impl_t::assert_alignment(ipcdetail::get_pointer(m_header.m_root.m_next));
+ algo_impl_t::assert_alignment(ipcdetail::to_raw_pointer(m_header.m_root.m_next));
    m_header.m_root.m_next->m_size = (size - block1_off)/Alignment;
    m_header.m_root.m_next->m_next = &m_header.m_root;
 }
@@ -384,7 +385,7 @@
    //Get the root and the first memory block
    block_ctrl *prev = &m_header.m_root;
    block_ctrl *last = &m_header.m_root;
- block_ctrl *block = ipcdetail::get_pointer(last->m_next);
+ block_ctrl *block = ipcdetail::to_raw_pointer(last->m_next);
    block_ctrl *root = &m_header.m_root;
 
    //No free block?
@@ -394,7 +395,7 @@
    while(block != root){
       prev = last;
       last = block;
- block = ipcdetail::get_pointer(block->m_next);
+ block = ipcdetail::to_raw_pointer(block->m_next);
    }
 
    char *last_free_end_address = reinterpret_cast<char*>(last) + last->m_size*Alignment;
@@ -412,7 +413,7 @@
       unique_block = priv_allocate(boost::interprocess::allocate_new, 0, 0, ignore).first;
       if(!unique_block)
          return;
- last = ipcdetail::get_pointer(m_header.m_root.m_next);
+ last = ipcdetail::to_raw_pointer(m_header.m_root.m_next);
       BOOST_ASSERT(last_free_end_address == (reinterpret_cast<char*>(last) + last->m_size*Alignment));
    }
    size_type last_units = last->m_size;
@@ -506,7 +507,7 @@
    boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
    //-----------------------
    return m_header.m_allocated == 0 &&
- ipcdetail::get_pointer(m_header.m_root.m_next->m_next) == &m_header.m_root;
+ ipcdetail::to_raw_pointer(m_header.m_root.m_next->m_next) == &m_header.m_root;
 }
 
 template<class MutexFamily, class VoidPointer>
@@ -515,7 +516,7 @@
    //-----------------------
    boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
    //-----------------------
- block_ctrl *block = ipcdetail::get_pointer(m_header.m_root.m_next);
+ block_ctrl *block = ipcdetail::to_raw_pointer(m_header.m_root.m_next);
 
    //Iterate through all free portions
    do{
@@ -523,7 +524,7 @@
       std::memset( priv_get_user_buffer(block)
                  , 0
              , block->get_user_bytes());
- block = ipcdetail::get_pointer(block->m_next);
+ block = ipcdetail::to_raw_pointer(block->m_next);
    }
    while(block != &m_header.m_root);
 }
@@ -535,7 +536,7 @@
    //-----------------------
    boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
    //-----------------------
- block_ctrl *block = ipcdetail::get_pointer(m_header.m_root.m_next);
+ block_ctrl *block = ipcdetail::to_raw_pointer(m_header.m_root.m_next);
 
    size_type free_memory = 0;
 
@@ -545,7 +546,7 @@
       if(!algo_impl_t::check_alignment(block))
          return false;
       //Free blocks's next must be always valid
- block_ctrl *next = ipcdetail::get_pointer(block->m_next);
+ block_ctrl *next = ipcdetail::to_raw_pointer(block->m_next);
       if(!next){
          return false;
       }
@@ -786,7 +787,7 @@
 
    //Get the root and the first memory block
    block_ctrl *prev = &m_header.m_root;
- block_ctrl *block = ipcdetail::get_pointer(prev->m_next);
+ block_ctrl *block = ipcdetail::to_raw_pointer(prev->m_next);
    block_ctrl *root = &m_header.m_root;
    block_ctrl *biggest_block = 0;
    block_ctrl *prev_biggest_block = 0;
@@ -821,7 +822,7 @@
          }
          //Bad luck, let's check next block
          prev = block;
- block = ipcdetail::get_pointer(block->m_next);
+ block = ipcdetail::to_raw_pointer(block->m_next);
       }
 
       //Bad luck finding preferred_size, now if we have any biggest_block
@@ -892,13 +893,13 @@
    //Take the address where the previous block should go
    block_ctrl *root = &m_header.m_root;
    block_ctrl *prev_2_block = root;
- block_ctrl *prev_block = ipcdetail::get_pointer(root->m_next);
+ block_ctrl *prev_block = ipcdetail::to_raw_pointer(root->m_next);
 
    while((reinterpret_cast<char*>(prev_block) + prev_block->m_size*Alignment)
             != reinterpret_cast<char*>(ptr)
          && prev_block != root){
       prev_2_block = prev_block;
- prev_block = ipcdetail::get_pointer(prev_block->m_next);
+ prev_block = ipcdetail::to_raw_pointer(prev_block->m_next);
    }
 
    if(prev_block == root || !prev_block->m_next)
@@ -968,8 +969,8 @@
    
    //Find the previous free block of next_block
    block_ctrl *prev = &m_header.m_root;
- while(ipcdetail::get_pointer(prev->m_next) != next_block){
- prev = ipcdetail::get_pointer(prev->m_next);
+ while(ipcdetail::to_raw_pointer(prev->m_next) != next_block){
+ prev = ipcdetail::to_raw_pointer(prev->m_next);
    }
 
    //Now insert merged block in the free list
@@ -1056,7 +1057,7 @@
    //Pointer next always points to the first
    //(lower address) block
    block_ctrl * prev = &m_header.m_root;
- block_ctrl * pos = ipcdetail::get_pointer(m_header.m_root.m_next);
+ block_ctrl * pos = ipcdetail::to_raw_pointer(m_header.m_root.m_next);
    block_ctrl * block = reinterpret_cast<block_ctrl*>(priv_get_block(addr));
 
    //All used blocks' next is marked with 0 so check it
@@ -1075,16 +1076,16 @@
    //This ordering comparison must be done with original pointers
    //types since their mapping to raw pointers can be different
    //in each process
- while((ipcdetail::get_pointer(pos) != &m_header.m_root) && (block > pos)){
+ while((ipcdetail::to_raw_pointer(pos) != &m_header.m_root) && (block > pos)){
       prev = pos;
- pos = ipcdetail::get_pointer(pos->m_next);
+ pos = ipcdetail::to_raw_pointer(pos->m_next);
    }
 
    //Try to combine with upper block
- char *block_char_ptr = reinterpret_cast<char*>(ipcdetail::get_pointer(block));
+ char *block_char_ptr = reinterpret_cast<char*>(ipcdetail::to_raw_pointer(block));
 
    if ((block_char_ptr + Alignment*block->m_size) ==
- reinterpret_cast<char*>(ipcdetail::get_pointer(pos))){
+ reinterpret_cast<char*>(ipcdetail::to_raw_pointer(pos))){
       block->m_size += pos->m_size;
       block->m_next = pos->m_next;
    }
@@ -1093,7 +1094,7 @@
    }
 
    //Try to combine with lower block
- if ((reinterpret_cast<char*>(ipcdetail::get_pointer(prev))
+ if ((reinterpret_cast<char*>(ipcdetail::to_raw_pointer(prev))
             + Alignment*prev->m_size) ==
         block_char_ptr){
 

Modified: trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp (original)
+++ trunk/boost/interprocess/mem_algo/rbtree_best_fit.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,6 @@
 #include <boost/interprocess/containers/allocation_type.hpp>
 #include <boost/container/detail/multiallocation_chain.hpp>
 #include <boost/interprocess/offset_ptr.hpp>
-#include <boost/interprocess/sync/interprocess_mutex.hpp>
 #include <boost/interprocess/exceptions.hpp>
 #include <boost/interprocess/detail/utilities.hpp>
 #include <boost/interprocess/detail/min_max.hpp>
@@ -33,6 +32,7 @@
 #include <boost/interprocess/detail/type_traits.hpp>
 #include <boost/interprocess/sync/scoped_lock.hpp>
 #include <boost/type_traits/type_with_alignment.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/assert.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/type_traits.hpp>
@@ -81,14 +81,14 @@
    /// @endcond
 
    public:
- //!Shared interprocess_mutex family used for the rest of the Interprocess framework
+ //!Shared mutex family used for the rest of the Interprocess framework
    typedef MutexFamily mutex_family;
    //!Pointer type to be used with the rest of the Interprocess framework
    typedef VoidPointer void_pointer;
- typedef boost::container::containers_detail::
+ typedef boost::container::container_detail::
       basic_multiallocation_chain<VoidPointer> multiallocation_chain;
 
- 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;
 
    /// @cond
@@ -132,16 +132,16 @@
       { return block.m_size < size; }
    };
 
- //!Shared interprocess_mutex to protect memory allocate/deallocate
- typedef typename MutexFamily::mutex_type interprocess_mutex;
+ //!Shared mutex to protect memory allocate/deallocate
+ typedef typename MutexFamily::mutex_type mutex_type;
    typedef typename bi::make_multiset
       <block_ctrl, bi::base_hook<TreeHook> >::type Imultiset;
 
    typedef typename Imultiset::iterator imultiset_iterator;
 
    //!This struct includes needed data and derives from
- //!interprocess_mutex to allow EBO when using null interprocess_mutex
- struct header_t : public interprocess_mutex
+ //!mutex_type to allow EBO when using null mutex_type
+ struct header_t : public mutex_type
    {
       Imultiset m_imultiset;
 
@@ -185,7 +185,7 @@
    {
 
       //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
+ boost::interprocess::scoped_lock<mutex_type> guard(m_header);
       //-----------------------
       return algo_impl_t::allocate_many(this, elem_bytes, num_elements);
    }
@@ -195,7 +195,7 @@
    {
 
       //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
+ boost::interprocess::scoped_lock<mutex_type> guard(m_header);
       //-----------------------
       return algo_impl_t::allocate_many(this, elem_sizes, n_elements, sizeof_element);
    }
@@ -620,7 +620,7 @@
     all_memory_deallocated()
 {
    //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
+ boost::interprocess::scoped_lock<mutex_type> guard(m_header);
    //-----------------------
    size_type block1_off =
       priv_first_block_offset_from_this(this, m_header.m_extra_hdr_bytes);
@@ -637,7 +637,7 @@
     check_sanity()
 {
    //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
+ boost::interprocess::scoped_lock<mutex_type> guard(m_header);
    //-----------------------
    imultiset_iterator ib(m_header.m_imultiset.begin()), ie(m_header.m_imultiset.end());
 
@@ -671,7 +671,7 @@
    allocate(size_type nbytes)
 {
    //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
+ boost::interprocess::scoped_lock<mutex_type> guard(m_header);
    //-----------------------
    size_type ignore;
    void * ret = priv_allocate(boost::interprocess::allocate_new, nbytes, nbytes, ignore).first;
@@ -683,7 +683,7 @@
    allocate_aligned(size_type nbytes, size_type alignment)
 {
    //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
+ boost::interprocess::scoped_lock<mutex_type> guard(m_header);
    //-----------------------
    return algo_impl_t::allocate_aligned(this, nbytes, alignment);
 }
@@ -738,7 +738,7 @@
    size_type r_size;
    {
       //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
+ boost::interprocess::scoped_lock<mutex_type> guard(m_header);
       //-----------------------
       ret = priv_allocate(command, l_size, p_size, r_size, reuse_ptr, sizeof_object);
    }
@@ -761,7 +761,7 @@
 inline void rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::zero_free_memory()
 {
    //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
+ boost::interprocess::scoped_lock<mutex_type> guard(m_header);
    //-----------------------
    imultiset_iterator ib(m_header.m_imultiset.begin()), ie(m_header.m_imultiset.end());
 
@@ -930,9 +930,9 @@
    deallocate_many(typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::multiallocation_chain chain)
 {
    //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
+ boost::interprocess::scoped_lock<mutex_type> guard(m_header);
    //-----------------------
- algo_impl_t::deallocate_many(this, boost::interprocess::move(chain));
+ algo_impl_t::deallocate_many(this, boost::move(chain));
 }
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
@@ -979,13 +979,13 @@
 
       if(it != m_header.m_imultiset.end()){
          return return_type(this->priv_check_and_allocate
- (preferred_units, ipcdetail::get_pointer(&*it), received_size), false);
+ (preferred_units, ipcdetail::to_raw_pointer(&*it), received_size), false);
       }
 
       if(it != m_header.m_imultiset.begin()&&
               (--it)->m_size >= limit_units){
          return return_type(this->priv_check_and_allocate
- (it->m_size, ipcdetail::get_pointer(&*it), received_size), false);
+ (it->m_size, ipcdetail::to_raw_pointer(&*it), received_size), false);
       }
    }
 
@@ -1330,7 +1330,7 @@
 {
    if(!addr) return;
    //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
+ boost::interprocess::scoped_lock<mutex_type> guard(m_header);
    //-----------------------
    return this->priv_deallocate(addr);
 }

Modified: trunk/boost/interprocess/mem_algo/simple_seq_fit.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/simple_seq_fit.hpp (original)
+++ trunk/boost/interprocess/mem_algo/simple_seq_fit.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/offset_ptr.hpp
==============================================================================
--- trunk/boost/interprocess/offset_ptr.hpp (original)
+++ trunk/boost/interprocess/offset_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)
 //
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_OFFSET_PTR_HPP
-#define BOOST_OFFSET_PTR_HPP
+#ifndef BOOST_INTERPROCESS_OFFSET_PTR_HPP
+#define BOOST_INTERPROCESS_OFFSET_PTR_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 # pragma once
@@ -22,8 +22,6 @@
 #include <boost/interprocess/detail/utilities.hpp>
 #include <boost/interprocess/detail/cast_tags.hpp>
 #include <boost/interprocess/detail/mpl.hpp>
-#include <boost/pointer_cast.hpp>
-#include <boost/pointer_to_other.hpp>
 #include <boost/assert.hpp>
 #include <ostream>
 #include <istream>
@@ -57,73 +55,19 @@
 {
    /// @cond
    typedef offset_ptr<PointedType, DifferenceType, OffsetType, OffsetAlignment> self_t;
-
    void unspecified_bool_type_func() const {}
    typedef void (self_t::*unspecified_bool_type)() const;
-
- //Note: using the address of a local variable to point to another address
- //is not standard conforming and this can be optimized-away by the compiler.
- //Non-inlining is a method to remain illegal and correct
- #if defined(_MSC_VER) && (_MSC_VER >= 1400)
- __declspec(noinline) //this workaround is needed for msvc-8.0 and msvc-9.0
- #elif defined (__GNUC__)//this workaround is needed for GCC
- __attribute__((noinline))
- #endif
- void set_offset(const PointedType *ptr)
- {
- #if defined (__GNUC__)
- //asm(""); //Prevents the function to be optimized-away (provokes an special "side-effect")
- #endif
- //offset == 1 && ptr != 0 is not legal for this pointer
- if(!ptr){
- internal.m_offset = 1;
- }
- else{
- internal.m_offset = (OffsetType)((const char*)ptr - (const char*)(this));
- BOOST_ASSERT(internal.m_offset != 1);
- }
- }
-
- #if defined(_MSC_VER) && (_MSC_VER >= 1400)
- __declspec(noinline)
- #elif defined (__GNUC__)
- __attribute__((noinline))
- #endif
- PointedType * get_pointer() const
- {
- #if defined (__GNUC__)
- //asm(""); //Prevents the function to be optimized-away (provokes an special "side-effect")
- #endif
- return static_cast<PointedType *>(
- static_cast<void*>(
- (internal.m_offset == 1) ?
- 0 :
- (const_cast<char*>(reinterpret_cast<const char*>(this)) + internal.m_offset)
- )
- );
- }
-
- void inc_offset(DifferenceType bytes)
- { internal.m_offset += bytes; }
-
- void dec_offset(DifferenceType bytes)
- { internal.m_offset -= bytes; }
-
- union internal_type{
- OffsetType m_offset; //Distance between this object and pointed address
- typename ::boost::aligned_storage
- < sizeof(OffsetType)
- , (OffsetAlignment == offset_type_alignment) ?
- ::boost::alignment_of<OffsetType>::value : OffsetAlignment
- >::type alignment_helper;
- } internal;
    /// @endcond
 
    public:
+ typedef PointedType element_type;
    typedef PointedType * pointer;
    typedef typename ipcdetail::
       add_reference<PointedType>::type reference;
- typedef PointedType value_type;
+ typedef typename ipcdetail::
+ remove_volatile<typename ipcdetail::
+ remove_const<PointedType>::type
+ >::type value_type;
    typedef DifferenceType difference_type;
    typedef std::random_access_iterator_tag iterator_category;
    typedef OffsetType offset_type;
@@ -137,8 +81,9 @@
    //!Constructor from other pointer.
    //!Never throws.
    template <class T>
- offset_ptr(T *ptr)
- { pointer p (ptr); (void)p; this->set_offset(p); }
+ offset_ptr( T *ptr
+ , typename ipcdetail::enable_if< ipcdetail::is_convertible<T*, PointedType*> >::type * = 0)
+ { this->set_offset(static_cast<PointedType*>(ptr)); }
 
    //!Constructor from other offset_ptr
    //!Never throws.
@@ -148,8 +93,9 @@
    //!Constructor from other offset_ptr. If pointers of pointee types are
    //!convertible, offset_ptrs will be convertibles. Never throws.
    template<class T2, class P2, class O2, std::size_t A2>
- offset_ptr(const offset_ptr<T2, P2, O2, A2> &ptr)
- { pointer p(ptr.get()); (void)p; this->set_offset(p); }
+ offset_ptr( const offset_ptr<T2, P2, O2, A2> &ptr
+ , typename ipcdetail::enable_if< ipcdetail::is_convertible<T2*, PointedType*> >::type * = 0)
+ { this->set_offset(static_cast<PointedType*>(ptr.get())); }
 
    //!Emulates static_cast operator.
    //!Never throws.
@@ -178,7 +124,7 @@
    //!Obtains raw pointer from offset.
    //!Never throws.
    pointer get()const
- { return this->get_pointer(); }
+ { return this->to_raw_pointer(); }
 
    offset_type get_offset() const
    { return internal.m_offset; }
@@ -216,25 +162,13 @@
    //!Assignment from related offset_ptr. If pointers of pointee types
    //! are assignable, offset_ptrs will be assignable. Never throws.
    template<class T2, class P2, class O2, std::size_t A2>
- offset_ptr& operator= (const offset_ptr<T2, P2, O2, A2> & pt)
- { pointer p(pt.get()); this->set_offset(p); return *this; }
+ typename ipcdetail::enable_if<ipcdetail::is_convertible<T2*, PointedType*>, offset_ptr&>::type
+ operator= (const offset_ptr<T2, P2, O2, A2> & ptr)
+ { this->set_offset(static_cast<PointedType*>(ptr.get())); return *this; }
  
- //!offset_ptr + difference_type.
- //!Never throws.
- template<class T>
- offset_ptr operator+ (T offset) const
- { return offset_ptr(this->get()+offset); }
-
- //!offset_ptr - difference_type.
- //!Never throws.
- template<class T>
- offset_ptr operator- (T offset) const
- { return offset_ptr(this->get()-offset); }
-
    //!offset_ptr += difference_type.
    //!Never throws.
- template<class T>
- offset_ptr &operator+= (T offset)
+ offset_ptr &operator+= (difference_type offset)
    { this->inc_offset(offset * sizeof (PointedType)); return *this; }
 
    //!offset_ptr -= difference_type.
@@ -272,57 +206,168 @@
    //!Never throws
    bool operator! () const
    { return this->get() == 0; }
-/*
- friend void swap (offset_ptr &pt, offset_ptr &pt2)
- {
- value_type *ptr = pt.get();
- pt = pt2;
- pt2 = ptr;
+
+ //!Compatibility with pointer_traits
+ //!
+ template <class U>
+ struct rebind
+ { typedef offset_ptr<U, DifferenceType, OffsetType, OffsetAlignment> other; };
+
+ //!Compatibility with pointer_traits
+ //!
+ static offset_ptr pointer_to(reference r)
+ { return offset_ptr(&r); }
+
+ //!difference_type + offset_ptr
+ //!operation
+ friend offset_ptr operator+(difference_type diff, const offset_ptr& right)
+ { offset_ptr tmp(right); tmp += diff; return tmp; }
+
+ //!offset_ptr + difference_type
+ //!operation
+ friend offset_ptr operator+(const offset_ptr& left, difference_type diff)
+ { offset_ptr tmp(left); tmp += diff; return tmp; }
+
+ //!offset_ptr - diff
+ //!operation
+ friend offset_ptr operator-(const offset_ptr &left, difference_type diff)
+ { offset_ptr tmp(left); tmp -= diff; return tmp; }
+
+ //!offset_ptr - diff
+ //!operation
+ friend offset_ptr operator-(difference_type diff, const offset_ptr &right)
+ { offset_ptr tmp(right); tmp -= diff; return tmp; }
+
+ //!offset_ptr - offset_ptr
+ //!operation
+ friend difference_type operator-(const offset_ptr &pt, const offset_ptr &pt2)
+ { return difference_type(pt.get()- pt2.get()); }
+
+ //Comparison
+ friend bool operator== (const offset_ptr &pt1, const offset_ptr &pt2)
+ { return pt1.get() == pt2.get(); }
+
+ friend bool operator!= (const offset_ptr &pt1, const offset_ptr &pt2)
+ { return pt1.get() != pt2.get(); }
+
+ friend bool operator<(const offset_ptr &pt1, const offset_ptr &pt2)
+ { return pt1.get() < pt2.get(); }
+
+ friend bool operator<=(const offset_ptr &pt1, const offset_ptr &pt2)
+ { return pt1.get() <= pt2.get(); }
+
+ friend bool operator>(const offset_ptr &pt1, const offset_ptr &pt2)
+ { return pt1.get() > pt2.get(); }
+
+ friend bool operator>=(const offset_ptr &pt1, const offset_ptr &pt2)
+ { return pt1.get() >= pt2.get(); }
+
+ //Comparison to raw ptr to support literal 0
+ friend bool operator== (pointer pt1, const offset_ptr &pt2)
+ { return pt1 == pt2.get(); }
+
+ friend bool operator!= (pointer pt1, const offset_ptr &pt2)
+ { return pt1 != pt2.get(); }
+
+ friend bool operator<(pointer pt1, const offset_ptr &pt2)
+ { return pt1 < pt2.get(); }
+
+ friend bool operator<=(pointer pt1, const offset_ptr &pt2)
+ { return pt1 <= pt2.get(); }
+
+ friend bool operator>(pointer pt1, const offset_ptr &pt2)
+ { return pt1 > pt2.get(); }
+
+ friend bool operator>=(pointer pt1, const offset_ptr &pt2)
+ { return pt1 >= pt2.get(); }
+
+ //Comparison
+ friend bool operator== (const offset_ptr &pt1, pointer pt2)
+ { return pt1.get() == pt2; }
+
+ friend bool operator!= (const offset_ptr &pt1, pointer pt2)
+ { return pt1.get() != pt2; }
+
+ friend bool operator<(const offset_ptr &pt1, pointer pt2)
+ { return pt1.get() < pt2; }
+
+ friend bool operator<=(const offset_ptr &pt1, pointer pt2)
+ { return pt1.get() <= pt2; }
+
+ friend bool operator>(const offset_ptr &pt1, pointer pt2)
+ { return pt1.get() > pt2; }
+
+ friend bool operator>=(const offset_ptr &pt1, pointer pt2)
+ { return pt1.get() >= pt2; }
+
+ friend void swap(offset_ptr &left, offset_ptr &right)
+ {
+ pointer ptr = right.get();
+ right = left;
+ left = ptr;
    }
-*/
-};
 
-//!offset_ptr<T1, P1, O1, A1> == offset_ptr<T2, P2, O2, A2>.
-//!Never throws.
-template<class T1, class P1, class O1, std::size_t A1, class T2, class P2, class O2, std::size_t A2>
-inline bool operator== (const offset_ptr<T1, P1, O1, A1> &pt1,
- const offset_ptr<T2, P2, O2, A2> &pt2)
-{ return pt1.get() == pt2.get(); }
+ private:
+ /// @cond
 
-//!offset_ptr<T1, P1, O1, A1> != offset_ptr<T2, P2, O2, A2>.
-//!Never throws.
-template<class T1, class P1, class O1, std::size_t A1, class T2, class P2, class O2, std::size_t A2>
-inline bool operator!= (const offset_ptr<T1, P1, O1, A1> &pt1,
- const offset_ptr<T2, P2, O2, A2> &pt2)
-{ return pt1.get() != pt2.get(); }
+ //Note: using the address of a local variable to point to another address
+ //is not standard conforming and this can be optimized-away by the compiler.
+ //Non-inlining is a method to remain illegal and correct
+ #if defined(_MSC_VER)
+ __declspec(noinline) //this workaround is needed for MSVC compilers
+ #elif defined (__GNUC__)//this workaround is needed for GCC
+ __attribute__((noinline))
+ #endif
+ void set_offset(const PointedType *ptr)
+ {
+ #if defined (__GNUC__)
+ //asm(""); //Prevents the function to be optimized-away (provokes an special "side-effect")
+ #endif
+ //offset == 1 && ptr != 0 is not legal for this pointer
+ if(!ptr){
+ internal.m_offset = 1;
+ }
+ else{
+ internal.m_offset = (OffsetType)((const char*)ptr - (const char*)(this));
+ BOOST_ASSERT(internal.m_offset != 1);
+ }
+ }
 
-//!offset_ptr<T1, P1, O1, A1> < offset_ptr<T2, P2, O2, A2>.
-//!Never throws.
-template<class T1, class P1, class O1, std::size_t A1, class T2, class P2, class O2, std::size_t A2>
-inline bool operator< (const offset_ptr<T1, P1, O1, A1> &pt1,
- const offset_ptr<T2, P2, O2, A2> &pt2)
-{ return pt1.get() < pt2.get(); }
+ #if defined(_MSC_VER) && (_MSC_VER >= 1400)
+ __declspec(noinline)
+ #elif defined (__GNUC__)
+ __attribute__((noinline))
+ #endif
+ PointedType * to_raw_pointer() const
+ {
+ #if defined (__GNUC__)
+ //asm(""); //Prevents the function to be optimized-away (provokes an special "side-effect")
+ #endif
+ return static_cast<PointedType *>(
+ static_cast<void*>(
+ (internal.m_offset == 1) ?
+ 0 :
+ (const_cast<char*>(reinterpret_cast<const char*>(this)) + internal.m_offset)
+ )
+ );
+ }
 
-//!offset_ptr<T1, P1, O1, A1> <= offset_ptr<T2, P2, O2, A2>.
-//!Never throws.
-template<class T1, class P1, class O1, std::size_t A1, class T2, class P2, class O2, std::size_t A2>
-inline bool operator<= (const offset_ptr<T1, P1, O1, A1> &pt1,
- const offset_ptr<T2, P2, O2, A2> &pt2)
-{ return pt1.get() <= pt2.get(); }
+ void inc_offset(DifferenceType bytes)
+ { internal.m_offset += bytes; }
 
-//!offset_ptr<T1, P1, O1, A1> > offset_ptr<T2, P2, O2, A2>.
-//!Never throws.
-template<class T1, class P1, class O1, std::size_t A1, class T2, class P2, class O2, std::size_t A2>
-inline bool operator> (const offset_ptr<T1, P1, O1, A1> &pt1,
- const offset_ptr<T2, P2, O2, A2> &pt2)
-{ return pt1.get() > pt2.get(); }
+ void dec_offset(DifferenceType bytes)
+ { internal.m_offset -= bytes; }
 
-//!offset_ptr<T1, P1, O1, A1> >= offset_ptr<T2, P2, O2, A2>.
-//!Never throws.
-template<class T1, class P1, class O1, std::size_t A1, class T2, class P2, class O2, std::size_t A2>
-inline bool operator>= (const offset_ptr<T1, P1, O1, A1> &pt1,
- const offset_ptr<T2, P2, O2, A2> &pt2)
-{ return pt1.get() >= pt2.get(); }
+ union internal_type{
+ OffsetType m_offset; //Distance between this object and pointee address
+ typename ::boost::aligned_storage
+ < sizeof(OffsetType)
+ , (OffsetAlignment == offset_type_alignment) ?
+ ::boost::alignment_of<OffsetType>::value : OffsetAlignment
+ >::type alignment_helper;
+ } internal;
+ /// @endcond
+};
 
 //!operator<<
 //!for offset ptr
@@ -338,30 +383,6 @@
    (std::basic_istream<E, T> & is, offset_ptr<W, X, Y, Z> & p)
 { return is >> p.get_offset(); }
 
-//!difference_type + offset_ptr
-//!operation
-template<class T, class P, class O, std::size_t A, class D>
-inline offset_ptr<T, P, O, A> operator+(D diff, const offset_ptr<T, P, O, A>& right)
-{ return right + diff; }
-
-//!offset_ptr - offset_ptr
-//!operation
-template<class T1, class P1, class O1, std::size_t A1, class T2, class P2, class O2, std::size_t A2>
-inline typename offset_ptr<T1, P1, O1, A1>::difference_type operator-
- (const offset_ptr<T1, P1, O1, A1> &pt, const offset_ptr<T2, P2, O2, A2> &pt2)
-{ return typename offset_ptr<T1, P1, O1, A1>::difference_type(pt.get()- pt2.get()); }
-
-//!swap specialization
-//!for offset_ptr
-template<class T, class P, class O, std::size_t A>
-inline void swap (boost::interprocess::offset_ptr<T, P, O, A> &pt,
- boost::interprocess::offset_ptr<T, P, O, A> &pt2)
-{
- typename offset_ptr<T, P, O, A>::value_type *ptr = pt.get();
- pt = pt2;
- pt2 = ptr;
-}
-
 //!Simulation of static_cast between pointers. Never throws.
 template<class T1, class P1, class O1, std::size_t A1, class T2, class P2, class O2, std::size_t A2>
 inline boost::interprocess::offset_ptr<T1, P1, O1, A1>
@@ -406,23 +427,23 @@
 template <class T, class P, class O, std::size_t A>
 struct has_trivial_constructor< boost::interprocess::offset_ptr<T, P, O, A> >
 {
- enum { value = true };
+ static const bool value = true;
 };
 
 ///has_trivial_destructor<> == true_type specialization for optimizations
 template <class T, class P, class O, std::size_t A>
 struct has_trivial_destructor< boost::interprocess::offset_ptr<T, P, O, A> >
 {
- enum { value = true };
+ static const bool value = true;
 };
 
 //#if !defined(_MSC_VER) || (_MSC_VER >= 1400)
 namespace interprocess {
 //#endif
-//!get_pointer() enables boost::mem_fn to recognize offset_ptr.
+//!to_raw_pointer() enables boost::mem_fn to recognize offset_ptr.
 //!Never throws.
 template <class T, class P, class O, std::size_t A>
-inline T * get_pointer(boost::interprocess::offset_ptr<T, P, O, A> const & p)
+inline T * to_raw_pointer(boost::interprocess::offset_ptr<T, P, O, A> const & p)
 { return p.get(); }
 //#if !defined(_MSC_VER) || (_MSC_VER >= 1400)
 } //namespace interprocess
@@ -485,6 +506,11 @@
 
 } //namespace intrusive
 
+//Predeclaration
+template<class T, class U>
+struct pointer_to_other;
+
+//Backwards compatibility with pointer_to_other
 template<class T, class T2, class T3, std::size_t A, class U>
 struct pointer_to_other< ::boost::interprocess::offset_ptr<T, T2, T3, A>, U >
 {
@@ -496,5 +522,4 @@
 
 #include <boost/interprocess/detail/config_end.hpp>
 
-#endif //#ifndef BOOST_OFFSET_PTR_HPP
-
+#endif //#ifndef BOOST_INTERPROCESS_OFFSET_PTR_HPP

Modified: trunk/boost/interprocess/permissions.hpp
==============================================================================
--- trunk/boost/interprocess/permissions.hpp (original)
+++ trunk/boost/interprocess/permissions.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/segment_manager.hpp
==============================================================================
--- trunk/boost/interprocess/segment_manager.hpp (original)
+++ trunk/boost/interprocess/segment_manager.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,7 +32,7 @@
 #include <boost/interprocess/exceptions.hpp>
 #include <boost/interprocess/allocators/allocator.hpp>
 #include <boost/interprocess/smart_ptr/deleter.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/interprocess/sync/scoped_lock.hpp>
 #include <cstddef> //std::size_t
 #include <string> //char_traits
@@ -129,7 +129,7 @@
    {
       multiallocation_chain mem(MemoryAlgorithm::allocate_many(elem_bytes, num_elements));
       if(mem.empty()) throw bad_alloc();
- return boost::interprocess::move(mem);
+ return boost::move(mem);
    }
 
    //!Allocates n_elements, each one of
@@ -139,7 +139,7 @@
    {
       multiallocation_chain mem(MemoryAlgorithm::allocate_many(element_lenghts, n_elements, sizeof_element));
       if(mem.empty()) throw bad_alloc();
- return boost::interprocess::move(mem);
+ return boost::move(mem);
    }
 
    //!Allocates n_elements of
@@ -158,7 +158,7 @@
    //!Deallocates elements pointed by the
    //!multiallocation iterator range.
    void deallocate_many(multiallocation_chain chain)
- { MemoryAlgorithm::deallocate_many(boost::interprocess::move(chain)); }
+ { MemoryAlgorithm::deallocate_many(boost::move(chain)); }
 
    /// @endcond
 
@@ -903,7 +903,7 @@
       if(it != index.end()){
          //Get header
          block_header_t *ctrl_data = reinterpret_cast<block_header_t*>
- (ipcdetail::get_pointer(it->second.m_ptr));
+ (ipcdetail::to_raw_pointer(it->second.m_ptr));
 
          //Sanity check
          BOOST_ASSERT((ctrl_data->m_value_bytes % table.size) == 0);
@@ -1029,7 +1029,7 @@
 
       //Get allocation parameters
       block_header_t *ctrl_data = reinterpret_cast<block_header_t*>
- (ipcdetail::get_pointer(it->second.m_ptr));
+ (ipcdetail::to_raw_pointer(it->second.m_ptr));
       char *stored_name = static_cast<char*>(static_cast<void*>(const_cast<CharT*>(it->first.name())));
       (void)stored_name;
 
@@ -1255,7 +1255,7 @@
       if(!insert_ret.second){
          if(try2find){
             block_header_t *hdr = static_cast<block_header_t*>
- (ipcdetail::get_pointer(it->second.m_ptr));
+ (ipcdetail::to_raw_pointer(it->second.m_ptr));
             return hdr->value();
          }
          return 0;
@@ -1336,7 +1336,7 @@
       if(use_lock){
          local.lock();
       }
- return scoped_lock<rmutex>(boost::interprocess::move(local));
+ return scoped_lock<rmutex>(boost::move(local));
    }
 
    //!This struct includes needed data and derives from

Modified: trunk/boost/interprocess/shared_memory_object.hpp
==============================================================================
--- trunk/boost/interprocess/shared_memory_object.hpp (original)
+++ trunk/boost/interprocess/shared_memory_object.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)
 //
@@ -15,7 +15,7 @@
 #include <boost/interprocess/detail/workaround.hpp>
 #include <boost/interprocess/creation_tags.hpp>
 #include <boost/interprocess/exceptions.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/interprocess/interprocess_fwd.hpp>
 #include <boost/interprocess/exceptions.hpp>
 #include <boost/interprocess/detail/os_file_functions.hpp>
@@ -88,7 +88,7 @@
    //!Does not throw
    shared_memory_object &operator=(BOOST_RV_REF(shared_memory_object) moved)
    {
- shared_memory_object tmp(boost::interprocess::move(moved));
+ shared_memory_object tmp(boost::move(moved));
       this->swap(tmp);
       return *this;
    }
@@ -251,7 +251,7 @@
 
 #if defined(__FreeBSD__)
 
-inline bool use_filesistem_based_posix()
+inline bool use_filesystem_based_posix()
 {
    int jailed = 0;
    std::size_t len = sizeof(jailed);
@@ -275,7 +275,7 @@
    #if defined(BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY)
    const bool add_leading_slash = false;
    #elif defined(BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY)
- const bool add_leading_slash = !shared_memory_object_ipcdetail::use_filesistem_based_posix();
+ const bool add_leading_slash = !shared_memory_object_ipcdetail::use_filesystem_based_posix();
    #else
    const bool add_leading_slash = true;
    #endif
@@ -361,7 +361,7 @@
       #if defined(BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY)
       const bool add_leading_slash = false;
       #elif defined(BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY)
- const bool add_leading_slash = !shared_memory_object_ipcdetail::use_filesistem_based_posix();
+ const bool add_leading_slash = !shared_memory_object_ipcdetail::use_filesystem_based_posix();
       #else
       const bool add_leading_slash = true;
       #endif

Modified: trunk/boost/interprocess/smart_ptr/deleter.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/deleter.hpp (original)
+++ trunk/boost/interprocess/smart_ptr/deleter.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (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
@@ -51,7 +51,7 @@
    {}
 
    void operator()(const pointer &p)
- { mp_mngr->destroy_ptr(ipcdetail::get_pointer(p)); }
+ { mp_mngr->destroy_ptr(ipcdetail::to_raw_pointer(p)); }
 };
 
 } //namespace interprocess {

Modified: trunk/boost/interprocess/smart_ptr/detail/shared_count.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/detail/shared_count.hpp (original)
+++ trunk/boost/interprocess/smart_ptr/detail/shared_count.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -4,7 +4,7 @@
 //
 // (C) Copyright Peter Dimov and Multi Media Ltd. 2001, 2002, 2003
 // (C) Copyright Peter Dimov 2004-2005
-// (C) Copyright Ion Gaztanaga 2006-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2006-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)
 //
@@ -92,7 +92,7 @@
                         deallocator(m_pi, alloc);
             //It's more correct to use VoidAllocator::construct but
             //this needs copy constructor and we don't like it
- new(ipcdetail::get_pointer(m_pi))counted_impl(p, a, d);
+ new(ipcdetail::to_raw_pointer(m_pi))counted_impl(p, a, d);
             deallocator.release();
          }
       }
@@ -105,7 +105,7 @@
 
    ~shared_count() // nothrow
    {
- if( m_pi != 0 )
+ if(m_pi)
          m_pi->release();
    }
 
@@ -145,10 +145,10 @@
       }
    }
 
- const pointer &get_pointer() const
+ const pointer &to_raw_pointer() const
    { return m_px; }
 
- pointer &get_pointer()
+ pointer &to_raw_pointer()
    { return m_px; }
 
    shared_count & operator= (shared_count const & r) // nothrow

Modified: trunk/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp (original)
+++ trunk/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (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/smart_ptr/detail/sp_counted_base_atomic.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp (original)
+++ trunk/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -9,7 +9,7 @@
 
 // Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
 // Copyright 2004-2005 Peter Dimov
-// Copyright 2007-2009 Ion Gaztanaga
+// Copyright 2007-2011 Ion Gaztanaga
 //
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at

Modified: trunk/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp (original)
+++ trunk/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -115,7 +115,7 @@
       scoped_ptr< this_type, scoped_ptr_dealloc_functor<this_allocator> >
          deleter(this_ptr, a_copy);
       typedef typename this_allocator::value_type value_type;
- ipcdetail::get_pointer(this_ptr)->~value_type();
+ ipcdetail::to_raw_pointer(this_ptr)->~value_type();
    }
 
    void release() // nothrow

Modified: trunk/boost/interprocess/smart_ptr/enable_shared_from_this.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/enable_shared_from_this.hpp (original)
+++ trunk/boost/interprocess/smart_ptr/enable_shared_from_this.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -53,14 +53,14 @@
    shared_ptr<T, A, D> shared_from_this()
    {
       shared_ptr<T, A, D> p(_internal_weak_this);
- BOOST_ASSERT(ipcdetail::get_pointer(p.get()) == this);
+ BOOST_ASSERT(ipcdetail::to_raw_pointer(p.get()) == this);
       return p;
    }
 
    shared_ptr<T const, A, D> shared_from_this() const
    {
       shared_ptr<T const, A, D> p(_internal_weak_this);
- BOOST_ASSERT(ipcdetail::get_pointer(p.get()) == this);
+ BOOST_ASSERT(ipcdetail::to_raw_pointer(p.get()) == this);
       return p;
    }
 

Modified: trunk/boost/interprocess/smart_ptr/intrusive_ptr.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/intrusive_ptr.hpp (original)
+++ trunk/boost/interprocess/smart_ptr/intrusive_ptr.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -68,35 +68,35 @@
    {}
 
    //!Constructor. Copies pointer and if "p" is not zero and
- //!"add_ref" is true calls intrusive_ptr_add_ref(get_pointer(p)).
+ //!"add_ref" is true calls intrusive_ptr_add_ref(to_raw_pointer(p)).
    //!Does not throw
    intrusive_ptr(const pointer &p, bool add_ref = true): m_ptr(p)
    {
- if(m_ptr != 0 && add_ref) intrusive_ptr_add_ref(ipcdetail::get_pointer(m_ptr));
+ if(m_ptr != 0 && add_ref) intrusive_ptr_add_ref(ipcdetail::to_raw_pointer(m_ptr));
    }
 
    //!Copy constructor. Copies the internal pointer and if "p" is not
- //!zero calls intrusive_ptr_add_ref(get_pointer(p)). Does not throw
+ //!zero calls intrusive_ptr_add_ref(to_raw_pointer(p)). Does not throw
    intrusive_ptr(intrusive_ptr const & rhs)
       : m_ptr(rhs.m_ptr)
    {
- if(m_ptr != 0) intrusive_ptr_add_ref(ipcdetail::get_pointer(m_ptr));
+ if(m_ptr != 0) intrusive_ptr_add_ref(ipcdetail::to_raw_pointer(m_ptr));
    }
 
    //!Constructor from related. Copies the internal pointer and if "p" is not
- //!zero calls intrusive_ptr_add_ref(get_pointer(p)). Does not throw
+ //!zero calls intrusive_ptr_add_ref(to_raw_pointer(p)). Does not throw
    template<class U> intrusive_ptr
       (intrusive_ptr<U, VP> const & rhs)
       : m_ptr(rhs.get())
    {
- if(m_ptr != 0) intrusive_ptr_add_ref(ipcdetail::get_pointer(m_ptr));
+ if(m_ptr != 0) intrusive_ptr_add_ref(ipcdetail::to_raw_pointer(m_ptr));
    }
 
    //!Destructor. If internal pointer is not 0, calls
- //!intrusive_ptr_release(get_pointer(m_ptr)). Does not throw
+ //!intrusive_ptr_release(to_raw_pointer(m_ptr)). Does not throw
    ~intrusive_ptr()
    {
- if(m_ptr != 0) intrusive_ptr_release(ipcdetail::get_pointer(m_ptr));
+ if(m_ptr != 0) intrusive_ptr_release(ipcdetail::to_raw_pointer(m_ptr));
    }
 
    //!Assignment operator. Equivalent to intrusive_ptr(r).swap(*this).
@@ -239,7 +239,7 @@
 //!Does not throw
 template<class T, class VP>
 inline typename boost::interprocess::intrusive_ptr<T, VP>::pointer
- get_pointer(intrusive_ptr<T, VP> p)
+ to_raw_pointer(intrusive_ptr<T, VP> p)
 { return p.get(); }
 
 /*Emulates static cast operator. Does not throw*/
@@ -281,7 +281,7 @@
 //!Returns p.get().
 //!Does not throw
 template<class T, class VP>
-inline T *get_pointer(boost::interprocess::intrusive_ptr<T, VP> p)
+inline T *to_raw_pointer(boost::interprocess::intrusive_ptr<T, VP> p)
 { return p.get(); }
 #endif
 

Modified: trunk/boost/interprocess/smart_ptr/scoped_ptr.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/scoped_ptr.hpp (original)
+++ trunk/boost/interprocess/smart_ptr/scoped_ptr.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -82,7 +82,7 @@
    //!Deletes the object pointed to by the stored pointer and then
    //!stores a copy of p and a copy of d.
    void reset(const pointer &p, const Deleter &d) // never throws
- { BOOST_ASSERT(p == 0 || p != m_ptr); this_type(p).swap(*this); }
+ { BOOST_ASSERT(p == 0 || p != m_ptr); this_type(p, d).swap(*this); }
 
    //!Assigns internal pointer as 0 and returns previous pointer. This will
    //!avoid deletion on destructor
@@ -146,7 +146,7 @@
 //!Returns a copy of the stored pointer
 //!Never throws
 template<class T, class D> inline
-typename scoped_ptr<T, D>::pointer get_pointer(scoped_ptr<T, D> const & p)
+typename scoped_ptr<T, D>::pointer to_raw_pointer(scoped_ptr<T, D> const & p)
 { return p.get(); }
 
 } // namespace interprocess
@@ -155,7 +155,7 @@
 
 #if defined(_MSC_VER) && (_MSC_VER < 1400)
 template<class T, class D> inline
-T *get_pointer(boost::interprocess::scoped_ptr<T, D> const & p)
+T *to_raw_pointer(boost::interprocess::scoped_ptr<T, D> const & p)
 { return p.get(); }
 #endif
 

Modified: trunk/boost/interprocess/smart_ptr/shared_ptr.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/shared_ptr.hpp (original)
+++ trunk/boost/interprocess/smart_ptr/shared_ptr.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -4,7 +4,7 @@
 //
 // (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
 // (C) Copyright Peter Dimov 2001, 2002, 2003
-// (C) Copyright Ion Gaztanaga 2006-2009.
+// (C) Copyright Ion Gaztanaga 2006-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)
@@ -24,7 +24,7 @@
 #include <boost/assert.hpp>
 #include <boost/interprocess/smart_ptr/detail/shared_count.hpp>
 #include <boost/interprocess/detail/mpl.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/interprocess/detail/type_traits.hpp>
 #include <boost/interprocess/allocators/allocator.hpp>
 #include <boost/interprocess/smart_ptr/deleter.hpp>
@@ -128,7 +128,7 @@
       typedef typename boost::pointer_to_other<pointer, T>::type ParameterPointer;
       BOOST_STATIC_ASSERT((ipcdetail::is_same<pointer, ParameterPointer>::value) ||
                           (ipcdetail::is_pointer<pointer>::value));
- ipcdetail::sp_enable_shared_from_this<T, VoidAllocator, Deleter>( m_pn, ipcdetail::get_pointer(p), ipcdetail::get_pointer(p) );
+ ipcdetail::sp_enable_shared_from_this<T, VoidAllocator, Deleter>( m_pn, ipcdetail::to_raw_pointer(p), ipcdetail::to_raw_pointer(p) );
    }
 
 
@@ -163,22 +163,22 @@
    /// @cond
    template<class Y>
    shared_ptr(shared_ptr<Y, VoidAllocator, Deleter> const & r, ipcdetail::static_cast_tag)
- : m_pn( pointer(static_cast<T*>(ipcdetail::get_pointer(r.m_pn.get_pointer())))
+ : m_pn( pointer(static_cast<T*>(ipcdetail::to_raw_pointer(r.m_pn.to_raw_pointer())))
              , r.m_pn)
    {}
 
    template<class Y>
    shared_ptr(shared_ptr<Y, VoidAllocator, Deleter> const & r, ipcdetail::const_cast_tag)
- : m_pn( pointer(const_cast<T*>(ipcdetail::get_pointer(r.m_pn.get_pointer())))
+ : m_pn( pointer(const_cast<T*>(ipcdetail::to_raw_pointer(r.m_pn.to_raw_pointer())))
              , r.m_pn)
    {}
 
    template<class Y>
    shared_ptr(shared_ptr<Y, VoidAllocator, Deleter> const & r, ipcdetail::dynamic_cast_tag)
- : m_pn( pointer(dynamic_cast<T*>(ipcdetail::get_pointer(r.m_pn.get_pointer())))
+ : m_pn( pointer(dynamic_cast<T*>(ipcdetail::to_raw_pointer(r.m_pn.to_raw_pointer())))
              , r.m_pn)
    {
- if(!m_pn.get_pointer()){ // need to allocate new counter -- the cast failed
+ if(!m_pn.to_raw_pointer()){ // need to allocate new counter -- the cast failed
          m_pn = ipcdetail::shared_count<T, VoidAllocator, Deleter>();
       }
    }
@@ -238,17 +238,17 @@
    //!Returns a reference to the
    //!pointed type
    reference operator* () const // never throws
- { BOOST_ASSERT(m_pn.get_pointer() != 0); return *m_pn.get_pointer(); }
+ { BOOST_ASSERT(m_pn.to_raw_pointer() != 0); return *m_pn.to_raw_pointer(); }
 
    //!Returns the pointer pointing
    //!to the owned object
    pointer operator-> () const // never throws
- { BOOST_ASSERT(m_pn.get_pointer() != 0); return m_pn.get_pointer(); }
+ { BOOST_ASSERT(m_pn.to_raw_pointer() != 0); return m_pn.to_raw_pointer(); }
 
    //!Returns the pointer pointing
    //!to the owned object
    pointer get() const // never throws
- { return m_pn.get_pointer(); }
+ { return m_pn.to_raw_pointer(); }
 
    /// @cond
    // implicit conversion to "bool"
@@ -256,13 +256,13 @@
    typedef void (this_type::*unspecified_bool_type)() const;
 
    operator unspecified_bool_type() const // never throws
- { return !m_pn.get_pointer() ? 0 : &this_type::unspecified_bool_type_func; }
+ { return !m_pn.to_raw_pointer() ? 0 : &this_type::unspecified_bool_type_func; }
    /// @endcond
 
    //!Not operator.
    //!Returns true if this->get() != 0, false otherwise
    bool operator! () const // never throws
- { return !m_pn.get_pointer(); }
+ { return !m_pn.to_raw_pointer(); }
 
    //!Returns use_count() == 1.
    //!unique() might be faster than use_count()
@@ -331,9 +331,9 @@
 shared_ptr<T, VoidAllocator, Deleter> dynamic_pointer_cast(shared_ptr<U, VoidAllocator, Deleter> const & r)
 { return shared_ptr<T, VoidAllocator, Deleter>(r, ipcdetail::dynamic_cast_tag()); }
 
-// get_pointer() enables boost::mem_fn to recognize shared_ptr
+// to_raw_pointer() enables boost::mem_fn to recognize shared_ptr
 template<class T, class VoidAllocator, class Deleter> inline
-T * get_pointer(shared_ptr<T, VoidAllocator, Deleter> const & p)
+T * to_raw_pointer(shared_ptr<T, VoidAllocator, Deleter> const & p)
 { return p.get(); }
 
 // operator<<
@@ -394,9 +394,9 @@
 /// @cond
 
 #if defined(_MSC_VER) && (_MSC_VER < 1400)
-// get_pointer() enables boost::mem_fn to recognize shared_ptr
+// to_raw_pointer() enables boost::mem_fn to recognize shared_ptr
 template<class T, class VoidAllocator, class Deleter> inline
-T * get_pointer(boost::interprocess::shared_ptr<T, VoidAllocator, Deleter> const & p)
+T * to_raw_pointer(boost::interprocess::shared_ptr<T, VoidAllocator, Deleter> const & p)
 { return p.get(); }
 #endif
 

Modified: trunk/boost/interprocess/smart_ptr/unique_ptr.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/unique_ptr.hpp (original)
+++ trunk/boost/interprocess/smart_ptr/unique_ptr.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -21,7 +21,7 @@
 #include <boost/assert.hpp>
 #include <boost/interprocess/detail/utilities.hpp>
 #include <boost/interprocess/detail/pointer_type.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/compressed_pair.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/interprocess/detail/mpl.hpp>
@@ -143,7 +143,7 @@
    //!
    //!After the construction, u no longer owns a pointer.
    //![ Note: The deleter constructor can be implemented with
- //! boost::interprocess::forward<D>. -end note ]
+ //! boost::forward<D>. -end note ]
    //!
    //!Postconditions: get() == value u.get() had before the construction.
    //!get_deleter() returns a reference to the internally stored deleter which
@@ -152,7 +152,7 @@
    //!
    //!Throws: nothing.
    unique_ptr(BOOST_RV_REF(unique_ptr) u)
- : ptr_(u.release(), boost::interprocess::forward<D>(u.get_deleter()))
+ : ptr_(u.release(), boost::forward<D>(u.get_deleter()))
    {}
 
    //!Requires: If D is not a reference type, construction of the deleter
@@ -186,7 +186,7 @@
             ,
             nat
>::type = nat())
- : ptr_(const_cast<unique_ptr<U,E>&>(u).release(), boost::interprocess::move<D>(u.get_deleter()))
+ : ptr_(const_cast<unique_ptr<U,E>&>(u).release(), boost::move<D>(u.get_deleter()))
    {}
 
    //!Effects: If get() == 0 there are no effects. Otherwise get_deleter()(get()).
@@ -211,7 +211,7 @@
    unique_ptr& operator=(BOOST_RV_REF(unique_ptr) u)
    {
       reset(u.release());
- ptr_.second() = boost::interprocess::move(u.get_deleter());
+ ptr_.second() = boost::move(u.get_deleter());
       return *this;
    }
 
@@ -233,7 +233,7 @@
    unique_ptr& operator=(BOOST_RV_REF_2_TEMPL_ARGS(unique_ptr, U, E) u)
    {
       reset(u.release());
- ptr_.second() = boost::interprocess::move(u.get_deleter());
+ ptr_.second() = boost::move(u.get_deleter());
       return *this;
    }
 

Modified: trunk/boost/interprocess/smart_ptr/weak_ptr.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/weak_ptr.hpp (original)
+++ trunk/boost/interprocess/smart_ptr/weak_ptr.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -3,7 +3,7 @@
 // This file is the adaptation for Interprocess of boost/weak_ptr.hpp
 //
 // (C) Copyright Peter Dimov 2001, 2002, 2003
-// (C) Copyright Ion Gaztanaga 2006-2009.
+// (C) Copyright Ion Gaztanaga 2006-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/streams/bufferstream.hpp
==============================================================================
--- trunk/boost/interprocess/streams/bufferstream.hpp (original)
+++ trunk/boost/interprocess/streams/bufferstream.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/streams/vectorstream.hpp
==============================================================================
--- trunk/boost/interprocess/streams/vectorstream.hpp (original)
+++ trunk/boost/interprocess/streams/vectorstream.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/sync/file_lock.hpp
==============================================================================
--- trunk/boost/interprocess/sync/file_lock.hpp (original)
+++ trunk/boost/interprocess/sync/file_lock.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,7 +21,7 @@
 #include <boost/interprocess/detail/os_file_functions.hpp>
 #include <boost/interprocess/detail/os_thread_functions.hpp>
 #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 
 //!\file
 //!Describes a class that wraps file locking capabilities.
@@ -65,7 +65,7 @@
    //!Does not throw
    file_lock &operator=(BOOST_RV_REF(file_lock) moved)
    {
- file_lock tmp(boost::interprocess::move(moved));
+ file_lock tmp(boost::move(moved));
       this->swap(tmp);
       return *this;
    }

Deleted: trunk/boost/interprocess/sync/interprocess_barrier.hpp
==============================================================================
--- trunk/boost/interprocess/sync/interprocess_barrier.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
+++ (empty file)
@@ -1,115 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (C) Copyright Ion Gaztanaga 2005-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)
-//
-// See http://www.boost.org/libs/interprocess for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-// barrier is a modified version of Boost Threads barrier
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (C) 2002-2003
-// David Moore, William E. Kempf
-//
-// Permission to use, copy, modify, distribute and sell this software
-// and its documentation for any purpose is hereby granted without fee,
-// provided that the above copyright notice appear in all copies and
-// that both that copyright notice and this permission notice appear
-// in supporting documentation. William E. Kempf makes no representations
-// about the suitability of this software for any purpose.
-// It is provided "as is" without express or implied warranty.
-
-#ifndef BOOST_INTERPROCESS_BARRIER_HPP
-#define BOOST_INTERPROCESS_BARRIER_HPP
-
-/// @cond
-
-#if (defined _MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif
-
-#include <boost/interprocess/detail/config_begin.hpp>
-#include <boost/interprocess/detail/workaround.hpp>
-
-#if defined BOOST_INTERPROCESS_POSIX_PROCESS_SHARED && defined BOOST_INTERPROCESS_POSIX_BARRIERS
-# include <pthread.h>
-# include <errno.h>
-# include <boost/interprocess/sync/posix/pthread_helpers.hpp>
-# define BOOST_INTERPROCESS_USE_POSIX
-#else
-# include <boost/interprocess/sync/interprocess_mutex.hpp>
-# include <boost/interprocess/sync/scoped_lock.hpp>
-# include <boost/interprocess/sync/interprocess_condition.hpp>
-# include <stdexcept>
-# define BOOST_INTERPROCESS_USE_GENERIC_EMULATION
-#endif
-
-# include <boost/interprocess/exceptions.hpp>
-
-/// @endcond
-
-namespace boost {
-namespace interprocess {
-
-//!An object of class barrier is a synchronization primitive that
-//!can be placed in shared memory used to cause a set of threads from
-//!different processes to wait until they each perform a certain
-//!function or each reach a particular point in their execution.
-class barrier
-{
- public:
- //!Constructs a barrier object that will cause count threads
- //!to block on a call to wait().
- barrier(unsigned int count);
-
- //!Destroys *this. If threads are still executing their wait()
- //!operations, the behavior for these threads is undefined.
- ~barrier();
-
- //!Effects: Wait until N threads call wait(), where N equals the count
- //!provided to the constructor for the barrier object.
- //!Note that if the barrier is destroyed before wait() can return,
- //!the behavior is undefined.
- //!Returns: Exactly one of the N threads will receive a return value
- //!of true, the others will receive a value of false. Precisely which
- //!thread receives the return value of true will be implementation-defined.
- //!Applications can use this value to designate one thread as a leader that
- //!will take a certain action, and the other threads emerging from the barrier
- //!can wait for that action to take place.
- bool wait();
-
- /// @cond
- private:
- #if defined(BOOST_INTERPROCESS_USE_GENERIC_EMULATION)
- interprocess_mutex m_mutex;
- interprocess_condition m_cond;
- unsigned int m_threshold;
- unsigned int m_count;
- unsigned int m_generation;
- #else //#if defined BOOST_INTERPROCESS_USE_POSIX
- pthread_barrier_t m_barrier;
- #endif//#if defined BOOST_INTERPROCESS_USE_POSIX
- /// @endcond
-};
-
-} // namespace interprocess
-} // namespace boost
-
-
-#ifdef BOOST_INTERPROCESS_USE_GENERIC_EMULATION
-# undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION
-# include <boost/interprocess/sync/emulation/interprocess_barrier.hpp>
-#endif
-
-#ifdef BOOST_INTERPROCESS_USE_POSIX
-# undef BOOST_INTERPROCESS_USE_POSIX
-# include <boost/interprocess/sync/posix/interprocess_barrier.hpp>
-#endif
-
-#include <boost/interprocess/detail/config_end.hpp>
-
-#endif

Modified: trunk/boost/interprocess/sync/interprocess_condition.hpp
==============================================================================
--- trunk/boost/interprocess/sync/interprocess_condition.hpp (original)
+++ trunk/boost/interprocess/sync/interprocess_condition.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,22 +21,20 @@
 #include <boost/interprocess/detail/workaround.hpp>
 
 #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
-#include <boost/interprocess/sync/scoped_lock.hpp>
-#include <boost/interprocess/sync/interprocess_condition.hpp>
 #include <boost/interprocess/sync/interprocess_mutex.hpp>
 #include <boost/interprocess/exceptions.hpp>
 #include <boost/limits.hpp>
 #include <boost/assert.hpp>
 
 #if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined(BOOST_INTERPROCESS_POSIX_PROCESS_SHARED)
- #include <pthread.h>
- #include <errno.h>
- #include <boost/interprocess/sync/posix/pthread_helpers.hpp>
+ #include <boost/interprocess/sync/posix/condition.hpp>
    #define BOOST_INTERPROCESS_USE_POSIX
+//Experimental...
+//#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS)
+// #include <boost/interprocess/sync/windows/condition.hpp>
+// #define BOOST_INTERPROCESS_USE_WINDOWS
 #else
- #include <boost/interprocess/detail/atomic.hpp>
- #include <boost/cstdint.hpp>
- #include <boost/interprocess/detail/os_thread_functions.hpp>
+ #include <boost/interprocess/sync/spin/condition.hpp>
    #define BOOST_INTERPROCESS_USE_GENERIC_EMULATION
 #endif
 
@@ -66,19 +64,21 @@
    /// @endcond
    public:
    //!Constructs a interprocess_condition. On error throws interprocess_exception.
- interprocess_condition();
+ interprocess_condition(){}
 
    //!Destroys *this
    //!liberating system resources.
- ~interprocess_condition();
+ ~interprocess_condition(){}
 
    //!If there is a thread waiting on *this, change that
    //!thread's state to ready. Otherwise there is no effect.
- void notify_one();
+ void notify_one()
+ { m_condition.notify_one(); }
 
    //!Change the state of all threads waiting on *this to ready.
    //!If there are no waiting threads, notify_all() has no effect.
- void notify_all();
+ void notify_all()
+ { m_condition.notify_all(); }
 
    //!Releases the lock on the interprocess_mutex object associated with lock, blocks
    //!the current thread of execution until readied by a call to
@@ -88,7 +88,7 @@
    {
       if (!lock)
          throw lock_exception();
- do_wait(*lock.mutex());
+ this->do_wait(*lock.mutex());
    }
 
    //!The same as:
@@ -100,7 +100,7 @@
          throw lock_exception();
 
       while (!pred())
- do_wait(*lock.mutex());
+ this->do_wait(*lock.mutex());
    }
 
    //!Releases the lock on the interprocess_mutex object associated with lock, blocks
@@ -117,7 +117,7 @@
       }
       if (!lock)
             throw lock_exception();
- return do_timed_wait(abs_time, *lock.mutex());
+ return this->do_timed_wait(abs_time, *lock.mutex());
    }
 
    //!The same as: while (!pred()) {
@@ -133,7 +133,7 @@
       if (!lock)
             throw lock_exception();
       while (!pred()){
- if (!do_timed_wait(abs_time, *lock.mutex()))
+ if (!this->do_timed_wait(abs_time, *lock.mutex()))
             return pred();
       }
 
@@ -141,39 +141,32 @@
    }
 
    /// @cond
- private:
- void do_wait(interprocess_mutex &mut);
 
- bool do_timed_wait(const boost::posix_time::ptime &abs_time, interprocess_mutex &mut);
+ void do_wait(interprocess_mutex &mut)
+ { m_condition.do_wait(mut.mutex); }
+
+ bool do_timed_wait(const boost::posix_time::ptime &abs_time, interprocess_mutex &mut)
+ { return m_condition.do_timed_wait(abs_time, mut.mutex); }
 
+ private:
    #if defined (BOOST_INTERPROCESS_USE_GENERIC_EMULATION)
- enum { SLEEP = 0, NOTIFY_ONE, NOTIFY_ALL };
- interprocess_mutex m_enter_mut;
- //interprocess_mutex m_check_mut;
- volatile boost::uint32_t m_command;
- volatile boost::uint32_t m_num_waiters;
- bool do_timed_wait(bool tout_enabled, const boost::posix_time::ptime &abs_time, interprocess_mutex &mut);
- void notify(boost::uint32_t command);
+ #undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION
+ ipcdetail::spin_condition m_condition;
    #elif defined(BOOST_INTERPROCESS_USE_POSIX)
- pthread_cond_t m_condition;
+ #undef BOOST_INTERPROCESS_USE_POSIX
+ ipcdetail::posix_condition m_condition;
+ #elif defined(BOOST_INTERPROCESS_USE_WINDOWS)
+ #undef BOOST_INTERPROCESS_USE_WINDOWS
+ ipcdetail::windows_condition m_condition;
+ #else
+ #error "Unknown platform for interprocess_mutex"
    #endif
    /// @endcond
 };
 
 } //namespace interprocess
-
 } // namespace boost
 
-#ifdef BOOST_INTERPROCESS_USE_GENERIC_EMULATION
-# undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION
-# include <boost/interprocess/sync/emulation/interprocess_condition.hpp>
-#endif
-
-#ifdef BOOST_INTERPROCESS_USE_POSIX
-# undef BOOST_INTERPROCESS_USE_POSIX
-# include <boost/interprocess/sync/posix/interprocess_condition.hpp>
-#endif
-
 #include <boost/interprocess/detail/config_end.hpp>
 
 #endif // BOOST_INTERPROCESS_CONDITION_HPP

Modified: trunk/boost/interprocess/sync/interprocess_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/interprocess_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/interprocess_mutex.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,19 +21,21 @@
 # pragma once
 #endif
 
-#include <boost/interprocess/exceptions.hpp>
 #include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/exceptions.hpp>
 #include <boost/interprocess/detail/workaround.hpp>
 #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
 #include <boost/assert.hpp>
 
 #if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_POSIX_PROCESS_SHARED)
- #include <pthread.h>
- #include <errno.h>
- #include <boost/interprocess/sync/posix/pthread_helpers.hpp>
+ #include <boost/interprocess/sync/posix/mutex.hpp>
    #define BOOST_INTERPROCESS_USE_POSIX
+//Experimental...
+//#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS)
+// #include <boost/interprocess/sync/windows/mutex.hpp>
+// #define BOOST_INTERPROCESS_USE_WINDOWS
 #else
- #include <boost/interprocess/sync/emulation/mutex.hpp>
+ #include <boost/interprocess/sync/spin/mutex.hpp>
    #define BOOST_INTERPROCESS_USE_GENERIC_EMULATION
 
 namespace boost {
@@ -108,54 +110,60 @@
    /// @cond
    private:
 
- #if defined(BOOST_INTERPROCESS_USE_GENERIC_EMULATION)
- friend class ipcdetail::robust_emulation_helpers::mutex_traits<interprocess_mutex>;
- void take_ownership(){ mutex.take_ownership(); }
- ipcdetail::emulation_mutex mutex;
+ #if defined(BOOST_INTERPROCESS_USE_GENERIC_EMULATION)
+ #undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION
+ friend class ipcdetail::robust_emulation_helpers::mutex_traits<interprocess_mutex>;
+ void take_ownership(){ mutex.take_ownership(); }
+ ipcdetail::spin_mutex mutex;
    #elif defined(BOOST_INTERPROCESS_USE_POSIX)
- pthread_mutex_t m_mut;
- #endif //#if (defined BOOST_INTERPROCESS_WINDOWS)
+ #undef BOOST_INTERPROCESS_USE_POSIX
+ ipcdetail::posix_mutex mutex;
+ #elif defined(BOOST_INTERPROCESS_USE_WINDOWS)
+ #undef BOOST_INTERPROCESS_USE_WINDOWS
+ ipcdetail::windows_mutex mutex;
+ #else
+ #error "Unknown platform for interprocess_mutex"
+ #endif
    /// @endcond
 };
 
 } //namespace interprocess {
 } //namespace boost {
 
-#ifdef BOOST_INTERPROCESS_USE_GENERIC_EMULATION
-# undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION
 
 namespace boost {
 namespace interprocess {
 
 inline interprocess_mutex::interprocess_mutex(){}
+
 inline interprocess_mutex::~interprocess_mutex(){}
+
 inline void interprocess_mutex::lock()
 {
-#ifdef BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING
- boost::posix_time::ptime wait_time
- = boost::posix_time::microsec_clock::universal_time()
- + boost::posix_time::milliseconds(BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS);
- if (!mutex.timed_lock(wait_time))
- {
- throw interprocess_exception(timeout_when_locking_error, "Interprocess mutex timeout when locking. Possible deadlock: owner died without unlocking?");
- }
-#else
- mutex.lock();
-#endif
+ #ifdef BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING
+ boost::posix_time::ptime wait_time
+ = boost::posix_time::microsec_clock::universal_time()
+ + boost::posix_time::milliseconds(BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS);
+ if (!mutex.timed_lock(wait_time))
+ {
+ throw interprocess_exception(timeout_when_locking_error, "Interprocess mutex timeout when locking. Possible deadlock: owner died without unlocking?");
+ }
+ #else
+ mutex.lock();
+ #endif
 }
-inline bool interprocess_mutex::try_lock(){ return mutex.try_lock(); }
-inline bool interprocess_mutex::timed_lock(const boost::posix_time::ptime &abs_time){ return mutex.timed_lock(abs_time); }
-inline void interprocess_mutex::unlock(){ mutex.unlock(); }
 
-} //namespace interprocess {
-} //namespace boost {
+inline bool interprocess_mutex::try_lock()
+{ return mutex.try_lock(); }
 
-#endif
+inline bool interprocess_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
+{ return mutex.timed_lock(abs_time); }
 
-#ifdef BOOST_INTERPROCESS_USE_POSIX
-#include <boost/interprocess/sync/posix/interprocess_mutex.hpp>
-# undef BOOST_INTERPROCESS_USE_POSIX
-#endif
+inline void interprocess_mutex::unlock()
+{ mutex.unlock(); }
+
+} //namespace interprocess {
+} //namespace boost {
 
 #include <boost/interprocess/detail/config_end.hpp>
 

Modified: trunk/boost/interprocess/sync/interprocess_recursive_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/interprocess_recursive_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/interprocess_recursive_mutex.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)
 //
@@ -40,12 +40,14 @@
 
 #if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && \
    (defined(BOOST_INTERPROCESS_POSIX_PROCESS_SHARED) && defined (BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES))
- #include <pthread.h>
- #include <errno.h>
- #include <boost/interprocess/sync/posix/pthread_helpers.hpp>
+ #include <boost/interprocess/sync/posix/recursive_mutex.hpp>
    #define BOOST_INTERPROCESS_USE_POSIX
+//Experimental...
+//#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS)
+// #include <boost/interprocess/sync/windows/recursive_mutex.hpp>
+// #define BOOST_INTERPROCESS_USE_WINDOWS
 #else
- #include <boost/interprocess/sync/emulation/recursive_mutex.hpp>
+ #include <boost/interprocess/sync/spin/recursive_mutex.hpp>
    #define BOOST_INTERPROCESS_USE_GENERIC_EMULATION
 #endif
 
@@ -118,53 +120,57 @@
    private:
 
    #if defined (BOOST_INTERPROCESS_USE_GENERIC_EMULATION)
- void take_ownership(){ mutex.take_ownership(); }
- friend class ipcdetail::robust_emulation_helpers::mutex_traits<interprocess_recursive_mutex>;
- ipcdetail::emulation_recursive_mutex mutex;
- #else //#if defined (BOOST_INTERPROCESS_USE_GENERIC_EMULATION)
- pthread_mutex_t m_mut;
- #endif //#if (defined BOOST_INTERPROCESS_WINDOWS)
+ #undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION
+ void take_ownership(){ mutex.take_ownership(); }
+ friend class ipcdetail::robust_emulation_helpers::mutex_traits<interprocess_recursive_mutex>;
+ ipcdetail::spin_recursive_mutex mutex;
+ #elif defined(BOOST_INTERPROCESS_USE_POSIX)
+ #undef BOOST_INTERPROCESS_USE_POSIX
+ ipcdetail::posix_recursive_mutex mutex;
+ #elif defined(BOOST_INTERPROCESS_USE_WINDOWS)
+ #undef BOOST_INTERPROCESS_USE_WINDOWS
+ ipcdetail::windows_recursive_mutex mutex;
+ #else
+ #error "Unknown platform for interprocess_mutex"
+ #endif
    /// @endcond
 };
 
 } //namespace interprocess {
 } //namespace boost {
 
-#ifdef BOOST_INTERPROCESS_USE_GENERIC_EMULATION
-# undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION
-
 namespace boost {
 namespace interprocess {
 
 inline interprocess_recursive_mutex::interprocess_recursive_mutex(){}
+
 inline interprocess_recursive_mutex::~interprocess_recursive_mutex(){}
+
 inline void interprocess_recursive_mutex::lock()
 {
-#ifdef BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING
- boost::posix_time::ptime wait_time
- = boost::posix_time::microsec_clock::universal_time()
- + boost::posix_time::milliseconds(BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS);
- if (!mutex.timed_lock(wait_time))
- {
- throw interprocess_exception(timeout_when_locking_error, "Interprocess mutex timeout when locking. Possible deadlock: owner died without unlocking?");
- }
-#else
- mutex.lock();
-#endif
+ #ifdef BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING
+ boost::posix_time::ptime wait_time
+ = boost::posix_time::microsec_clock::universal_time()
+ + boost::posix_time::milliseconds(BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS);
+ if (!mutex.timed_lock(wait_time)){
+ throw interprocess_exception(timeout_when_locking_error, "Interprocess mutex timeout when locking. Possible deadlock: owner died without unlocking?");
+ }
+ #else
+ mutex.lock();
+ #endif
 }
-inline bool interprocess_recursive_mutex::try_lock(){ return mutex.try_lock(); }
-inline bool interprocess_recursive_mutex::timed_lock(const boost::posix_time::ptime &abs_time){ return mutex.timed_lock(abs_time); }
-inline void interprocess_recursive_mutex::unlock(){ mutex.unlock(); }
 
-} //namespace interprocess {
-} //namespace boost {
+inline bool interprocess_recursive_mutex::try_lock()
+{ return mutex.try_lock(); }
 
-#endif
+inline bool interprocess_recursive_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
+{ return mutex.timed_lock(abs_time); }
 
-#ifdef BOOST_INTERPROCESS_USE_POSIX
-# undef BOOST_INTERPROCESS_USE_POSIX
-#include <boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp>
-#endif
+inline void interprocess_recursive_mutex::unlock()
+{ mutex.unlock(); }
+
+} //namespace interprocess {
+} //namespace boost {
 
 #include <boost/interprocess/detail/config_end.hpp>
 

Modified: trunk/boost/interprocess/sync/interprocess_semaphore.hpp
==============================================================================
--- trunk/boost/interprocess/sync/interprocess_semaphore.hpp (original)
+++ trunk/boost/interprocess/sync/interprocess_semaphore.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,23 +19,21 @@
 
 #include <boost/interprocess/detail/config_begin.hpp>
 #include <boost/interprocess/detail/workaround.hpp>
+
 #include <boost/interprocess/creation_tags.hpp>
 #include <boost/interprocess/exceptions.hpp>
 #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
 
 #if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && \
    (defined(BOOST_INTERPROCESS_POSIX_PROCESS_SHARED) && defined(BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES))
- #include <fcntl.h> //O_CREAT, O_*...
- #include <unistd.h> //close
- #include <string> //std::string
- #include <semaphore.h> //sem_* family, SEM_VALUE_MAX
- #include <sys/stat.h> //mode_t, S_IRWXG, S_IRWXO, S_IRWXU,
- #include <boost/interprocess/sync/posix/semaphore_wrapper.hpp>
+ #include <boost/interprocess/sync/posix/semaphore.hpp>
    #define BOOST_INTERPROCESS_USE_POSIX
+//Experimental...
+//#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS)
+// #include <boost/interprocess/sync/windows/semaphore.hpp>
+// #define BOOST_INTERPROCESS_USE_WINDOWS
 #else
- #include <boost/interprocess/detail/atomic.hpp>
- #include <boost/cstdint.hpp>
- #include <boost/interprocess/detail/os_thread_functions.hpp>
+ #include <boost/interprocess/sync/spin/semaphore.hpp>
    #define BOOST_INTERPROCESS_USE_GENERIC_EMULATION
 #endif
 
@@ -45,7 +43,6 @@
 //!Describes a interprocess_semaphore class for inter-process synchronization
 
 namespace boost {
-
 namespace interprocess {
 
 //!Wraps a interprocess_semaphore that can be placed in shared memory and can be
@@ -93,26 +90,55 @@
    /// @cond
    private:
    #if defined(BOOST_INTERPROCESS_USE_GENERIC_EMULATION)
- volatile boost::uint32_t m_count;
+ #undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION
+ ipcdetail::spin_semaphore m_sem;
+ #elif defined(BOOST_INTERPROCESS_USE_WINDOWS)
+ #undef BOOST_INTERPROCESS_USE_WINDOWS
+ ipcdetail::windows_semaphore m_sem;
    #else
- ipcdetail::semaphore_wrapper m_sem;
+ #undef BOOST_INTERPROCESS_USE_POSIX
+ ipcdetail::posix_semaphore m_sem;
    #endif //#if defined(BOOST_INTERPROCESS_USE_GENERIC_EMULATION)
    /// @endcond
 };
 
 } //namespace interprocess {
-
 } //namespace boost {
 
-#ifdef BOOST_INTERPROCESS_USE_GENERIC_EMULATION
-# undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION
-# include <boost/interprocess/sync/emulation/interprocess_semaphore.hpp>
-#endif
+namespace boost {
+namespace interprocess {
 
-#ifdef BOOST_INTERPROCESS_USE_POSIX
-# undef BOOST_INTERPROCESS_USE_POSIX
-# include <boost/interprocess/sync/posix/interprocess_semaphore.hpp>
-#endif
+inline interprocess_semaphore::interprocess_semaphore(unsigned int initialCount)
+ : m_sem(initialCount)
+{}
+
+inline interprocess_semaphore::~interprocess_semaphore(){}
+
+inline void interprocess_semaphore::wait()
+{
+ #ifdef BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING
+ boost::posix_time::ptime wait_time
+ = boost::posix_time::microsec_clock::universal_time()
+ + boost::posix_time::milliseconds(BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS);
+ if (!m_sem.timed_wait(wait_time))
+ {
+ throw interprocess_exception(timeout_when_waiting_error, "Interprocess semaphore timeout when waiting. Possible deadlock: owner died without posting?");
+ }
+ #else
+ m_sem.wait();
+ #endif
+}
+inline bool interprocess_semaphore::try_wait()
+{ return m_sem.try_wait(); }
+
+inline bool interprocess_semaphore::timed_wait(const boost::posix_time::ptime &abs_time)
+{ return m_sem.timed_wait(abs_time); }
+
+inline void interprocess_semaphore::post()
+{ m_sem.post(); }
+
+} //namespace interprocess {
+} //namespace boost {
 
 #include <boost/interprocess/detail/config_end.hpp>
 

Modified: trunk/boost/interprocess/sync/interprocess_upgradable_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/interprocess_upgradable_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/interprocess_upgradable_mutex.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,6 +18,7 @@
 #include <boost/interprocess/detail/config_begin.hpp>
 #include <boost/interprocess/detail/workaround.hpp>
 #include <boost/interprocess/sync/scoped_lock.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
 #include <boost/interprocess/sync/interprocess_mutex.hpp>
 #include <boost/interprocess/sync/interprocess_condition.hpp>
 #include <climits>

Modified: trunk/boost/interprocess/sync/lock_options.hpp
==============================================================================
--- trunk/boost/interprocess/sync/lock_options.hpp (original)
+++ trunk/boost/interprocess/sync/lock_options.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/sync/mutex_family.hpp
==============================================================================
--- trunk/boost/interprocess/sync/mutex_family.hpp (original)
+++ trunk/boost/interprocess/sync/mutex_family.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/sync/named_condition.hpp
==============================================================================
--- trunk/boost/interprocess/sync/named_condition.hpp (original)
+++ trunk/boost/interprocess/sync/named_condition.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)
 //
@@ -17,25 +17,15 @@
 
 #include <boost/interprocess/detail/config_begin.hpp>
 #include <boost/interprocess/detail/workaround.hpp>
-#include <boost/static_assert.hpp>
-#include <boost/interprocess/detail/type_traits.hpp>
 #include <boost/interprocess/creation_tags.hpp>
 #include <boost/interprocess/exceptions.hpp>
-#include <boost/interprocess/shared_memory_object.hpp>
-#include <boost/interprocess/sync/interprocess_condition.hpp>
-#include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
-#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
-#include <boost/interprocess/sync/emulation/named_creation_functor.hpp>
-#include <boost/interprocess/sync/named_mutex.hpp>
+#include <boost/interprocess/detail/interprocess_tester.hpp>
 #include <boost/interprocess/permissions.hpp>
-#if defined BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES
-#include <boost/interprocess/sync/interprocess_mutex.hpp>
-#include <boost/interprocess/sync/scoped_lock.hpp>
-#endif
-
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/interprocess/sync/shm/named_condition.hpp>
 
 //!\file
-//!Describes process-shared variables interprocess_condition class
+//!Describes a named condition class for inter-process synchronization
 
 namespace boost {
 namespace interprocess {
@@ -120,78 +110,11 @@
 
    /// @cond
    private:
-
- struct condition_holder
- {
- interprocess_condition cond_;
- //If named_mutex is implemented using semaphores
- //we need to store an additional mutex
- #if defined (BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES)
- interprocess_mutex mutex_;
- #endif
- };
-
- interprocess_condition *condition() const
- { return &static_cast<condition_holder*>(m_shmem.get_user_address())->cond_; }
-
- template <class Lock>
- class lock_inverter
- {
- Lock &l_;
- public:
- lock_inverter(Lock &l)
- : l_(l)
- {}
- void lock() { l_.unlock(); }
- void unlock() { l_.lock(); }
- };
-
- #if defined (BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES)
- interprocess_mutex *mutex() const
- { return &static_cast<condition_holder*>(m_shmem.get_user_address())->mutex_; }
-
- template <class Lock>
- void do_wait(Lock& lock)
- {
- //named_condition only works with named_mutex
- BOOST_STATIC_ASSERT((ipcdetail::is_convertible<typename Lock::mutex_type&, named_mutex&>::value == true));
-
- //lock internal before unlocking external to avoid race with a notifier
- scoped_lock<interprocess_mutex> internal_lock(*this->mutex());
- lock_inverter<Lock> inverted_lock(lock);
- scoped_lock<lock_inverter<Lock> > external_unlock(inverted_lock);
-
- //unlock internal first to avoid deadlock with near simultaneous waits
- scoped_lock<interprocess_mutex> internal_unlock;
- internal_lock.swap(internal_unlock);
- this->condition()->wait(internal_unlock);
- }
-
- template <class Lock>
- bool do_timed_wait(Lock& lock, const boost::posix_time::ptime &abs_time)
- {
- //named_condition only works with named_mutex
- BOOST_STATIC_ASSERT((ipcdetail::is_convertible<typename Lock::mutex_type&, named_mutex&>::value == true));
- //lock internal before unlocking external to avoid race with a notifier
- scoped_lock<interprocess_mutex> internal_lock(*this->mutex(), abs_time);
- if(!internal_lock) return false;
- lock_inverter<Lock> inverted_lock(lock);
- scoped_lock<lock_inverter<Lock> > external_unlock(inverted_lock);
-
- //unlock internal first to avoid deadlock with near simultaneous waits
- scoped_lock<interprocess_mutex> internal_unlock;
- internal_lock.swap(internal_unlock);
- return this->condition()->timed_wait(internal_unlock, abs_time);
- }
- #endif
+ ipcdetail::shm_named_condition m_cond;
 
    friend class ipcdetail::interprocess_tester;
- void dont_close_on_destruction();
-
- ipcdetail::managed_open_or_create_impl<shared_memory_object> m_shmem;
-
- template <class T, class Arg> friend class boost::interprocess::ipcdetail::named_creation_functor;
- typedef ipcdetail::named_creation_functor<condition_holder> construct_func_t;
+ void dont_close_on_destruction()
+ { ipcdetail::interprocess_tester::dont_close_on_destruction(m_cond); }
    /// @endcond
 };
 
@@ -201,165 +124,43 @@
 {}
 
 inline named_condition::named_condition(create_only_t, const char *name, const permissions &perm)
- : m_shmem (create_only
- ,name
- ,sizeof(condition_holder) +
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
- ,read_write
- ,0
- ,construct_func_t(ipcdetail::DoCreate)
- ,perm)
+ : m_cond(create_only_t(), name, perm)
 {}
 
 inline named_condition::named_condition(open_or_create_t, const char *name, const permissions &perm)
- : m_shmem (open_or_create
- ,name
- ,sizeof(condition_holder) +
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
- ,read_write
- ,0
- ,construct_func_t(ipcdetail::DoOpenOrCreate)
- ,perm)
+ : m_cond(open_or_create_t(), name, perm)
 {}
 
 inline named_condition::named_condition(open_only_t, const char *name)
- : m_shmem (open_only
- ,name
- ,read_write
- ,0
- ,construct_func_t(ipcdetail::DoOpen))
+ : m_cond(open_only_t(), name)
 {}
 
-inline void named_condition::dont_close_on_destruction()
-{ ipcdetail::interprocess_tester::dont_close_on_destruction(m_shmem); }
-
-#if defined(BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES)
-
-inline void named_condition::notify_one()
-{
- scoped_lock<interprocess_mutex> internal_lock(*this->mutex());
- this->condition()->notify_one();
-}
-
-inline void named_condition::notify_all()
-{
- scoped_lock<interprocess_mutex> internal_lock(*this->mutex());
- this->condition()->notify_all();
-}
-
-template <typename L>
-inline void named_condition::wait(L& lock)
-{
- if (!lock)
- throw lock_exception();
- this->do_wait(lock);
-}
-
-template <typename L, typename Pr>
-inline void named_condition::wait(L& lock, Pr pred)
-{
- if (!lock)
- throw lock_exception();
- while (!pred())
- this->do_wait(lock);
-}
-
-template <typename L>
-inline bool named_condition::timed_wait
- (L& lock, const boost::posix_time::ptime &abs_time)
-{
- if(abs_time == boost::posix_time::pos_infin){
- this->wait(lock);
- return true;
- }
- if (!lock)
- throw lock_exception();
- return this->do_timed_wait(lock, abs_time);
-}
-
-template <typename L, typename Pr>
-inline bool named_condition::timed_wait
- (L& lock, const boost::posix_time::ptime &abs_time, Pr pred)
-{
- if(abs_time == boost::posix_time::pos_infin){
- this->wait(lock, pred);
- return true;
- }
- if (!lock)
- throw lock_exception();
-
- while (!pred()){
- if(!this->do_timed_wait(lock, abs_time)){
- return pred();
- }
- }
- return true;
-}
-
-#else
-
 inline void named_condition::notify_one()
-{ this->condition()->notify_one(); }
+{ m_cond.notify_one(); }
 
 inline void named_condition::notify_all()
-{ this->condition()->notify_all(); }
+{ m_cond.notify_all(); }
 
 template <typename L>
 inline void named_condition::wait(L& lock)
-{
- if (!lock)
- throw lock_exception();
- this->condition()->do_wait(*lock.mutex()->mutex());
-}
+{ m_cond.wait(lock); }
 
 template <typename L, typename Pr>
 inline void named_condition::wait(L& lock, Pr pred)
-{
- if (!lock)
- throw lock_exception();
-
- while (!pred())
- this->condition()->do_wait(*lock.mutex()->mutex());
-}
+{ m_cond.wait(lock, pred); }
 
 template <typename L>
 inline bool named_condition::timed_wait
    (L& lock, const boost::posix_time::ptime &abs_time)
-{
- if(abs_time == boost::posix_time::pos_infin){
- this->wait(lock);
- return true;
- }
- if (!lock)
- throw lock_exception();
- return this->condition()->do_timed_wait(abs_time, *lock.mutex()->mutex());
-}
+{ return m_cond.timed_wait(lock, abs_time); }
 
 template <typename L, typename Pr>
 inline bool named_condition::timed_wait
    (L& lock, const boost::posix_time::ptime &abs_time, Pr pred)
-{
- if(abs_time == boost::posix_time::pos_infin){
- this->wait(lock, pred);
- return true;
- }
- if (!lock)
- throw lock_exception();
-
- while (!pred()){
- if (!this->condition()->do_timed_wait(abs_time, *lock.mutex()->mutex()))
- return pred();
- }
-
- return true;
-}
-
-#endif
+{ return m_cond.timed_wait(lock, abs_time, pred); }
 
 inline bool named_condition::remove(const char *name)
-{ return shared_memory_object::remove(name); }
+{ return ipcdetail::shm_named_condition::remove(name); }
 
 /// @endcond
 

Modified: trunk/boost/interprocess/sync/named_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/named_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/named_mutex.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,17 +19,14 @@
 #include <boost/interprocess/detail/workaround.hpp>
 #include <boost/interprocess/creation_tags.hpp>
 #include <boost/interprocess/exceptions.hpp>
-#include <boost/interprocess/sync/emulation/named_creation_functor.hpp>
 #include <boost/interprocess/detail/interprocess_tester.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
 #include <boost/interprocess/permissions.hpp>
 
 #if defined(BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES)
- #include <boost/interprocess/sync/posix/semaphore_wrapper.hpp>
+#include <boost/interprocess/sync/posix/named_mutex.hpp>
 #else
- #include <boost/interprocess/shared_memory_object.hpp>
- #include <boost/interprocess/sync/interprocess_mutex.hpp>
- #include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
- #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/interprocess/sync/shm/named_mutex.hpp>
 #endif
 
 //!\file
@@ -108,122 +105,48 @@
    void dont_close_on_destruction();
 
    #if defined(BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES)
- ipcdetail::named_semaphore_wrapper m_sem;
+ typedef ipcdetail::posix_named_mutex impl_t;
    #else
- interprocess_mutex *mutex() const
- { return static_cast<interprocess_mutex*>(m_shmem.get_user_address()); }
-
- ipcdetail::managed_open_or_create_impl<shared_memory_object> m_shmem;
- typedef ipcdetail::named_creation_functor<interprocess_mutex> construct_func_t;
+ typedef ipcdetail::shm_named_mutex impl_t;
    #endif
+ impl_t m_mut;
    /// @endcond
 };
 
 /// @cond
 
-#if defined(BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES)
-
 inline named_mutex::named_mutex(create_only_t, const char *name, const permissions &perm)
- : m_sem(ipcdetail::DoCreate, name, 1, perm)
+ : m_mut(create_only_t(), name, perm)
 {}
 
 inline named_mutex::named_mutex(open_or_create_t, const char *name, const permissions &perm)
- : m_sem(ipcdetail::DoOpenOrCreate, name, 1, perm)
+ : m_mut(open_or_create_t(), name, perm)
 {}
 
 inline named_mutex::named_mutex(open_only_t, const char *name)
- : m_sem(ipcdetail::DoOpen, name, 1, permissions())
+ : m_mut(open_only_t(), name)
 {}
 
 inline void named_mutex::dont_close_on_destruction()
-{ ipcdetail::interprocess_tester::dont_close_on_destruction(m_sem); }
+{ ipcdetail::interprocess_tester::dont_close_on_destruction(m_mut); }
 
 inline named_mutex::~named_mutex()
 {}
 
 inline void named_mutex::lock()
-{ m_sem.wait(); }
+{ m_mut.lock(); }
 
 inline void named_mutex::unlock()
-{ m_sem.post(); }
+{ m_mut.unlock(); }
 
 inline bool named_mutex::try_lock()
-{ return m_sem.try_wait(); }
+{ return m_mut.try_lock(); }
 
 inline bool named_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
-{
- if(abs_time == boost::posix_time::pos_infin){
- this->lock();
- return true;
- }
- return m_sem.timed_wait(abs_time);
-}
+{ return m_mut.timed_lock(abs_time); }
 
 inline bool named_mutex::remove(const char *name)
-{ return ipcdetail::named_semaphore_wrapper::remove(name); }
-
-#else
-
-inline void named_mutex::dont_close_on_destruction()
-{ ipcdetail::interprocess_tester::dont_close_on_destruction(m_shmem); }
-
-inline named_mutex::~named_mutex()
-{}
-
-inline named_mutex::named_mutex(create_only_t, const char *name, const permissions &perm)
- : m_shmem (create_only
- ,name
- ,sizeof(interprocess_mutex) +
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
- ,read_write
- ,0
- ,construct_func_t(ipcdetail::DoCreate)
- ,perm)
-{}
-
-inline named_mutex::named_mutex(open_or_create_t, const char *name, const permissions &perm)
- : m_shmem (open_or_create
- ,name
- ,sizeof(interprocess_mutex) +
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
- ,read_write
- ,0
- ,construct_func_t(ipcdetail::DoOpenOrCreate)
- ,perm)
-{}
-
-inline named_mutex::named_mutex(open_only_t, const char *name)
- : m_shmem (open_only
- ,name
- ,read_write
- ,0
- ,construct_func_t(ipcdetail::DoOpen))
-{}
-
-inline void named_mutex::lock()
-{ this->mutex()->lock(); }
-
-inline void named_mutex::unlock()
-{ this->mutex()->unlock(); }
-
-inline bool named_mutex::try_lock()
-{ return this->mutex()->try_lock(); }
-
-inline bool named_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
-{
- if(abs_time == boost::posix_time::pos_infin){
- this->lock();
- return true;
- }
- return this->mutex()->timed_lock(abs_time);
-}
-
-inline bool named_mutex::remove(const char *name)
-{ return shared_memory_object::remove(name); }
-
-#endif
+{ return impl_t::remove(name); }
 
 /// @endcond
 

Modified: trunk/boost/interprocess/sync/named_recursive_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/named_recursive_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/named_recursive_mutex.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,13 +18,9 @@
 #include <boost/interprocess/detail/config_begin.hpp>
 #include <boost/interprocess/detail/workaround.hpp>
 #include <boost/interprocess/creation_tags.hpp>
-#include <boost/interprocess/exceptions.hpp>
 #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
-#include <boost/interprocess/shared_memory_object.hpp>
-#include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
-#include <boost/interprocess/sync/interprocess_recursive_mutex.hpp>
-#include <boost/interprocess/sync/emulation/named_creation_functor.hpp>
 #include <boost/interprocess/permissions.hpp>
+#include <boost/interprocess/sync/shm/named_recursive_mutex.hpp>
 
 //!\file
 //!Describes a named named_recursive_mutex class for inter-process synchronization
@@ -101,11 +97,9 @@
    friend class ipcdetail::interprocess_tester;
    void dont_close_on_destruction();
 
- interprocess_recursive_mutex *mutex() const
- { return static_cast<interprocess_recursive_mutex*>(m_shmem.get_user_address()); }
+ typedef ipcdetail::shm_named_recursive_mutex impl_t;
+ impl_t m_mut;
 
- ipcdetail::managed_open_or_create_impl<shared_memory_object> m_shmem;
- typedef ipcdetail::named_creation_functor<interprocess_recursive_mutex> construct_func_t;
    /// @endcond
 };
 
@@ -115,48 +109,28 @@
 {}
 
 inline void named_recursive_mutex::dont_close_on_destruction()
-{ ipcdetail::interprocess_tester::dont_close_on_destruction(m_shmem); }
+{ ipcdetail::interprocess_tester::dont_close_on_destruction(m_mut); }
 
 inline named_recursive_mutex::named_recursive_mutex(create_only_t, const char *name, const permissions &perm)
- : m_shmem (create_only
- ,name
- ,sizeof(interprocess_recursive_mutex) +
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
- ,read_write
- ,0
- ,construct_func_t(ipcdetail::DoCreate)
- ,perm)
+ : m_mut (create_only, name, perm)
 {}
 
 inline named_recursive_mutex::named_recursive_mutex(open_or_create_t, const char *name, const permissions &perm)
- : m_shmem (open_or_create
- ,name
- ,sizeof(interprocess_recursive_mutex) +
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
- ,read_write
- ,0
- ,construct_func_t(ipcdetail::DoOpenOrCreate)
- ,perm)
+ : m_mut (open_or_create, name, perm)
 {}
 
 inline named_recursive_mutex::named_recursive_mutex(open_only_t, const char *name)
- : m_shmem (open_only
- ,name
- ,read_write
- ,0
- ,construct_func_t(ipcdetail::DoOpen))
+ : m_mut (open_only, name)
 {}
 
 inline void named_recursive_mutex::lock()
-{ this->mutex()->lock(); }
+{ m_mut.lock(); }
 
 inline void named_recursive_mutex::unlock()
-{ this->mutex()->unlock(); }
+{ m_mut.unlock(); }
 
 inline bool named_recursive_mutex::try_lock()
-{ return this->mutex()->try_lock(); }
+{ return m_mut.try_lock(); }
 
 inline bool named_recursive_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
 {
@@ -164,11 +138,11 @@
       this->lock();
       return true;
    }
- return this->mutex()->timed_lock(abs_time);
+ return m_mut.timed_lock(abs_time);
 }
 
 inline bool named_recursive_mutex::remove(const char *name)
-{ return shared_memory_object::remove(name); }
+{ return impl_t::remove(name); }
 
 /// @endcond
 

Modified: trunk/boost/interprocess/sync/named_semaphore.hpp
==============================================================================
--- trunk/boost/interprocess/sync/named_semaphore.hpp (original)
+++ trunk/boost/interprocess/sync/named_semaphore.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)
 //
@@ -24,12 +24,9 @@
 #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
 
 #if defined(BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES)
-#include <boost/interprocess/sync/posix/semaphore_wrapper.hpp>
+#include <boost/interprocess/sync/posix/named_semaphore.hpp>
 #else
-#include <boost/interprocess/shared_memory_object.hpp>
-#include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
-#include <boost/interprocess/sync/interprocess_semaphore.hpp>
-#include <boost/interprocess/sync/emulation/named_creation_functor.hpp>
+#include <boost/interprocess/sync/shm/named_semaphore.hpp>
 #endif
 
 //!\file
@@ -109,33 +106,28 @@
    void dont_close_on_destruction();
 
    #if defined(BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES)
- ipcdetail::named_semaphore_wrapper m_sem;
+ typedef ipcdetail::posix_named_semaphore impl_t;
    #else
- interprocess_semaphore *semaphore() const
- { return static_cast<interprocess_semaphore*>(m_shmem.get_user_address()); }
-
- ipcdetail::managed_open_or_create_impl<shared_memory_object> m_shmem;
- typedef ipcdetail::named_creation_functor<interprocess_semaphore, int> construct_func_t;
+ typedef ipcdetail::shm_named_semaphore impl_t;
    #endif
+ impl_t m_sem;
    /// @endcond
 };
 
 /// @cond
 
-#if defined(BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES)
-
 inline named_semaphore::named_semaphore
    (create_only_t, const char *name, unsigned int initialCount, const permissions &perm)
- : m_sem(ipcdetail::DoCreate, name, initialCount, perm)
+ : m_sem(create_only, name, initialCount, perm)
 {}
 
 inline named_semaphore::named_semaphore
    (open_or_create_t, const char *name, unsigned int initialCount, const permissions &perm)
- : m_sem(ipcdetail::DoOpenOrCreate, name, initialCount, perm)
+ : m_sem(open_or_create, name, initialCount, perm)
 {}
 
 inline named_semaphore::named_semaphore(open_only_t, const char *name)
- : m_sem(ipcdetail::DoOpen, name, 1, permissions())
+ : m_sem(open_only, name)
 {}
 
 inline named_semaphore::~named_semaphore()
@@ -163,73 +155,7 @@
 }
 
 inline bool named_semaphore::remove(const char *name)
-{ return ipcdetail::named_semaphore_wrapper::remove(name); }
-
-#else
-
-inline named_semaphore::~named_semaphore()
-{}
-
-inline void named_semaphore::dont_close_on_destruction()
-{ ipcdetail::interprocess_tester::dont_close_on_destruction(m_shmem); }
-
-inline named_semaphore::named_semaphore
- (create_only_t, const char *name, unsigned int initialCount, const permissions &perm)
- : m_shmem (create_only
- ,name
- ,sizeof(interprocess_semaphore) +
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
- ,read_write
- ,0
- ,construct_func_t(ipcdetail::DoCreate, initialCount)
- ,perm)
-{}
-
-inline named_semaphore::named_semaphore
- (open_or_create_t, const char *name, unsigned int initialCount, const permissions &perm)
- : m_shmem (open_or_create
- ,name
- ,sizeof(interprocess_semaphore) +
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
- ,read_write
- ,0
- ,construct_func_t(ipcdetail::DoOpenOrCreate, initialCount)
- ,perm)
-{}
-
-inline named_semaphore::named_semaphore
- (open_only_t, const char *name)
- : m_shmem (open_only
- ,name
- ,read_write
- ,0
- ,construct_func_t(ipcdetail::DoOpen, 0))
-{}
-
-inline void named_semaphore::post()
-{ semaphore()->post(); }
-
-inline void named_semaphore::wait()
-{ semaphore()->wait(); }
-
-inline bool named_semaphore::try_wait()
-{ return semaphore()->try_wait(); }
-
-inline bool named_semaphore::timed_wait(const boost::posix_time::ptime &abs_time)
-{
- if(abs_time == boost::posix_time::pos_infin){
- this->wait();
- return true;
- }
- return semaphore()->timed_wait(abs_time);
-}
-
-inline bool named_semaphore::remove(const char *name)
-{ return shared_memory_object::remove(name); }
-
-#endif
+{ return impl_t::remove(name); }
 
 /// @endcond
 

Modified: trunk/boost/interprocess/sync/named_upgradable_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/named_upgradable_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/named_upgradable_mutex.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,7 +23,7 @@
 #include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
 #include <boost/interprocess/sync/interprocess_upgradable_mutex.hpp>
 #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
-#include <boost/interprocess/sync/emulation/named_creation_functor.hpp>
+#include <boost/interprocess/sync/shm/named_creation_functor.hpp>
 #include <boost/interprocess/permissions.hpp>
 
 //!\file

Modified: trunk/boost/interprocess/sync/null_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/null_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/null_mutex.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)
 //

Added: trunk/boost/interprocess/sync/posix/condition.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/posix/condition.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,191 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_POSIX_CONDITION_HPP
+#define BOOST_INTERPROCESS_POSIX_CONDITION_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+
+#include <pthread.h>
+#include <errno.h>
+#include <boost/interprocess/sync/posix/pthread_helpers.hpp>
+#include <boost/interprocess/sync/posix/ptime_to_timespec.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/interprocess/sync/posix/mutex.hpp>
+#include <boost/assert.hpp>
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+class posix_condition
+{
+ //Non-copyable
+ posix_condition(const posix_condition &);
+ posix_condition &operator=(const posix_condition &);
+
+ public:
+ //!Constructs a posix_condition. On error throws interprocess_exception.
+ posix_condition();
+
+ //!Destroys *this
+ //!liberating system resources.
+ ~posix_condition();
+
+ //!If there is a thread waiting on *this, change that
+ //!thread's state to ready. Otherwise there is no effect.
+ void notify_one();
+
+ //!Change the state of all threads waiting on *this to ready.
+ //!If there are no waiting threads, notify_all() has no effect.
+ void notify_all();
+
+ //!Releases the lock on the posix_mutex object associated with lock, blocks
+ //!the current thread of execution until readied by a call to
+ //!this->notify_one() or this->notify_all(), and then reacquires the lock.
+ template <typename L>
+ void wait(L& lock)
+ {
+ if (!lock)
+ throw lock_exception();
+ this->do_wait(*lock.mutex());
+ }
+
+ //!The same as:
+ //!while (!pred()) wait(lock)
+ template <typename L, typename Pr>
+ void wait(L& lock, Pr pred)
+ {
+ if (!lock)
+ throw lock_exception();
+
+ while (!pred())
+ this->do_wait(*lock.mutex());
+ }
+
+ //!Releases the lock on the posix_mutex object associated with lock, blocks
+ //!the current thread of execution until readied by a call to
+ //!this->notify_one() or this->notify_all(), or until time abs_time is reached,
+ //!and then reacquires the lock.
+ //!Returns: false if time abs_time is reached, otherwise true.
+ template <typename L>
+ bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time)
+ {
+ if(abs_time == boost::posix_time::pos_infin){
+ this->wait(lock);
+ return true;
+ }
+ if (!lock)
+ throw lock_exception();
+ return this->do_timed_wait(abs_time, *lock.mutex());
+ }
+
+ //!The same as: while (!pred()) {
+ //! if (!timed_wait(lock, abs_time)) return pred();
+ //! } return true;
+ template <typename L, typename Pr>
+ bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred)
+ {
+ if(abs_time == boost::posix_time::pos_infin){
+ this->wait(lock, pred);
+ return true;
+ }
+ if (!lock)
+ throw lock_exception();
+ while (!pred()){
+ if (!this->do_timed_wait(abs_time, *lock.mutex()))
+ return pred();
+ }
+
+ return true;
+ }
+
+
+ void do_wait(posix_mutex &mut);
+
+ bool do_timed_wait(const boost::posix_time::ptime &abs_time, posix_mutex &mut);
+
+ private:
+ pthread_cond_t m_condition;
+};
+
+inline posix_condition::posix_condition()
+{
+ int res;
+ pthread_condattr_t cond_attr;
+ res = pthread_condattr_init(&cond_attr);
+ if(res != 0){
+ throw interprocess_exception("pthread_condattr_init failed");
+ }
+ res = pthread_condattr_setpshared(&cond_attr, PTHREAD_PROCESS_SHARED);
+ if(res != 0){
+ pthread_condattr_destroy(&cond_attr);
+ throw interprocess_exception(res);
+ }
+ res = pthread_cond_init(&m_condition, &cond_attr);
+ pthread_condattr_destroy(&cond_attr);
+ if(res != 0){
+ throw interprocess_exception(res);
+ }
+}
+
+inline posix_condition::~posix_condition()
+{
+ int res = 0;
+ res = pthread_cond_destroy(&m_condition);
+ BOOST_ASSERT(res == 0);
+}
+
+inline void posix_condition::notify_one()
+{
+ int res = 0;
+ res = pthread_cond_signal(&m_condition);
+ BOOST_ASSERT(res == 0);
+}
+
+inline void posix_condition::notify_all()
+{
+ int res = 0;
+ res = pthread_cond_broadcast(&m_condition);
+ BOOST_ASSERT(res == 0);
+}
+
+inline void posix_condition::do_wait(posix_mutex &mut)
+{
+ pthread_mutex_t* pmutex = &mut.m_mut;
+ int res = 0;
+ res = pthread_cond_wait(&m_condition, pmutex);
+ BOOST_ASSERT(res == 0);
+}
+
+inline bool posix_condition::do_timed_wait
+ (const boost::posix_time::ptime &abs_time, posix_mutex &mut)
+{
+ timespec ts = ptime_to_timespec(abs_time);
+ pthread_mutex_t* pmutex = &mut.m_mut;
+ int res = 0;
+ res = pthread_cond_timedwait(&m_condition, pmutex, &ts);
+ BOOST_ASSERT(res == 0 || res == ETIMEDOUT);
+
+ return res != ETIMEDOUT;
+}
+
+} //namespace ipcdetail
+} //namespace interprocess
+} //namespace boost
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //#ifndef BOOST_INTERPROCESS_POSIX_CONDITION_HPP

Deleted: trunk/boost/interprocess/sync/posix/interprocess_barrier.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/interprocess_barrier.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
+++ (empty file)
@@ -1,45 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (C) Copyright Ion Gaztanaga 2006. 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/interprocess for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include<boost/interprocess/exceptions.hpp>
-#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
-#include <boost/assert.hpp>
-
-namespace boost {
-namespace interprocess {
-
-inline barrier::barrier(unsigned int count)
-{
- if (count == 0)
- throw std::invalid_argument("count cannot be zero.");
- ipcdetail::barrierattr_wrapper barrier_attr;
- ipcdetail::barrier_initializer barrier
- (m_barrier, barrier_attr, static_cast<int>(count));
- barrier.release();
-}
-
-inline barrier::~barrier()
-{
- int res = pthread_barrier_destroy(&m_barrier);
- BOOST_ASSERT(res == 0);(void)res;
-}
-
-inline bool barrier::wait()
-{
- int res = pthread_barrier_wait(&m_barrier);
-
- if (res != PTHREAD_BARRIER_SERIAL_THREAD && res != 0){
- throw interprocess_exception(res);
- }
- return res == PTHREAD_BARRIER_SERIAL_THREAD;
-}
-
-} //namespace interprocess {
-} //namespace boost {

Deleted: trunk/boost/interprocess/sync/posix/interprocess_condition.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/interprocess_condition.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
+++ (empty file)
@@ -1,82 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (C) Copyright Ion Gaztanaga 2005-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)
-//
-// See http://www.boost.org/libs/interprocess for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include <boost/interprocess/sync/posix/ptime_to_timespec.hpp>
-#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
-#include <boost/assert.hpp>
-
-namespace boost {
-
-namespace interprocess {
-
-inline interprocess_condition::interprocess_condition()
-{
- int res;
- pthread_condattr_t cond_attr;
- res = pthread_condattr_init(&cond_attr);
- if(res != 0){
- throw interprocess_exception("pthread_condattr_init failed");
- }
- res = pthread_condattr_setpshared(&cond_attr, PTHREAD_PROCESS_SHARED);
- if(res != 0){
- pthread_condattr_destroy(&cond_attr);
- throw interprocess_exception(res);
- }
- res = pthread_cond_init(&m_condition, &cond_attr);
- pthread_condattr_destroy(&cond_attr);
- if(res != 0){
- throw interprocess_exception(res);
- }
-}
-
-inline interprocess_condition::~interprocess_condition()
-{
- int res = 0;
- res = pthread_cond_destroy(&m_condition);
- BOOST_ASSERT(res == 0);
-}
-
-inline void interprocess_condition::notify_one()
-{
- int res = 0;
- res = pthread_cond_signal(&m_condition);
- BOOST_ASSERT(res == 0);
-}
-
-inline void interprocess_condition::notify_all()
-{
- int res = 0;
- res = pthread_cond_broadcast(&m_condition);
- BOOST_ASSERT(res == 0);
-}
-
-inline void interprocess_condition::do_wait(interprocess_mutex &mut)
-{
- pthread_mutex_t* pmutex = &mut.m_mut;
- int res = 0;
- res = pthread_cond_wait(&m_condition, pmutex);
- BOOST_ASSERT(res == 0);
-}
-
-inline bool interprocess_condition::do_timed_wait
- (const boost::posix_time::ptime &abs_time, interprocess_mutex &mut)
-{
- timespec ts = ipcdetail::ptime_to_timespec(abs_time);
- pthread_mutex_t* pmutex = &mut.m_mut;
- int res = 0;
- res = pthread_cond_timedwait(&m_condition, pmutex, &ts);
- BOOST_ASSERT(res == 0 || res == ETIMEDOUT);
-
- return res != ETIMEDOUT;
-}
-
-} //namespace interprocess
-
-} // namespace boost

Deleted: trunk/boost/interprocess/sync/posix/interprocess_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/interprocess_mutex.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
+++ (empty file)
@@ -1,122 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (C) Copyright Ion Gaztanaga 2005-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)
-//
-// See http://www.boost.org/libs/interprocess for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-// Parts of the pthread code come from Boost Threads code:
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (C) 2001-2003
-// William E. Kempf
-//
-// Permission to use, copy, modify, distribute and sell this software
-// and its documentation for any purpose is hereby granted without fee,
-// provided that the above copyright notice appear in all copies and
-// that both that copyright notice and this permission notice appear
-// in supporting documentation. William E. Kempf makes no representations
-// about the suitability of this software for any purpose.
-// It is provided "as is" without express or implied warranty.
-//////////////////////////////////////////////////////////////////////////////
-
-#include <boost/interprocess/exceptions.hpp>
-#include <boost/interprocess/sync/posix/ptime_to_timespec.hpp>
-#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
-#include <boost/interprocess/exceptions.hpp>
-#ifndef BOOST_INTERPROCESS_POSIX_TIMEOUTS
-# include <boost/interprocess/detail/os_thread_functions.hpp>
-#endif
-#include <boost/assert.hpp>
-
-namespace boost {
-namespace interprocess {
-
-inline interprocess_mutex::interprocess_mutex()
-{
- ipcdetail::mutexattr_wrapper mut_attr;
- ipcdetail::mutex_initializer mut(m_mut, mut_attr);
- mut.release();
-}
-
-inline interprocess_mutex::~interprocess_mutex()
-{
- int res = pthread_mutex_destroy(&m_mut);
- BOOST_ASSERT(res == 0);(void)res;
-}
-
-inline void interprocess_mutex::lock()
-{
-#ifdef BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING
- boost::posix_time::ptime wait_time
- = boost::posix_time::microsec_clock::universal_time()
- + boost::posix_time::milliseconds(BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS);
- if (!timed_lock(wait_time))
- {
- throw interprocess_exception(timeout_when_locking_error, "Interprocess mutex timeout when locking. Possible deadlock: owner died without unlocking?");
- }
-#else
- if (pthread_mutex_lock(&m_mut) != 0)
- throw lock_exception();
-#endif
-}
-
-inline bool interprocess_mutex::try_lock()
-{
- int res = pthread_mutex_trylock(&m_mut);
- if (!(res == 0 || res == EBUSY))
- throw lock_exception();
- return res == 0;
-}
-
-inline bool interprocess_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
-{
- if(abs_time == boost::posix_time::pos_infin){
- this->lock();
- return true;
- }
- #ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
-
- timespec ts = ipcdetail::ptime_to_timespec(abs_time);
- int res = pthread_mutex_timedlock(&m_mut, &ts);
- if (res != 0 && res != ETIMEDOUT)
- throw lock_exception();
- return res == 0;
-
- #else //BOOST_INTERPROCESS_POSIX_TIMEOUTS
-
- //Obtain current count and target time
- boost::posix_time::ptime now = microsec_clock::universal_time();
-
- if(now >= abs_time) return false;
-
- do{
- if(this->try_lock()){
- break;
- }
- now = microsec_clock::universal_time();
-
- if(now >= abs_time){
- return false;
- }
- // relinquish current time slice
- ipcdetail::thread_yield();
- }while (true);
- return true;
-
- #endif //BOOST_INTERPROCESS_POSIX_TIMEOUTS
-}
-
-inline void interprocess_mutex::unlock()
-{
- int res = 0;
- res = pthread_mutex_unlock(&m_mut);
- BOOST_ASSERT(res == 0);
-}
-
-} //namespace interprocess {
-} //namespace boost {

Deleted: trunk/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
+++ (empty file)
@@ -1,122 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (C) Copyright Ion Gaztanaga 2005-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)
-//
-// See http://www.boost.org/libs/interprocess for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-// Parts of the pthread code come from Boost Threads code:
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (C) 2001-2003
-// William E. Kempf
-//
-// Permission to use, copy, modify, distribute and sell this software
-// and its documentation for any purpose is hereby granted without fee,
-// provided that the above copyright notice appear in all copies and
-// that both that copyright notice and this permission notice appear
-// in supporting documentation. William E. Kempf makes no representations
-// about the suitability of this software for any purpose.
-// It is provided "as is" without express or implied warranty.
-//////////////////////////////////////////////////////////////////////////////
-
-#include <boost/interprocess/sync/posix/ptime_to_timespec.hpp>
-#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
-#include <boost/interprocess/exceptions.hpp>
-#ifndef BOOST_INTERPROCESS_POSIX_TIMEOUTS
-# include <boost/interprocess/detail/os_thread_functions.hpp>
-#endif
-#include <boost/assert.hpp>
-
-namespace boost {
-
-namespace interprocess {
-
-inline interprocess_recursive_mutex::interprocess_recursive_mutex()
-{
- ipcdetail::mutexattr_wrapper mut_attr(true);
- ipcdetail::mutex_initializer mut(m_mut, mut_attr);
- mut.release();
-}
-
-inline interprocess_recursive_mutex::~interprocess_recursive_mutex()
-{
- int res = pthread_mutex_destroy(&m_mut);
- BOOST_ASSERT(res == 0);(void)res;
-}
-
-inline void interprocess_recursive_mutex::lock()
-{
-#ifdef BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING
- boost::posix_time::ptime wait_time
- = boost::posix_time::microsec_clock::universal_time()
- + boost::posix_time::milliseconds(BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS);
- if (!timed_lock(wait_time))
- {
- throw interprocess_exception(timeout_when_locking_error, "Interprocess mutex timeout when locking. Possible deadlock: owner died without unlocking?");
- }
-#else
- if (pthread_mutex_lock(&m_mut) != 0)
- throw lock_exception();
-#endif
-}
-
-inline bool interprocess_recursive_mutex::try_lock()
-{
- int res = pthread_mutex_trylock(&m_mut);
- if (!(res == 0 || res == EBUSY))
- throw lock_exception();
- return res == 0;
-}
-
-inline bool interprocess_recursive_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
-{
- if(abs_time == boost::posix_time::pos_infin){
- this->lock();
- return true;
- }
- #ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
-
- timespec ts = ipcdetail::ptime_to_timespec(abs_time);
- int res = pthread_mutex_timedlock(&m_mut, &ts);
- if (res != 0 && res != ETIMEDOUT)
- throw lock_exception();
- return res == 0;
-
- #else //BOOST_INTERPROCESS_POSIX_TIMEOUTS
-
- //Obtain current count and target time
- boost::posix_time::ptime now = microsec_clock::universal_time();
-
- if(now >= abs_time) return false;
-
- do{
- if(this->try_lock()){
- break;
- }
- now = microsec_clock::universal_time();
-
- if(now >= abs_time){
- return false;
- }
- // relinquish current time slice
- ipcdetail::thread_yield();
- }while (true);
- return true;
-
- #endif //BOOST_INTERPROCESS_POSIX_TIMEOUTS
-}
-
-inline void interprocess_recursive_mutex::unlock()
-{
- int res = 0;
- res = pthread_mutex_unlock(&m_mut);
- BOOST_ASSERT(res == 0);
-}
-
-} //namespace interprocess {
-} //namespace boost {

Deleted: trunk/boost/interprocess/sync/posix/interprocess_semaphore.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/interprocess_semaphore.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
+++ (empty file)
@@ -1,49 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (C) Copyright Ion Gaztanaga 2005-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)
-//
-// See http://www.boost.org/libs/interprocess for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include <boost/interprocess/sync/posix/ptime_to_timespec.hpp>
-#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
-
-namespace boost {
-
-namespace interprocess {
-
-inline interprocess_semaphore::~interprocess_semaphore()
-{}
-
-inline interprocess_semaphore::interprocess_semaphore(unsigned int initialCount)
- : m_sem(initialCount)
-{}
-
-inline void interprocess_semaphore::post()
-{ m_sem.post(); }
-
-inline void interprocess_semaphore::wait()
-{ m_sem.wait(); }
-
-inline bool interprocess_semaphore::try_wait()
-{ return m_sem.try_wait(); }
-
-inline bool interprocess_semaphore::timed_wait(const boost::posix_time::ptime &abs_time)
-{
- if(abs_time == boost::posix_time::pos_infin){
- this->wait();
- return true;
- }
- return m_sem.timed_wait(abs_time);
-}
-/*
-inline int interprocess_semaphore::get_count() const
-{ return m_sem.get_count(); }
-*/
-} //namespace interprocess {
-
-} //namespace boost {
-

Added: trunk/boost/interprocess/sync/posix/mutex.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/posix/mutex.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,154 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+//
+// Parts of the pthread code come from Boost Threads code:
+//
+//////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2001-2003
+// William E. Kempf
+//
+// Permission to use, copy, modify, distribute and sell this software
+// and its documentation for any purpose is hereby granted without fee,
+// provided that the above copyright notice appear in all copies and
+// that both that copyright notice and this permission notice appear
+// in supporting documentation. William E. Kempf makes no representations
+// about the suitability of this software for any purpose.
+// It is provided "as is" without express or implied warranty.
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_DETAIL_POSIX_MUTEX_HPP
+#define BOOST_INTERPROCESS_DETAIL_POSIX_MUTEX_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+
+#include <pthread.h>
+#include <errno.h>
+#include <boost/interprocess/exceptions.hpp>
+#include <boost/interprocess/sync/posix/ptime_to_timespec.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/interprocess/exceptions.hpp>
+#include <boost/interprocess/sync/posix/pthread_helpers.hpp>
+
+#ifndef BOOST_INTERPROCESS_POSIX_TIMEOUTS
+# include <boost/interprocess/detail/os_thread_functions.hpp>
+#endif
+#include <boost/assert.hpp>
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+class posix_condition;
+
+class posix_mutex
+{
+ posix_mutex(const posix_mutex &);
+ posix_mutex &operator=(const posix_mutex &);
+ public:
+
+ posix_mutex();
+ ~posix_mutex();
+
+ void lock();
+ bool try_lock();
+ bool timed_lock(const boost::posix_time::ptime &abs_time);
+ void unlock();
+
+ friend class posix_condition;
+
+ private:
+ pthread_mutex_t m_mut;
+};
+
+inline posix_mutex::posix_mutex()
+{
+ mutexattr_wrapper mut_attr;
+ mutex_initializer mut(m_mut, mut_attr);
+ mut.release();
+}
+
+inline posix_mutex::~posix_mutex()
+{
+ int res = pthread_mutex_destroy(&m_mut);
+ BOOST_ASSERT(res == 0);(void)res;
+}
+
+inline void posix_mutex::lock()
+{
+ if (pthread_mutex_lock(&m_mut) != 0)
+ throw lock_exception();
+}
+
+inline bool posix_mutex::try_lock()
+{
+ int res = pthread_mutex_trylock(&m_mut);
+ if (!(res == 0 || res == EBUSY))
+ throw lock_exception();
+ return res == 0;
+}
+
+inline bool posix_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
+{
+ if(abs_time == boost::posix_time::pos_infin){
+ this->lock();
+ return true;
+ }
+ #ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
+
+ timespec ts = ptime_to_timespec(abs_time);
+ int res = pthread_mutex_timedlock(&m_mut, &ts);
+ if (res != 0 && res != ETIMEDOUT)
+ throw lock_exception();
+ return res == 0;
+
+ #else //BOOST_INTERPROCESS_POSIX_TIMEOUTS
+
+ //Obtain current count and target time
+ boost::posix_time::ptime now = microsec_clock::universal_time();
+
+ if(now >= abs_time) return false;
+
+ do{
+ if(this->try_lock()){
+ break;
+ }
+ now = microsec_clock::universal_time();
+
+ if(now >= abs_time){
+ return false;
+ }
+ // relinquish current time slice
+ thread_yield();
+ }while (true);
+ return true;
+
+ #endif //BOOST_INTERPROCESS_POSIX_TIMEOUTS
+}
+
+inline void posix_mutex::unlock()
+{
+ int res = 0;
+ res = pthread_mutex_unlock(&m_mut);
+ BOOST_ASSERT(res == 0);
+}
+
+} //namespace ipcdetail {
+} //namespace interprocess {
+} //namespace boost {
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //#ifndef BOOST_INTERPROCESS_DETAIL_POSIX_MUTEX_HPP

Added: trunk/boost/interprocess/sync/posix/named_mutex.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/posix/named_mutex.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,116 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_POSIX_NAMED_MUTEX_HPP
+#define BOOST_INTERPROCESS_POSIX_NAMED_MUTEX_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/creation_tags.hpp>
+#include <boost/interprocess/exceptions.hpp>
+#include <boost/interprocess/detail/interprocess_tester.hpp>
+#include <boost/interprocess/permissions.hpp>
+
+#include <boost/interprocess/sync/posix/named_semaphore.hpp>
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+class named_condition;
+
+class posix_named_mutex
+{
+ /// @cond
+
+ posix_named_mutex();
+ posix_named_mutex(const posix_named_mutex &);
+ posix_named_mutex &operator=(const posix_named_mutex &);
+ friend class named_condition;
+ /// @endcond
+
+ public:
+ posix_named_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions());
+
+ posix_named_mutex(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions());
+
+ posix_named_mutex(open_only_t open_only, const char *name);
+
+ ~posix_named_mutex();
+
+ void unlock();
+ void lock();
+ bool try_lock();
+ bool timed_lock(const boost::posix_time::ptime &abs_time);
+ static bool remove(const char *name);
+
+ /// @cond
+ private:
+ friend class interprocess_tester;
+ void dont_close_on_destruction();
+
+ posix_named_semaphore m_sem;
+ /// @endcond
+};
+
+/// @cond
+
+inline posix_named_mutex::posix_named_mutex(create_only_t, const char *name, const permissions &perm)
+ : m_sem(create_only, name, 1, perm)
+{}
+
+inline posix_named_mutex::posix_named_mutex(open_or_create_t, const char *name, const permissions &perm)
+ : m_sem(open_or_create, name, 1, perm)
+{}
+
+inline posix_named_mutex::posix_named_mutex(open_only_t, const char *name)
+ : m_sem(open_only, name)
+{}
+
+inline void posix_named_mutex::dont_close_on_destruction()
+{ interprocess_tester::dont_close_on_destruction(m_sem); }
+
+inline posix_named_mutex::~posix_named_mutex()
+{}
+
+inline void posix_named_mutex::lock()
+{ m_sem.wait(); }
+
+inline void posix_named_mutex::unlock()
+{ m_sem.post(); }
+
+inline bool posix_named_mutex::try_lock()
+{ return m_sem.try_wait(); }
+
+inline bool posix_named_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
+{
+ if(abs_time == boost::posix_time::pos_infin){
+ this->lock();
+ return true;
+ }
+ return m_sem.timed_wait(abs_time);
+}
+
+inline bool posix_named_mutex::remove(const char *name)
+{ return posix_named_semaphore::remove(name); }
+
+/// @endcond
+
+} //namespace ipcdetail {
+} //namespace interprocess {
+} //namespace boost {
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //BOOST_INTERPROCESS_POSIX_NAMED_MUTEX_HPP

Added: trunk/boost/interprocess/sync/posix/named_semaphore.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/posix/named_semaphore.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,84 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_POSIX_NAMED_CONDITION_HPP
+#define BOOST_INTERPROCESS_POSIX_NAMED_CONDITION_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+
+#include <boost/interprocess/sync/posix/semaphore_wrapper.hpp>
+
+namespace boost {
+namespace interprocess {
+
+/// @cond
+namespace ipcdetail{ class interprocess_tester; }
+/// @endcond
+
+namespace ipcdetail {
+
+class posix_named_semaphore
+{
+ posix_named_semaphore();
+ posix_named_semaphore(const posix_named_semaphore&);
+ posix_named_semaphore &operator= (const posix_named_semaphore &);
+
+ public:
+ posix_named_semaphore
+ (create_only_t, const char *name, unsigned int initialCount, const permissions &perm = permissions())
+ { semaphore_open(mp_sem, DoCreate, name, initialCount, perm); }
+
+ posix_named_semaphore(open_or_create_t, const char *name, unsigned int initialCount, const permissions &perm = permissions())
+ { semaphore_open(mp_sem, DoOpenOrCreate, name, initialCount, perm); }
+
+ posix_named_semaphore(open_only_t, const char *name)
+ { semaphore_open(mp_sem, DoOpen, name); }
+
+ ~posix_named_semaphore()
+ {
+ if(mp_sem != BOOST_INTERPROCESS_POSIX_SEM_FAILED)
+ semaphore_close(mp_sem);
+ }
+
+ void post()
+ { semaphore_post(mp_sem); }
+
+ void wait()
+ { semaphore_wait(mp_sem); }
+
+ bool try_wait()
+ { return semaphore_try_wait(mp_sem); }
+
+ bool timed_wait(const boost::posix_time::ptime &abs_time)
+ { return semaphore_timed_wait(mp_sem, abs_time); }
+
+ static bool remove(const char *name)
+ { return semaphore_unlink(name); }
+
+ private:
+ friend class ipcdetail::interprocess_tester;
+ void dont_close_on_destruction()
+ { mp_sem = BOOST_INTERPROCESS_POSIX_SEM_FAILED; }
+
+ sem_t *mp_sem;
+};
+
+} //namespace ipcdetail {
+} //namespace interprocess {
+} //namespace boost {
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //#ifndef BOOST_INTERPROCESS_POSIX_NAMED_CONDITION_HPP

Modified: trunk/boost/interprocess/sync/posix/pthread_helpers.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/pthread_helpers.hpp (original)
+++ trunk/boost/interprocess/sync/posix/pthread_helpers.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/sync/posix/ptime_to_timespec.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/ptime_to_timespec.hpp (original)
+++ trunk/boost/interprocess/sync/posix/ptime_to_timespec.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)
 //

Added: trunk/boost/interprocess/sync/posix/recursive_mutex.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/posix/recursive_mutex.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,144 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+//
+// Parts of the pthread code come from Boost Threads code:
+//
+//////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2001-2003
+// William E. Kempf
+//
+// Permission to use, copy, modify, distribute and sell this software
+// and its documentation for any purpose is hereby granted without fee,
+// provided that the above copyright notice appear in all copies and
+// that both that copyright notice and this permission notice appear
+// in supporting documentation. William E. Kempf makes no representations
+// about the suitability of this software for any purpose.
+// It is provided "as is" without express or implied warranty.
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_DETAIL_POSIX_RECURSIVE_MUTEX_HPP
+#define BOOST_INTERPROCESS_DETAIL_POSIX_RECURSIVE_MUTEX_HPP
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+
+#include <pthread.h>
+#include <errno.h>
+#include <boost/interprocess/sync/posix/pthread_helpers.hpp>
+#include <boost/interprocess/sync/posix/ptime_to_timespec.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/interprocess/exceptions.hpp>
+#ifndef BOOST_INTERPROCESS_POSIX_TIMEOUTS
+# include <boost/interprocess/detail/os_thread_functions.hpp>
+#endif
+#include <boost/assert.hpp>
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+class posix_recursive_mutex
+{
+ posix_recursive_mutex(const posix_recursive_mutex &);
+ posix_recursive_mutex &operator=(const posix_recursive_mutex &);
+ public:
+
+ posix_recursive_mutex();
+ ~posix_recursive_mutex();
+
+ void lock();
+ bool try_lock();
+ bool timed_lock(const boost::posix_time::ptime &abs_time);
+ void unlock();
+
+ private:
+ pthread_mutex_t m_mut;
+};
+
+inline posix_recursive_mutex::posix_recursive_mutex()
+{
+ mutexattr_wrapper mut_attr(true);
+ mutex_initializer mut(m_mut, mut_attr);
+ mut.release();
+}
+
+inline posix_recursive_mutex::~posix_recursive_mutex()
+{
+ int res = pthread_mutex_destroy(&m_mut);
+ BOOST_ASSERT(res == 0);(void)res;
+}
+
+inline void posix_recursive_mutex::lock()
+{
+ if (pthread_mutex_lock(&m_mut) != 0)
+ throw lock_exception();
+}
+
+inline bool posix_recursive_mutex::try_lock()
+{
+ int res = pthread_mutex_trylock(&m_mut);
+ if (!(res == 0 || res == EBUSY))
+ throw lock_exception();
+ return res == 0;
+}
+
+inline bool posix_recursive_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
+{
+ if(abs_time == boost::posix_time::pos_infin){
+ this->lock();
+ return true;
+ }
+ #ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
+
+ timespec ts = ptime_to_timespec(abs_time);
+ int res = pthread_mutex_timedlock(&m_mut, &ts);
+ if (res != 0 && res != ETIMEDOUT)
+ throw lock_exception();
+ return res == 0;
+
+ #else //BOOST_INTERPROCESS_POSIX_TIMEOUTS
+
+ //Obtain current count and target time
+ boost::posix_time::ptime now = microsec_clock::universal_time();
+
+ if(now >= abs_time) return false;
+
+ do{
+ if(this->try_lock()){
+ break;
+ }
+ now = microsec_clock::universal_time();
+
+ if(now >= abs_time){
+ return false;
+ }
+ // relinquish current time slice
+ thread_yield();
+ }while (true);
+ return true;
+
+ #endif //BOOST_INTERPROCESS_POSIX_TIMEOUTS
+}
+
+inline void posix_recursive_mutex::unlock()
+{
+ int res = 0;
+ res = pthread_mutex_unlock(&m_mut);
+ BOOST_ASSERT(res == 0);
+}
+
+} //namespace ipcdetail {
+} //namespace interprocess {
+} //namespace boost {
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //#ifndef BOOST_INTERPROCESS_DETAIL_POSIX_RECURSIVE_MUTEX_HPP

Added: trunk/boost/interprocess/sync/posix/semaphore.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/posix/semaphore.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,63 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_POSIX_SEMAPHORE_HPP
+#define BOOST_INTERPROCESS_POSIX_SEMAPHORE_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/interprocess/sync/posix/semaphore_wrapper.hpp>
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+class posix_semaphore
+{
+ posix_semaphore();
+ posix_semaphore(const posix_semaphore&);
+ posix_semaphore &operator= (const posix_semaphore &);
+
+ public:
+ posix_semaphore(unsigned int initialCount)
+ { semaphore_init(&m_sem, initialCount); }
+
+ ~posix_semaphore()
+ { semaphore_destroy(&m_sem); }
+
+ void post()
+ { semaphore_post(&m_sem); }
+
+ void wait()
+ { semaphore_wait(&m_sem); }
+
+ bool try_wait()
+ { return semaphore_try_wait(&m_sem); }
+
+ bool timed_wait(const boost::posix_time::ptime &abs_time)
+ { return semaphore_timed_wait(&m_sem, abs_time); }
+
+ private:
+ sem_t m_sem;
+};
+
+} //namespace ipcdetail {
+} //namespace interprocess {
+} //namespace boost {
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //#ifndef BOOST_INTERPROCESS_POSIX_SEMAPHORE_HPP

Modified: trunk/boost/interprocess/sync/posix/semaphore_wrapper.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/semaphore_wrapper.hpp (original)
+++ trunk/boost/interprocess/sync/posix/semaphore_wrapper.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)
 //
@@ -17,8 +17,12 @@
 #include <boost/interprocess/detail/os_file_functions.hpp>
 #include <boost/interprocess/detail/tmp_dir_helpers.hpp>
 #include <boost/interprocess/permissions.hpp>
-#include <string>
-#include <semaphore.h>
+
+#include <fcntl.h> //O_CREAT, O_*...
+#include <unistd.h> //close
+#include <string> //std::string
+#include <semaphore.h> //sem_* family, SEM_VALUE_MAX
+#include <sys/stat.h> //mode_t, S_IRWXG, S_IRWXO, S_IRWXU,
 #include <boost/assert.hpp>
 
 #ifdef SEM_FAILED
@@ -35,49 +39,59 @@
 
 namespace boost {
 namespace interprocess {
-
-/// @cond
-namespace ipcdetail{ class interprocess_tester; }
-/// @endcond
-
 namespace ipcdetail {
 
 inline bool semaphore_open
- (sem_t *&handle, ipcdetail::create_enum_t type, const char *origname,
- unsigned int count, const permissions &perm = permissions())
+ (sem_t *&handle, create_enum_t type, const char *origname,
+ unsigned int count = 0, const permissions &perm = permissions())
 {
    std::string name;
    #ifndef BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES
- ipcdetail::add_leading_slash(origname, name);
+ add_leading_slash(origname, name);
    #else
- ipcdetail::create_tmp_and_clean_old_and_get_filename(origname, name);
+ create_tmp_and_clean_old_and_get_filename(origname, name);
    #endif
 
    //Create new mapping
    int oflag = 0;
    switch(type){
- case ipcdetail::DoOpen:
+ case DoOpen:
+ {
          //No addition
+ handle = ::sem_open(name.c_str(), oflag);
+ }
       break;
- case ipcdetail::DoCreate:
- oflag |= (O_CREAT | O_EXCL);
- break;
- case ipcdetail::DoOpenOrCreate:
- oflag |= O_CREAT;
+ case DoOpenOrCreate:
+ case DoCreate:
+ {
+ while(1){
+ oflag = (O_CREAT | O_EXCL);
+ handle = ::sem_open(name.c_str(), oflag, perm.get_permissions(), count);
+ if(handle != BOOST_INTERPROCESS_POSIX_SEM_FAILED){
+ //We can't change semaphore permissions!
+ //::fchmod(handle, perm.get_permissions());
+ break;
+ }
+ else if(errno == EEXIST && type == DoOpenOrCreate){
+ oflag = 0;
+ if( (handle = ::sem_open(name.c_str(), oflag)) != BOOST_INTERPROCESS_POSIX_SEM_FAILED
+ || (errno != ENOENT) ){
+ break;
+ }
+ }
+ else{
+ break;
+ }
+ }
+ }
       break;
       default:
- {
- error_info err = other_error;
- throw interprocess_exception(err);
- }
+ {
+ error_info err(other_error);
+ throw interprocess_exception(err);
+ }
    }
 
- //Open file using POSIX API
- if(oflag & O_CREAT)
- handle = sem_open(name.c_str(), oflag, perm.get_permissions(), count);
- else
- handle = sem_open(name.c_str(), oflag);
-
    //Check for error
    if(handle == BOOST_INTERPROCESS_POSIX_SEM_FAILED){
       throw interprocess_exception(error_info(errno));
@@ -99,9 +113,9 @@
    try{
       std::string sem_str;
       #ifndef BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES
- ipcdetail::add_leading_slash(semname, sem_str);
+ add_leading_slash(semname, sem_str);
       #else
- ipcdetail::tmp_filename(semname, sem_str);
+ tmp_filename(semname, sem_str);
       #endif
       return 0 == sem_unlink(sem_str.c_str());
    }
@@ -159,8 +173,12 @@
 
 inline bool semaphore_timed_wait(sem_t *handle, const boost::posix_time::ptime &abs_time)
 {
+ if(abs_time == boost::posix_time::pos_infin){
+ semaphore_wait(handle);
+ return true;
+ }
    #ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
- timespec tspec = ipcdetail::ptime_to_timespec(abs_time);
+ timespec tspec = ptime_to_timespec(abs_time);
    for (;;){
       int res = sem_timedwait(handle, &tspec);
       if(res == 0)
@@ -186,80 +204,8 @@
    #endif //#ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
 }
 
-
-class named_semaphore_wrapper
-{
- named_semaphore_wrapper();
- named_semaphore_wrapper(const named_semaphore_wrapper&);
- named_semaphore_wrapper &operator= (const named_semaphore_wrapper &);
-
- public:
- named_semaphore_wrapper
- (ipcdetail::create_enum_t type, const char *name, unsigned int count, const permissions &perm = permissions())
- { semaphore_open(mp_sem, type, name, count, perm); }
-
- ~named_semaphore_wrapper()
- {
- if(mp_sem != BOOST_INTERPROCESS_POSIX_SEM_FAILED)
- semaphore_close(mp_sem);
- }
-
- void post()
- { semaphore_post(mp_sem); }
-
- void wait()
- { semaphore_wait(mp_sem); }
-
- bool try_wait()
- { return semaphore_try_wait(mp_sem); }
-
- bool timed_wait(const boost::posix_time::ptime &abs_time)
- { return semaphore_timed_wait(mp_sem, abs_time); }
-
- static bool remove(const char *name)
- { return semaphore_unlink(name); }
-
- private:
- friend class ipcdetail::interprocess_tester;
- void dont_close_on_destruction()
- { mp_sem = BOOST_INTERPROCESS_POSIX_SEM_FAILED; }
-
- sem_t *mp_sem;
-};
-
-class semaphore_wrapper
-{
- semaphore_wrapper();
- semaphore_wrapper(const semaphore_wrapper&);
- semaphore_wrapper &operator= (const semaphore_wrapper &);
-
- public:
- semaphore_wrapper(unsigned int initialCount)
- { semaphore_init(&m_sem, initialCount); }
-
- ~semaphore_wrapper()
- { semaphore_destroy(&m_sem); }
-
- void post()
- { semaphore_post(&m_sem); }
-
- void wait()
- { semaphore_wait(&m_sem); }
-
- bool try_wait()
- { return semaphore_try_wait(&m_sem); }
-
- bool timed_wait(const boost::posix_time::ptime &abs_time)
- { return semaphore_timed_wait(&m_sem, abs_time); }
-
- private:
- sem_t m_sem;
-};
-
 } //namespace ipcdetail {
 } //namespace interprocess {
 } //namespace boost {
 
-#undef BOOST_INTERPROCESS_POSIX_SEM_FAILED
-
 #endif //#ifndef BOOST_INTERPROCESS_POSIX_SEMAPHORE_WRAPPER_HPP

Modified: trunk/boost/interprocess/sync/scoped_lock.hpp
==============================================================================
--- trunk/boost/interprocess/sync/scoped_lock.hpp (original)
+++ trunk/boost/interprocess/sync/scoped_lock.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,7 +27,7 @@
 #include <boost/interprocess/exceptions.hpp>
 #include <boost/interprocess/detail/mpl.hpp>
 #include <boost/interprocess/detail/type_traits.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
 
 //!\file
@@ -120,7 +120,7 @@
    //! to thisscoped_lock with no blocking. If the scop scoped_lock does not
    //! own the mutex, then neither will this scoped_lock. Only a moved
    //! scoped_lock's will match this signature. An non-moved scoped_lock
- //! can be moved with the expression: "boost::interprocess::move(lock);". This
+ //! can be moved with the expression: "boost::move(lock);". This
    //! constructor does not alter the state of the mutex, only potentially
    //! who owns it.
    scoped_lock(BOOST_RV_REF(scoped_lock) scop)
@@ -136,7 +136,7 @@
    //! unlocking upgr. If upgr is unlocked, then this scoped_lock will be
    //! unlocked as well. Only a moved upgradable_lock's will match this
    //! signature. An non-moved upgradable_lock can be moved with
- //! the expression: "boost::interprocess::move(lock);" This constructor may block if
+ //! the expression: "boost::move(lock);" This constructor may block if
    //! other threads hold a sharable_lock on this mutex (sharable_lock's can
    //! share ownership with an upgradable_lock).
    template<class T>

Modified: trunk/boost/interprocess/sync/sharable_lock.hpp
==============================================================================
--- trunk/boost/interprocess/sync/sharable_lock.hpp (original)
+++ trunk/boost/interprocess/sync/sharable_lock.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,7 +27,7 @@
 #include <boost/interprocess/exceptions.hpp>
 #include <boost/interprocess/detail/mpl.hpp>
 #include <boost/interprocess/detail/type_traits.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
 
 //!\file
@@ -122,7 +122,7 @@
    //! sharable_lock with no blocking. If the upgr sharable_lock does not own the mutex, then
    //! neither will this sharable_lock. Only a moved sharable_lock's will match this
    //! signature. An non-moved sharable_lock can be moved with the expression:
- //! "boost::interprocess::move(lock);". This constructor does not alter the state of the mutex,
+ //! "boost::move(lock);". This constructor does not alter the state of the mutex,
    //! only potentially who owns it.
    sharable_lock(BOOST_RV_REF(sharable_lock<mutex_type>) upgr)
       : mp_mutex(0), m_locked(upgr.owns())
@@ -136,7 +136,7 @@
    //!Notes: If upgr is locked, this constructor will lock this sharable_lock while
    //! unlocking upgr. Only a moved sharable_lock's will match this
    //! signature. An non-moved upgradable_lock can be moved with the expression:
- //! "boost::interprocess::move(lock);".*/
+ //! "boost::move(lock);".*/
    template<class T>
    sharable_lock(BOOST_RV_REF(upgradable_lock<T>) upgr
       , typename ipcdetail::enable_if< ipcdetail::is_same<T, SharableMutex> >::type * = 0)
@@ -159,7 +159,7 @@
    //! to a sharable-ownership of this sharable_lock.
    //! Only a moved scoped_lock's will match this
    //! signature. An non-moved scoped_lock can be moved with the expression:
- //! "boost::interprocess::move(lock);".
+ //! "boost::move(lock);".
    template<class T>
    sharable_lock(BOOST_RV_REF(scoped_lock<T>) scop
                , typename ipcdetail::enable_if< ipcdetail::is_same<T, SharableMutex> >::type * = 0)

Added: trunk/boost/interprocess/sync/shm/named_condition.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/shm/named_condition.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,341 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_SHM_NAMED_CONDITION_HPP
+#define BOOST_INTERPROCESS_SHM_NAMED_CONDITION_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/interprocess/detail/type_traits.hpp>
+#include <boost/interprocess/creation_tags.hpp>
+#include <boost/interprocess/exceptions.hpp>
+#include <boost/interprocess/shared_memory_object.hpp>
+#include <boost/interprocess/sync/interprocess_condition.hpp>
+#include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/interprocess/sync/shm/named_creation_functor.hpp>
+#include <boost/interprocess/sync/named_mutex.hpp>
+#include <boost/interprocess/permissions.hpp>
+#if defined BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES
+#include <boost/interprocess/sync/interprocess_mutex.hpp>
+#include <boost/interprocess/sync/scoped_lock.hpp>
+#endif
+
+
+//!\file
+//!Describes process-shared variables interprocess_condition class
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+/// @cond
+namespace ipcdetail{ class interprocess_tester; }
+/// @endcond
+
+//! A global condition variable that can be created by name.
+//! This condition variable is designed to work with named_mutex and
+//! can't be placed in shared memory or memory mapped files.
+class shm_named_condition
+{
+ /// @cond
+ //Non-copyable
+ shm_named_condition();
+ shm_named_condition(const shm_named_condition &);
+ shm_named_condition &operator=(const shm_named_condition &);
+ /// @endcond
+ public:
+ //!Creates a global condition with a name.
+ //!If the condition can't be created throws interprocess_exception
+ shm_named_condition(create_only_t create_only, const char *name, const permissions &perm = permissions());
+
+ //!Opens or creates a global condition with a name.
+ //!If the condition is created, this call is equivalent to
+ //!shm_named_condition(create_only_t, ... )
+ //!If the condition is already created, this call is equivalent
+ //!shm_named_condition(open_only_t, ... )
+ //!Does not throw
+ shm_named_condition(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions());
+
+ //!Opens a global condition with a name if that condition is previously
+ //!created. If it is not previously created this function throws
+ //!interprocess_exception.
+ shm_named_condition(open_only_t open_only, const char *name);
+
+ //!Destroys *this and indicates that the calling process is finished using
+ //!the resource. The destructor function will deallocate
+ //!any system resources allocated by the system for use by this process for
+ //!this resource. The resource can still be opened again calling
+ //!the open constructor overload. To erase the resource from the system
+ //!use remove().
+ ~shm_named_condition();
+
+ //!If there is a thread waiting on *this, change that
+ //!thread's state to ready. Otherwise there is no effect.*/
+ void notify_one();
+
+ //!Change the state of all threads waiting on *this to ready.
+ //!If there are no waiting threads, notify_all() has no effect.
+ void notify_all();
+
+ //!Releases the lock on the named_mutex object associated with lock, blocks
+ //!the current thread of execution until readied by a call to
+ //!this->notify_one() or this->notify_all(), and then reacquires the lock.
+ template <typename L>
+ void wait(L& lock);
+
+ //!The same as:
+ //!while (!pred()) wait(lock)
+ template <typename L, typename Pr>
+ void wait(L& lock, Pr pred);
+
+ //!Releases the lock on the named_mutex object associated with lock, blocks
+ //!the current thread of execution until readied by a call to
+ //!this->notify_one() or this->notify_all(), or until time abs_time is reached,
+ //!and then reacquires the lock.
+ //!Returns: false if time abs_time is reached, otherwise true.
+ template <typename L>
+ bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time);
+
+ //!The same as: while (!pred()) {
+ //! if (!timed_wait(lock, abs_time)) return pred();
+ //! } return true;
+ template <typename L, typename Pr>
+ bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred);
+
+ //!Erases a named condition from the system.
+ //!Returns false on error. Never throws.
+ static bool remove(const char *name);
+
+ /// @cond
+ private:
+
+ struct condition_holder
+ {
+ interprocess_condition cond_;
+ //If named_mutex is implemented using semaphores
+ //we need to store an additional mutex
+ #if defined (BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES)
+ interprocess_mutex mutex_;
+ #endif
+ };
+
+ interprocess_condition *condition() const
+ { return &static_cast<condition_holder*>(m_shmem.get_user_address())->cond_; }
+
+ template <class Lock>
+ class lock_inverter
+ {
+ Lock &l_;
+ public:
+ lock_inverter(Lock &l)
+ : l_(l)
+ {}
+ void lock() { l_.unlock(); }
+ void unlock() { l_.lock(); }
+ };
+
+ #if defined (BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES)
+ interprocess_mutex *mutex() const
+ { return &static_cast<condition_holder*>(m_shmem.get_user_address())->mutex_; }
+
+ template <class Lock>
+ void do_wait(Lock& lock)
+ {
+ //shm_named_condition only works with named_mutex
+ BOOST_STATIC_ASSERT((is_convertible<typename Lock::mutex_type&, named_mutex&>::value == true));
+
+ //lock internal before unlocking external to avoid race with a notifier
+ scoped_lock<interprocess_mutex> internal_lock(*this->mutex());
+ lock_inverter<Lock> inverted_lock(lock);
+ scoped_lock<lock_inverter<Lock> > external_unlock(inverted_lock);
+
+ //unlock internal first to avoid deadlock with near simultaneous waits
+ scoped_lock<interprocess_mutex> internal_unlock;
+ internal_lock.swap(internal_unlock);
+ this->condition()->wait(internal_unlock);
+ }
+
+ template <class Lock>
+ bool do_timed_wait(Lock& lock, const boost::posix_time::ptime &abs_time)
+ {
+ //shm_named_condition only works with named_mutex
+ BOOST_STATIC_ASSERT((is_convertible<typename Lock::mutex_type&, named_mutex&>::value == true));
+ //lock internal before unlocking external to avoid race with a notifier
+ scoped_lock<interprocess_mutex> internal_lock(*this->mutex(), abs_time);
+ if(!internal_lock) return false;
+ lock_inverter<Lock> inverted_lock(lock);
+ scoped_lock<lock_inverter<Lock> > external_unlock(inverted_lock);
+
+ //unlock internal first to avoid deadlock with near simultaneous waits
+ scoped_lock<interprocess_mutex> internal_unlock;
+ internal_lock.swap(internal_unlock);
+ return this->condition()->timed_wait(internal_unlock, abs_time);
+ }
+ #endif
+
+ friend class boost::interprocess::ipcdetail::interprocess_tester;
+ void dont_close_on_destruction();
+
+ managed_open_or_create_impl<shared_memory_object> m_shmem;
+
+ template <class T, class Arg> friend class boost::interprocess::ipcdetail::named_creation_functor;
+ typedef boost::interprocess::ipcdetail::named_creation_functor<condition_holder> construct_func_t;
+ /// @endcond
+};
+
+/// @cond
+
+inline shm_named_condition::~shm_named_condition()
+{}
+
+inline shm_named_condition::shm_named_condition(create_only_t, const char *name, const permissions &perm)
+ : m_shmem (create_only
+ ,name
+ ,sizeof(condition_holder) +
+ managed_open_or_create_impl<shared_memory_object>::
+ ManagedOpenOrCreateUserOffset
+ ,read_write
+ ,0
+ ,construct_func_t(DoCreate)
+ ,perm)
+{}
+
+inline shm_named_condition::shm_named_condition(open_or_create_t, const char *name, const permissions &perm)
+ : m_shmem (open_or_create
+ ,name
+ ,sizeof(condition_holder) +
+ managed_open_or_create_impl<shared_memory_object>::
+ ManagedOpenOrCreateUserOffset
+ ,read_write
+ ,0
+ ,construct_func_t(DoOpenOrCreate)
+ ,perm)
+{}
+
+inline shm_named_condition::shm_named_condition(open_only_t, const char *name)
+ : m_shmem (open_only
+ ,name
+ ,read_write
+ ,0
+ ,construct_func_t(DoOpen))
+{}
+
+inline void shm_named_condition::dont_close_on_destruction()
+{ interprocess_tester::dont_close_on_destruction(m_shmem); }
+
+#if defined(BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES)
+
+inline void shm_named_condition::notify_one()
+{
+ scoped_lock<interprocess_mutex> internal_lock(*this->mutex());
+ this->condition()->notify_one();
+}
+
+inline void shm_named_condition::notify_all()
+{
+ scoped_lock<interprocess_mutex> internal_lock(*this->mutex());
+ this->condition()->notify_all();
+}
+
+template <typename L>
+inline void shm_named_condition::wait(L& lock)
+{
+ if (!lock)
+ throw lock_exception();
+ this->do_wait(lock);
+}
+
+template <typename L, typename Pr>
+inline void shm_named_condition::wait(L& lock, Pr pred)
+{
+ if (!lock)
+ throw lock_exception();
+ while (!pred())
+ this->do_wait(lock);
+}
+
+template <typename L>
+inline bool shm_named_condition::timed_wait
+ (L& lock, const boost::posix_time::ptime &abs_time)
+{
+ if(abs_time == boost::posix_time::pos_infin){
+ this->wait(lock);
+ return true;
+ }
+ if (!lock)
+ throw lock_exception();
+ return this->do_timed_wait(lock, abs_time);
+}
+
+template <typename L, typename Pr>
+inline bool shm_named_condition::timed_wait
+ (L& lock, const boost::posix_time::ptime &abs_time, Pr pred)
+{
+ if(abs_time == boost::posix_time::pos_infin){
+ this->wait(lock, pred);
+ return true;
+ }
+ if (!lock)
+ throw lock_exception();
+
+ while (!pred()){
+ if(!this->do_timed_wait(lock, abs_time)){
+ return pred();
+ }
+ }
+ return true;
+}
+
+#else
+
+inline void shm_named_condition::notify_one()
+{ this->condition()->notify_one(); }
+
+inline void shm_named_condition::notify_all()
+{ this->condition()->notify_all(); }
+
+template <typename L>
+inline void shm_named_condition::wait(L& lock)
+{ this->condition()->wait(lock); }
+
+template <typename L, typename Pr>
+inline void shm_named_condition::wait(L& lock, Pr pred)
+{ this->condition()->wait(lock, pred); }
+
+template <typename L>
+inline bool shm_named_condition::timed_wait
+ (L& lock, const boost::posix_time::ptime &abs_time)
+{ return this->condition()->timed_wait(lock, abs_time); }
+
+template <typename L, typename Pr>
+inline bool shm_named_condition::timed_wait
+ (L& lock, const boost::posix_time::ptime &abs_time, Pr pred)
+{ return this->condition()->timed_wait(lock, abs_time, pred); }
+
+#endif
+
+inline bool shm_named_condition::remove(const char *name)
+{ return shared_memory_object::remove(name); }
+
+/// @endcond
+
+} //namespace ipcdetail
+} //namespace interprocess
+} //namespace boost
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif // BOOST_INTERPROCESS_SHM_NAMED_CONDITION_HPP

Added: trunk/boost/interprocess/sync/shm/named_creation_functor.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/shm/named_creation_functor.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,68 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_SYNC_NAMED_CREATION_FUNCTOR_HPP
+#define BOOST_INTERPROCESS_SYNC_NAMED_CREATION_FUNCTOR_HPP
+
+#include <boost/interprocess/creation_tags.hpp>
+#include <boost/interprocess/detail/type_traits.hpp>
+#include <boost/interprocess/detail/mpl.hpp>
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+struct named_creation_functor_no_arg{};
+
+template <class T, class Arg = named_creation_functor_no_arg>
+class named_creation_functor
+{
+ typedef named_creation_functor_no_arg no_arg_t;
+ public:
+ named_creation_functor(create_enum_t type, Arg arg = Arg())
+ : m_creation_type(type), m_arg(arg){}
+
+ template<class ArgType>
+ void construct(void *address, typename enable_if_c<is_same<ArgType, no_arg_t>::value>::type * = 0) const
+ { new(address)T; }
+
+ template<class ArgType>
+ void construct(void *address, typename enable_if_c<!is_same<ArgType, no_arg_t>::value>::type * = 0) const
+ { new(address)T(m_arg); }
+
+ bool operator()(void *address, std::size_t, bool created) const
+ {
+ switch(m_creation_type){
+ case DoOpen:
+ return true;
+ break;
+ case DoCreate:
+ case DoOpenOrCreate:
+ if(created){
+ construct<Arg>(address);
+ }
+ return true;
+ break;
+
+ default:
+ return false;
+ break;
+ }
+ }
+ private:
+ create_enum_t m_creation_type;
+ Arg m_arg;
+};
+
+} //namespace ipcdetail {
+} //namespace interprocess {
+} //namespace boost {
+
+#endif //BOOST_INTERPROCESS_SYNC_NAMED_CREATION_FUNCTOR_HPP

Added: trunk/boost/interprocess/sync/shm/named_mutex.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/shm/named_mutex.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,184 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_SHM_NAMED_MUTEX_HPP
+#define BOOST_INTERPROCESS_SHM_NAMED_MUTEX_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/creation_tags.hpp>
+#include <boost/interprocess/exceptions.hpp>
+#include <boost/interprocess/detail/interprocess_tester.hpp>
+#include <boost/interprocess/permissions.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+
+#include <boost/interprocess/shared_memory_object.hpp>
+#include <boost/interprocess/sync/interprocess_mutex.hpp>
+#include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
+#include <boost/interprocess/sync/shm/named_creation_functor.hpp>
+
+//!\file
+//!Describes a named mutex class for inter-process synchronization
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+class named_condition;
+
+//!A mutex with a global name, so it can be found from different
+//!processes. This mutex can't be placed in shared memory, and
+//!each process should have it's own named mutex.
+class shm_named_mutex
+{
+ /// @cond
+
+ //Non-copyable
+ shm_named_mutex();
+ shm_named_mutex(const shm_named_mutex &);
+ shm_named_mutex &operator=(const shm_named_mutex &);
+ friend class named_condition;
+ /// @endcond
+
+ public:
+ //!Creates a global interprocess_mutex with a name.
+ //!Throws interprocess_exception on error.
+ shm_named_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions());
+
+ //!Opens or creates a global mutex with a name.
+ //!If the mutex is created, this call is equivalent to
+ //!shm_named_mutex(create_only_t, ... )
+ //!If the mutex is already created, this call is equivalent
+ //!shm_named_mutex(open_only_t, ... )
+ //!Does not throw
+ shm_named_mutex(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions());
+
+ //!Opens a global mutex with a name if that mutex is previously
+ //!created. If it is not previously created this function throws
+ //!interprocess_exception.
+ shm_named_mutex(open_only_t open_only, const char *name);
+
+ //!Destroys *this and indicates that the calling process is finished using
+ //!the resource. The destructor function will deallocate
+ //!any system resources allocated by the system for use by this process for
+ //!this resource. The resource can still be opened again calling
+ //!the open constructor overload. To erase the resource from the system
+ //!use remove().
+ ~shm_named_mutex();
+
+ //!Unlocks a previously locked
+ //!interprocess_mutex.
+ void unlock();
+
+ //!Locks interprocess_mutex, sleeps when interprocess_mutex is already locked.
+ //!Throws interprocess_exception if a severe error is found
+ void lock();
+
+ //!Tries to lock the interprocess_mutex, returns false when interprocess_mutex
+ //!is already locked, returns true when success.
+ //!Throws interprocess_exception if a severe error is found
+ bool try_lock();
+
+ //!Tries to lock the interprocess_mutex until time abs_time,
+ //!Returns false when timeout expires, returns true when locks.
+ //!Throws interprocess_exception if a severe error is found
+ bool timed_lock(const boost::posix_time::ptime &abs_time);
+
+ //!Erases a named mutex from the system.
+ //!Returns false on error. Never throws.
+ static bool remove(const char *name);
+
+ /// @cond
+ private:
+ friend class ipcdetail::interprocess_tester;
+ void dont_close_on_destruction();
+
+ interprocess_mutex *mutex() const
+ { return static_cast<interprocess_mutex*>(m_shmem.get_user_address()); }
+
+ ipcdetail::managed_open_or_create_impl<shared_memory_object> m_shmem;
+ typedef ipcdetail::named_creation_functor<interprocess_mutex> construct_func_t;
+ /// @endcond
+};
+
+/// @cond
+
+inline void shm_named_mutex::dont_close_on_destruction()
+{ ipcdetail::interprocess_tester::dont_close_on_destruction(m_shmem); }
+
+inline shm_named_mutex::~shm_named_mutex()
+{}
+
+inline shm_named_mutex::shm_named_mutex(create_only_t, const char *name, const permissions &perm)
+ : m_shmem (create_only
+ ,name
+ ,sizeof(interprocess_mutex) +
+ ipcdetail::managed_open_or_create_impl<shared_memory_object>::
+ ManagedOpenOrCreateUserOffset
+ ,read_write
+ ,0
+ ,construct_func_t(ipcdetail::DoCreate)
+ ,perm)
+{}
+
+inline shm_named_mutex::shm_named_mutex(open_or_create_t, const char *name, const permissions &perm)
+ : m_shmem (open_or_create
+ ,name
+ ,sizeof(interprocess_mutex) +
+ ipcdetail::managed_open_or_create_impl<shared_memory_object>::
+ ManagedOpenOrCreateUserOffset
+ ,read_write
+ ,0
+ ,construct_func_t(ipcdetail::DoOpenOrCreate)
+ ,perm)
+{}
+
+inline shm_named_mutex::shm_named_mutex(open_only_t, const char *name)
+ : m_shmem (open_only
+ ,name
+ ,read_write
+ ,0
+ ,construct_func_t(ipcdetail::DoOpen))
+{}
+
+inline void shm_named_mutex::lock()
+{ this->mutex()->lock(); }
+
+inline void shm_named_mutex::unlock()
+{ this->mutex()->unlock(); }
+
+inline bool shm_named_mutex::try_lock()
+{ return this->mutex()->try_lock(); }
+
+inline bool shm_named_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
+{
+ if(abs_time == boost::posix_time::pos_infin){
+ this->lock();
+ return true;
+ }
+ return this->mutex()->timed_lock(abs_time);
+}
+
+inline bool shm_named_mutex::remove(const char *name)
+{ return shared_memory_object::remove(name); }
+
+/// @endcond
+
+} //namespace ipcdetail {
+} //namespace interprocess {
+} //namespace boost {
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //BOOST_INTERPROCESS_SHM_NAMED_MUTEX_HPP

Added: trunk/boost/interprocess/sync/shm/named_recursive_mutex.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/shm/named_recursive_mutex.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,175 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_SHM_NAMED_RECURSIVE_MUTEX_HPP
+#define BOOST_INTERPROCESS_SHM_NAMED_RECURSIVE_MUTEX_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/creation_tags.hpp>
+#include <boost/interprocess/exceptions.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/interprocess/shared_memory_object.hpp>
+#include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
+#include <boost/interprocess/sync/interprocess_recursive_mutex.hpp>
+#include <boost/interprocess/sync/shm/named_creation_functor.hpp>
+#include <boost/interprocess/permissions.hpp>
+
+//!\file
+//!Describes a named shm_named_recursive_mutex class for inter-process synchronization
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+/// @cond
+class interprocess_tester;
+/// @endcond
+
+class shm_named_recursive_mutex
+{
+ /// @cond
+ //Non-copyable
+ shm_named_recursive_mutex();
+ shm_named_recursive_mutex(const shm_named_recursive_mutex &);
+ shm_named_recursive_mutex &operator=(const shm_named_recursive_mutex &);
+ /// @endcond
+ public:
+
+ //!Creates a global recursive_mutex with a name.
+ //!If the recursive_mutex can't be created throws interprocess_exception
+ shm_named_recursive_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions());
+
+ //!Opens or creates a global recursive_mutex with a name.
+ //!If the recursive_mutex is created, this call is equivalent to
+ //!shm_named_recursive_mutex(create_only_t, ... )
+ //!If the recursive_mutex is already created, this call is equivalent
+ //!shm_named_recursive_mutex(open_only_t, ... )
+ //!Does not throw
+ shm_named_recursive_mutex(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions());
+
+ //!Opens a global recursive_mutex with a name if that recursive_mutex is previously
+ //!created. If it is not previously created this function throws
+ //!interprocess_exception.
+ shm_named_recursive_mutex(open_only_t open_only, const char *name);
+
+ //!Destroys *this and indicates that the calling process is finished using
+ //!the resource. The destructor function will deallocate
+ //!any system resources allocated by the system for use by this process for
+ //!this resource. The resource can still be opened again calling
+ //!the open constructor overload. To erase the resource from the system
+ //!use remove().
+ ~shm_named_recursive_mutex();
+
+ //!Unlocks a previously locked
+ //!shm_named_recursive_mutex.
+ void unlock();
+
+ //!Locks shm_named_recursive_mutex, sleeps when shm_named_recursive_mutex is already locked.
+ //!Throws interprocess_exception if a severe error is found.
+ void lock();
+
+ //!Tries to lock the shm_named_recursive_mutex, returns false when shm_named_recursive_mutex
+ //!is already locked, returns true when success.
+ //!Throws interprocess_exception if a severe error is found.
+ bool try_lock();
+
+ //!Tries to lock the shm_named_recursive_mutex until time abs_time,
+ //!Returns false when timeout expires, returns true when locks.
+ //!Throws interprocess_exception if a severe error is found
+ bool timed_lock(const boost::posix_time::ptime &abs_time);
+
+ //!Erases a named recursive mutex
+ //!from the system
+ static bool remove(const char *name);
+
+ /// @cond
+ private:
+ friend class interprocess_tester;
+ void dont_close_on_destruction();
+
+ interprocess_recursive_mutex *mutex() const
+ { return static_cast<interprocess_recursive_mutex*>(m_shmem.get_user_address()); }
+
+ managed_open_or_create_impl<shared_memory_object> m_shmem;
+ typedef named_creation_functor<interprocess_recursive_mutex> construct_func_t;
+ /// @endcond
+};
+
+inline shm_named_recursive_mutex::~shm_named_recursive_mutex()
+{}
+
+inline void shm_named_recursive_mutex::dont_close_on_destruction()
+{ interprocess_tester::dont_close_on_destruction(m_shmem); }
+
+inline shm_named_recursive_mutex::shm_named_recursive_mutex(create_only_t, const char *name, const permissions &perm)
+ : m_shmem (create_only
+ ,name
+ ,sizeof(interprocess_recursive_mutex) +
+ managed_open_or_create_impl<shared_memory_object>::
+ ManagedOpenOrCreateUserOffset
+ ,read_write
+ ,0
+ ,construct_func_t(DoCreate)
+ ,perm)
+{}
+
+inline shm_named_recursive_mutex::shm_named_recursive_mutex(open_or_create_t, const char *name, const permissions &perm)
+ : m_shmem (open_or_create
+ ,name
+ ,sizeof(interprocess_recursive_mutex) +
+ managed_open_or_create_impl<shared_memory_object>::
+ ManagedOpenOrCreateUserOffset
+ ,read_write
+ ,0
+ ,construct_func_t(DoOpenOrCreate)
+ ,perm)
+{}
+
+inline shm_named_recursive_mutex::shm_named_recursive_mutex(open_only_t, const char *name)
+ : m_shmem (open_only
+ ,name
+ ,read_write
+ ,0
+ ,construct_func_t(DoOpen))
+{}
+
+inline void shm_named_recursive_mutex::lock()
+{ this->mutex()->lock(); }
+
+inline void shm_named_recursive_mutex::unlock()
+{ this->mutex()->unlock(); }
+
+inline bool shm_named_recursive_mutex::try_lock()
+{ return this->mutex()->try_lock(); }
+
+inline bool shm_named_recursive_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
+{
+ if(abs_time == boost::posix_time::pos_infin){
+ this->lock();
+ return true;
+ }
+ return this->mutex()->timed_lock(abs_time);
+}
+
+inline bool shm_named_recursive_mutex::remove(const char *name)
+{ return shared_memory_object::remove(name); }
+
+} //namespace ipcdetail {
+} //namespace interprocess {
+} //namespace boost {
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //BOOST_INTERPROCESS_SHM_NAMED_RECURSIVE_MUTEX_HPP

Added: trunk/boost/interprocess/sync/shm/named_semaphore.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/shm/named_semaphore.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,141 @@
+ //////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_SHM_NAMED_SEMAPHORE_HPP
+#define BOOST_INTERPROCESS_SHM_NAMED_SEMAPHORE_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/creation_tags.hpp>
+#include <boost/interprocess/exceptions.hpp>
+#include <boost/interprocess/permissions.hpp>
+#include <boost/interprocess/detail/interprocess_tester.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/interprocess/shared_memory_object.hpp>
+#include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
+#include <boost/interprocess/sync/interprocess_semaphore.hpp>
+#include <boost/interprocess/sync/shm/named_creation_functor.hpp>
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+class shm_named_semaphore
+{
+ /// @cond
+
+ //Non-copyable
+ shm_named_semaphore();
+ shm_named_semaphore(const shm_named_semaphore &);
+ shm_named_semaphore &operator=(const shm_named_semaphore &);
+ /// @endcond
+
+ public:
+ shm_named_semaphore(create_only_t, const char *name, unsigned int initialCount, const permissions &perm = permissions());
+
+ shm_named_semaphore(open_or_create_t, const char *name, unsigned int initialCount, const permissions &perm = permissions());
+
+ shm_named_semaphore(open_only_t, const char *name);
+
+ ~shm_named_semaphore();
+
+ void post();
+ void wait();
+ bool try_wait();
+ bool timed_wait(const boost::posix_time::ptime &abs_time);
+
+ static bool remove(const char *name);
+
+ /// @cond
+ private:
+ friend class interprocess_tester;
+ void dont_close_on_destruction();
+
+ interprocess_semaphore *semaphore() const
+ { return static_cast<interprocess_semaphore*>(m_shmem.get_user_address()); }
+
+ managed_open_or_create_impl<shared_memory_object> m_shmem;
+ typedef named_creation_functor<interprocess_semaphore, int> construct_func_t;
+ /// @endcond
+};
+
+inline shm_named_semaphore::~shm_named_semaphore()
+{}
+
+inline void shm_named_semaphore::dont_close_on_destruction()
+{ interprocess_tester::dont_close_on_destruction(m_shmem); }
+
+inline shm_named_semaphore::shm_named_semaphore
+ (create_only_t, const char *name, unsigned int initialCount, const permissions &perm)
+ : m_shmem (create_only
+ ,name
+ ,sizeof(interprocess_semaphore) +
+ managed_open_or_create_impl<shared_memory_object>::
+ ManagedOpenOrCreateUserOffset
+ ,read_write
+ ,0
+ ,construct_func_t(DoCreate, initialCount)
+ ,perm)
+{}
+
+inline shm_named_semaphore::shm_named_semaphore
+ (open_or_create_t, const char *name, unsigned int initialCount, const permissions &perm)
+ : m_shmem (open_or_create
+ ,name
+ ,sizeof(interprocess_semaphore) +
+ managed_open_or_create_impl<shared_memory_object>::
+ ManagedOpenOrCreateUserOffset
+ ,read_write
+ ,0
+ ,construct_func_t(DoOpenOrCreate, initialCount)
+ ,perm)
+{}
+
+inline shm_named_semaphore::shm_named_semaphore
+ (open_only_t, const char *name)
+ : m_shmem (open_only
+ ,name
+ ,read_write
+ ,0
+ ,construct_func_t(DoOpen, 0))
+{}
+
+inline void shm_named_semaphore::post()
+{ semaphore()->post(); }
+
+inline void shm_named_semaphore::wait()
+{ semaphore()->wait(); }
+
+inline bool shm_named_semaphore::try_wait()
+{ return semaphore()->try_wait(); }
+
+inline bool shm_named_semaphore::timed_wait(const boost::posix_time::ptime &abs_time)
+{
+ if(abs_time == boost::posix_time::pos_infin){
+ this->wait();
+ return true;
+ }
+ return semaphore()->timed_wait(abs_time);
+}
+
+inline bool shm_named_semaphore::remove(const char *name)
+{ return shared_memory_object::remove(name); }
+
+} //namespace ipcdetail {
+} //namespace interprocess {
+} //namespace boost {
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //BOOST_INTERPROCESS_SHM_NAMED_SEMAPHORE_HPP

Added: trunk/boost/interprocess/sync/shm/named_upgradable_mutex.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/shm/named_upgradable_mutex.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,372 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_named_upgradable_mutex_HPP
+#define BOOST_INTERPROCESS_named_upgradable_mutex_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/creation_tags.hpp>
+#include <boost/interprocess/exceptions.hpp>
+#include <boost/interprocess/shared_memory_object.hpp>
+#include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
+#include <boost/interprocess/sync/interprocess_upgradable_mutex.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/interprocess/sync/shm/named_creation_functor.hpp>
+#include <boost/interprocess/permissions.hpp>
+
+//!\file
+//!Describes a named upgradable mutex class for inter-process synchronization
+
+namespace boost {
+namespace interprocess {
+
+/// @cond
+namespace ipcdetail{ class interprocess_tester; }
+/// @endcond
+
+class named_condition;
+
+//!A upgradable mutex with a global name, so it can be found from different
+//!processes. This mutex can't be placed in shared memory, and
+//!each process should have it's own named upgradable mutex.
+class named_upgradable_mutex
+{
+ /// @cond
+ //Non-copyable
+ named_upgradable_mutex();
+ named_upgradable_mutex(const named_upgradable_mutex &);
+ named_upgradable_mutex &operator=(const named_upgradable_mutex &);
+ friend class named_condition;
+ /// @endcond
+ public:
+
+ //!Creates a global upgradable mutex with a name.
+ //!If the upgradable mutex can't be created throws interprocess_exception
+ named_upgradable_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions());
+
+ //!Opens or creates a global upgradable mutex with a name, and an initial count.
+ //!If the upgradable mutex is created, this call is equivalent to
+ //!named_upgradable_mutex(create_only_t, ...)
+ //!If the upgradable mutex is already created, this call is equivalent to
+ //!named_upgradable_mutex(open_only_t, ... ).
+ named_upgradable_mutex(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions());
+
+ //!Opens a global upgradable mutex with a name if that upgradable mutex
+ //!is previously.
+ //!created. If it is not previously created this function throws
+ //!interprocess_exception.
+ named_upgradable_mutex(open_only_t open_only, const char *name);
+
+ //!Destroys *this and indicates that the calling process is finished using
+ //!the resource. The destructor function will deallocate
+ //!any system resources allocated by the system for use by this process for
+ //!this resource. The resource can still be opened again calling
+ //!the open constructor overload. To erase the resource from the system
+ //!use remove().
+ ~named_upgradable_mutex();
+
+ //Exclusive locking
+
+ //!Effects: The calling thread tries to obtain exclusive ownership of the mutex,
+ //! and if another thread has exclusive, sharable or upgradable ownership of
+ //! the mutex, it waits until it can obtain the ownership.
+ //!Throws: interprocess_exception on error.
+ void lock();
+
+ //!Effects: The calling thread tries to acquire exclusive ownership of the mutex
+ //! without waiting. If no other thread has exclusive, sharable or upgradable
+ //! ownership of the mutex this succeeds.
+ //!Returns: If it can acquire exclusive ownership immediately returns true.
+ //! If it has to wait, returns false.
+ //!Throws: interprocess_exception on error.
+ bool try_lock();
+
+ //!Effects: The calling thread tries to acquire exclusive ownership of the mutex
+ //! waiting if necessary until no other thread has has exclusive, sharable or
+ //! upgradable ownership of the mutex or abs_time is reached.
+ //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false.
+ //!Throws: interprocess_exception on error.
+ bool timed_lock(const boost::posix_time::ptime &abs_time);
+
+ //!Precondition: The thread must have exclusive ownership of the mutex.
+ //!Effects: The calling thread releases the exclusive ownership of the mutex.
+ //!Throws: An exception derived from interprocess_exception on error.
+ void unlock();
+
+ //Sharable locking
+
+ //!Effects: The calling thread tries to obtain sharable ownership of the mutex,
+ //! and if another thread has exclusive or upgradable ownership of the mutex,
+ //! waits until it can obtain the ownership.
+ //!Throws: interprocess_exception on error.
+ void lock_sharable();
+
+ //!Effects: The calling thread tries to acquire sharable ownership of the mutex
+ //! without waiting. If no other thread has has exclusive or upgradable ownership
+ //! of the mutex this succeeds.
+ //!Returns: If it can acquire sharable ownership immediately returns true. If it
+ //! has to wait, returns false.
+ //!Throws: interprocess_exception on error.
+ bool try_lock_sharable();
+
+ //!Effects: The calling thread tries to acquire sharable ownership of the mutex
+ //! waiting if necessary until no other thread has has exclusive or upgradable
+ //! ownership of the mutex or abs_time is reached.
+ //!Returns: If acquires sharable ownership, returns true. Otherwise returns false.
+ //!Throws: interprocess_exception on error.
+ bool timed_lock_sharable(const boost::posix_time::ptime &abs_time);
+
+ //!Precondition: The thread must have sharable ownership of the mutex.
+ //!Effects: The calling thread releases the sharable ownership of the mutex.
+ //!Throws: An exception derived from interprocess_exception on error.
+ void unlock_sharable();
+
+ //Upgradable locking
+
+ //!Effects: The calling thread tries to obtain upgradable ownership of the mutex,
+ //! and if another thread has exclusive or upgradable ownership of the mutex,
+ //! waits until it can obtain the ownership.
+ //!Throws: interprocess_exception on error.
+ void lock_upgradable();
+
+ //!Effects: The calling thread tries to acquire upgradable ownership of the mutex
+ //! without waiting. If no other thread has has exclusive or upgradable ownership
+ //! of the mutex this succeeds.
+ //!Returns: If it can acquire upgradable ownership immediately returns true.
+ //! If it has to wait, returns false.
+ //!Throws: interprocess_exception on error.
+ bool try_lock_upgradable();
+
+ //!Effects: The calling thread tries to acquire upgradable ownership of the mutex
+ //! waiting if necessary until no other thread has has exclusive or upgradable
+ //! ownership of the mutex or abs_time is reached.
+ //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false.
+ //!Throws: interprocess_exception on error.
+ bool timed_lock_upgradable(const boost::posix_time::ptime &abs_time);
+
+ //!Precondition: The thread must have upgradable ownership of the mutex.
+ //!Effects: The calling thread releases the upgradable ownership of the mutex.
+ //!Throws: An exception derived from interprocess_exception on error.
+ void unlock_upgradable();
+
+ //Demotions
+
+ //!Precondition: The thread must have exclusive ownership of the mutex.
+ //!Effects: The thread atomically releases exclusive ownership and acquires
+ //! upgradable ownership. This operation is non-blocking.
+ //!Throws: An exception derived from interprocess_exception on error.
+ void unlock_and_lock_upgradable();
+
+ //!Precondition: The thread must have exclusive ownership of the mutex.
+ //!Effects: The thread atomically releases exclusive ownership and acquires
+ //! sharable ownership. This operation is non-blocking.
+ //!Throws: An exception derived from interprocess_exception on error.
+ void unlock_and_lock_sharable();
+
+ //!Precondition: The thread must have upgradable ownership of the mutex.
+ //!Effects: The thread atomically releases upgradable ownership and acquires
+ //! sharable ownership. This operation is non-blocking.
+ //!Throws: An exception derived from interprocess_exception on error.
+ void unlock_upgradable_and_lock_sharable();
+
+ //Promotions
+
+ //!Precondition: The thread must have upgradable ownership of the mutex.
+ //!Effects: The thread atomically releases upgradable ownership and acquires
+ //! exclusive ownership. This operation will block until all threads with
+ //! sharable ownership release it.
+ //!Throws: An exception derived from interprocess_exception on error.
+ void unlock_upgradable_and_lock();
+
+ //!Precondition: The thread must have upgradable ownership of the mutex.
+ //!Effects: The thread atomically releases upgradable ownership and tries to
+ //! acquire exclusive ownership. This operation will fail if there are threads
+ //! with sharable ownership, but it will maintain upgradable ownership.
+ //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false.
+ //!Throws: An exception derived from interprocess_exception on error.
+ bool try_unlock_upgradable_and_lock();
+
+ //!Precondition: The thread must have upgradable ownership of the mutex.
+ //!Effects: The thread atomically releases upgradable ownership and tries to acquire
+ //! exclusive ownership, waiting if necessary until abs_time. This operation will
+ //! fail if there are threads with sharable ownership or timeout reaches, but it
+ //! will maintain upgradable ownership.
+ //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false.
+ //!Throws: An exception derived from interprocess_exception on error.
+ bool timed_unlock_upgradable_and_lock(const boost::posix_time::ptime &abs_time);
+
+ //!Precondition: The thread must have sharable ownership of the mutex.
+ //!Effects: The thread atomically releases sharable ownership and tries to acquire
+ //! exclusive ownership. This operation will fail if there are threads with sharable
+ //! or upgradable ownership, but it will maintain sharable ownership.
+ //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false.
+ //!Throws: An exception derived from interprocess_exception on error.
+ bool try_unlock_sharable_and_lock();
+
+ bool try_unlock_sharable_and_lock_upgradable();
+
+ //!Erases a named upgradable mutex from the system.
+ //!Returns false on error. Never throws.
+ static bool remove(const char *name);
+
+ /// @cond
+ private:
+ friend class ipcdetail::interprocess_tester;
+ void dont_close_on_destruction();
+
+ interprocess_upgradable_mutex *mutex() const
+ { return static_cast<interprocess_upgradable_mutex*>(m_shmem.get_user_address()); }
+
+ ipcdetail::managed_open_or_create_impl<shared_memory_object> m_shmem;
+ typedef ipcdetail::named_creation_functor<interprocess_upgradable_mutex> construct_func_t;
+ /// @endcond
+};
+
+/// @cond
+
+inline named_upgradable_mutex::~named_upgradable_mutex()
+{}
+
+inline named_upgradable_mutex::named_upgradable_mutex
+ (create_only_t, const char *name, const permissions &perm)
+ : m_shmem (create_only
+ ,name
+ ,sizeof(interprocess_upgradable_mutex) +
+ ipcdetail::managed_open_or_create_impl<shared_memory_object>::
+ ManagedOpenOrCreateUserOffset
+ ,read_write
+ ,0
+ ,construct_func_t(ipcdetail::DoCreate)
+ ,perm)
+{}
+
+inline named_upgradable_mutex::named_upgradable_mutex
+ (open_or_create_t, const char *name, const permissions &perm)
+ : m_shmem (open_or_create
+ ,name
+ ,sizeof(interprocess_upgradable_mutex) +
+ ipcdetail::managed_open_or_create_impl<shared_memory_object>::
+ ManagedOpenOrCreateUserOffset
+ ,read_write
+ ,0
+ ,construct_func_t(ipcdetail::DoOpenOrCreate)
+ ,perm)
+{}
+
+inline named_upgradable_mutex::named_upgradable_mutex
+ (open_only_t, const char *name)
+ : m_shmem (open_only
+ ,name
+ ,read_write
+ ,0
+ ,construct_func_t(ipcdetail::DoOpen))
+{}
+
+inline void named_upgradable_mutex::dont_close_on_destruction()
+{ ipcdetail::interprocess_tester::dont_close_on_destruction(m_shmem); }
+
+inline void named_upgradable_mutex::lock()
+{ this->mutex()->lock(); }
+
+inline void named_upgradable_mutex::unlock()
+{ this->mutex()->unlock(); }
+
+inline bool named_upgradable_mutex::try_lock()
+{ return this->mutex()->try_lock(); }
+
+inline bool named_upgradable_mutex::timed_lock
+ (const boost::posix_time::ptime &abs_time)
+{
+ if(abs_time == boost::posix_time::pos_infin){
+ this->lock();
+ return true;
+ }
+ return this->mutex()->timed_lock(abs_time);
+}
+
+inline void named_upgradable_mutex::lock_upgradable()
+{ this->mutex()->lock_upgradable(); }
+
+inline void named_upgradable_mutex::unlock_upgradable()
+{ this->mutex()->unlock_upgradable(); }
+
+inline bool named_upgradable_mutex::try_lock_upgradable()
+{ return this->mutex()->try_lock_upgradable(); }
+
+inline bool named_upgradable_mutex::timed_lock_upgradable
+ (const boost::posix_time::ptime &abs_time)
+{
+ if(abs_time == boost::posix_time::pos_infin){
+ this->lock_upgradable();
+ return true;
+ }
+ return this->mutex()->timed_lock_upgradable(abs_time);
+}
+
+inline void named_upgradable_mutex::lock_sharable()
+{ this->mutex()->lock_sharable(); }
+
+inline void named_upgradable_mutex::unlock_sharable()
+{ this->mutex()->unlock_sharable(); }
+
+inline bool named_upgradable_mutex::try_lock_sharable()
+{ return this->mutex()->try_lock_sharable(); }
+
+inline bool named_upgradable_mutex::timed_lock_sharable
+ (const boost::posix_time::ptime &abs_time)
+{
+ if(abs_time == boost::posix_time::pos_infin){
+ this->lock_sharable();
+ return true;
+ }
+ return this->mutex()->timed_lock_sharable(abs_time);
+}
+
+inline void named_upgradable_mutex::unlock_and_lock_upgradable()
+{ this->mutex()->unlock_and_lock_upgradable(); }
+
+inline void named_upgradable_mutex::unlock_and_lock_sharable()
+{ this->mutex()->unlock_and_lock_sharable(); }
+
+inline void named_upgradable_mutex::unlock_upgradable_and_lock_sharable()
+{ this->mutex()->unlock_upgradable_and_lock_sharable(); }
+
+inline void named_upgradable_mutex::unlock_upgradable_and_lock()
+{ this->mutex()->unlock_upgradable_and_lock(); }
+
+inline bool named_upgradable_mutex::try_unlock_upgradable_and_lock()
+{ return this->mutex()->try_unlock_upgradable_and_lock(); }
+
+inline bool named_upgradable_mutex::timed_unlock_upgradable_and_lock
+ (const boost::posix_time::ptime &abs_time)
+{ return this->mutex()->timed_unlock_upgradable_and_lock(abs_time); }
+
+inline bool named_upgradable_mutex::try_unlock_sharable_and_lock()
+{ return this->mutex()->try_unlock_sharable_and_lock(); }
+
+inline bool named_upgradable_mutex::try_unlock_sharable_and_lock_upgradable()
+{ return this->mutex()->try_unlock_sharable_and_lock_upgradable(); }
+
+inline bool named_upgradable_mutex::remove(const char *name)
+{ return shared_memory_object::remove(name); }
+
+/// @endcond
+
+} //namespace interprocess {
+} //namespace boost {
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //BOOST_INTERPROCESS_named_upgradable_mutex_HPP

Added: trunk/boost/interprocess/sync/spin/condition.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/spin/condition.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,295 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_DETAIL_SPIN_CONDITION_HPP
+#define BOOST_INTERPROCESS_DETAIL_SPIN_CONDITION_HPP
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/interprocess/detail/atomic.hpp>
+#include <boost/interprocess/sync/spin/mutex.hpp>
+#include <boost/interprocess/sync/scoped_lock.hpp>
+#include <boost/interprocess/exceptions.hpp>
+#include <boost/interprocess/detail/os_thread_functions.hpp>
+#include <boost/move/move.hpp>
+#include <boost/cstdint.hpp>
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+class spin_condition
+{
+ spin_condition(const spin_condition &);
+ spin_condition &operator=(const spin_condition &);
+ public:
+ spin_condition();
+ ~spin_condition();
+
+ void notify_one();
+ void notify_all();
+
+ template <typename L>
+ bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time)
+ {
+ if(abs_time == boost::posix_time::pos_infin){
+ this->wait(lock);
+ return true;
+ }
+ if (!lock)
+ throw lock_exception();
+ return this->do_timed_wait(abs_time, *lock.mutex());
+ }
+
+ template <typename L, typename Pr>
+ bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred)
+ {
+ if(abs_time == boost::posix_time::pos_infin){
+ this->wait(lock, pred);
+ return true;
+ }
+ if (!lock)
+ throw lock_exception();
+ while (!pred()){
+ if (!this->do_timed_wait(abs_time, *lock.mutex()))
+ return pred();
+ }
+ return true;
+ }
+
+ template <typename L>
+ void wait(L& lock)
+ {
+ if (!lock)
+ throw lock_exception();
+ do_wait(*lock.mutex());
+ }
+
+ template <typename L, typename Pr>
+ void wait(L& lock, Pr pred)
+ {
+ if (!lock)
+ throw lock_exception();
+
+ while (!pred())
+ do_wait(*lock.mutex());
+ }
+
+ template<class InterprocessMutex>
+ void do_wait(InterprocessMutex &mut);
+
+ template<class InterprocessMutex>
+ bool do_timed_wait(const boost::posix_time::ptime &abs_time, InterprocessMutex &mut);
+
+ private:
+ template<class InterprocessMutex>
+ bool do_timed_wait(bool tout_enabled, const boost::posix_time::ptime &abs_time, InterprocessMutex &mut);
+
+ enum { SLEEP = 0, NOTIFY_ONE, NOTIFY_ALL };
+ ipcdetail::spin_mutex m_enter_mut;
+ volatile boost::uint32_t m_command;
+ volatile boost::uint32_t m_num_waiters;
+ void notify(boost::uint32_t command);
+};
+
+inline spin_condition::spin_condition()
+{
+ //Note that this class is initialized to zero.
+ //So zeroed memory can be interpreted as an initialized
+ //condition variable
+ m_command = SLEEP;
+ m_num_waiters = 0;
+}
+
+inline spin_condition::~spin_condition()
+{
+ //Trivial destructor
+}
+
+inline void spin_condition::notify_one()
+{
+ this->notify(NOTIFY_ONE);
+}
+
+inline void spin_condition::notify_all()
+{
+ this->notify(NOTIFY_ALL);
+}
+
+inline void spin_condition::notify(boost::uint32_t command)
+{
+ //This mutex guarantees that no other thread can enter to the
+ //do_timed_wait method logic, so that thread count will be
+ //constant until the function writes a NOTIFY_ALL command.
+ //It also guarantees that no other notification can be signaled
+ //on this spin_condition before this one ends
+ m_enter_mut.lock();
+
+ //Return if there are no waiters
+ if(!ipcdetail::atomic_read32(&m_num_waiters)) {
+ m_enter_mut.unlock();
+ return;
+ }
+
+ //Notify that all threads should execute wait logic
+ while(SLEEP != ipcdetail::atomic_cas32(const_cast<boost::uint32_t*>(&m_command), command, SLEEP)){
+ ipcdetail::thread_yield();
+ }
+/*
+ //Wait until the threads are woken
+ while(SLEEP != ipcdetail::atomic_cas32(const_cast<boost::uint32_t*>(&m_command), 0)){
+ ipcdetail::thread_yield();
+ }
+*/
+ //The enter mutex will rest locked until the last waiting thread unlocks it
+}
+
+template<class InterprocessMutex>
+inline void spin_condition::do_wait(InterprocessMutex &mut)
+{
+ this->do_timed_wait(false, boost::posix_time::ptime(), mut);
+}
+
+template<class InterprocessMutex>
+inline bool spin_condition::do_timed_wait
+ (const boost::posix_time::ptime &abs_time, InterprocessMutex &mut)
+{
+ return this->do_timed_wait(true, abs_time, mut);
+}
+
+template<class InterprocessMutex>
+inline bool spin_condition::do_timed_wait(bool tout_enabled,
+ const boost::posix_time::ptime &abs_time,
+ InterprocessMutex &mut)
+{
+ boost::posix_time::ptime now = microsec_clock::universal_time();
+
+ if(tout_enabled){
+ if(now >= abs_time) return false;
+ }
+
+ typedef boost::interprocess::scoped_lock<ipcdetail::spin_mutex> InternalLock;
+ //The enter mutex guarantees that while executing a notification,
+ //no other thread can execute the do_timed_wait method.
+ {
+ //---------------------------------------------------------------
+ InternalLock lock;
+ if(tout_enabled){
+ InternalLock dummy(m_enter_mut, abs_time);
+ lock = boost::move(dummy);
+ }
+ else{
+ InternalLock dummy(m_enter_mut);
+ lock = boost::move(dummy);
+ }
+
+ if(!lock)
+ return false;
+ //---------------------------------------------------------------
+ //We increment the waiting thread count protected so that it will be
+ //always constant when another thread enters the notification logic.
+ //The increment marks this thread as "waiting on spin_condition"
+ ipcdetail::atomic_inc32(const_cast<boost::uint32_t*>(&m_num_waiters));
+
+ //We unlock the external mutex atomically with the increment
+ mut.unlock();
+ }
+
+ //By default, we suppose that no timeout has happened
+ bool timed_out = false, unlock_enter_mut= false;
+
+ //Loop until a notification indicates that the thread should
+ //exit or timeout occurs
+ while(1){
+ //The thread sleeps/spins until a spin_condition commands a notification
+ //Notification occurred, we will lock the checking mutex so that
+ while(ipcdetail::atomic_read32(&m_command) == SLEEP){
+ ipcdetail::thread_yield();
+
+ //Check for timeout
+ if(tout_enabled){
+ now = microsec_clock::universal_time();
+
+ if(now >= abs_time){
+ //If we can lock the mutex it means that no notification
+ //is being executed in this spin_condition variable
+ timed_out = m_enter_mut.try_lock();
+
+ //If locking fails, indicates that another thread is executing
+ //notification, so we play the notification game
+ if(!timed_out){
+ //There is an ongoing notification, we will try again later
+ continue;
+ }
+ //No notification in execution, since enter mutex is locked.
+ //We will execute time-out logic, so we will decrement count,
+ //release the enter mutex and return false.
+ break;
+ }
+ }
+ }
+
+ //If a timeout occurred, the mutex will not execute checking logic
+ if(tout_enabled && timed_out){
+ //Decrement wait count
+ ipcdetail::atomic_dec32(const_cast<boost::uint32_t*>(&m_num_waiters));
+ unlock_enter_mut = true;
+ break;
+ }
+ else{
+ boost::uint32_t result = ipcdetail::atomic_cas32
+ (const_cast<boost::uint32_t*>(&m_command), SLEEP, NOTIFY_ONE);
+ if(result == SLEEP){
+ //Other thread has been notified and since it was a NOTIFY one
+ //command, this thread must sleep again
+ continue;
+ }
+ else if(result == NOTIFY_ONE){
+ //If it was a NOTIFY_ONE command, only this thread should
+ //exit. This thread has atomically marked command as sleep before
+ //so no other thread will exit.
+ //Decrement wait count.
+ unlock_enter_mut = true;
+ ipcdetail::atomic_dec32(const_cast<boost::uint32_t*>(&m_num_waiters));
+ break;
+ }
+ else{
+ //If it is a NOTIFY_ALL command, all threads should return
+ //from do_timed_wait function. Decrement wait count.
+ unlock_enter_mut = 1 == ipcdetail::atomic_dec32(const_cast<boost::uint32_t*>(&m_num_waiters));
+ //Check if this is the last thread of notify_all waiters
+ //Only the last thread will release the mutex
+ if(unlock_enter_mut){
+ ipcdetail::atomic_cas32(const_cast<boost::uint32_t*>(&m_command), SLEEP, NOTIFY_ALL);
+ }
+ break;
+ }
+ }
+ }
+
+ //Unlock the enter mutex if it is a single notification, if this is
+ //the last notified thread in a notify_all or a timeout has occurred
+ if(unlock_enter_mut){
+ m_enter_mut.unlock();
+ }
+
+ //Lock external again before returning from the method
+ mut.lock();
+ return !timed_out;
+}
+
+} //namespace ipcdetail
+} //namespace interprocess
+} //namespace boost
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //BOOST_INTERPROCESS_DETAIL_SPIN_CONDITION_HPP

Added: trunk/boost/interprocess/sync/spin/interprocess_barrier.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/spin/interprocess_barrier.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,46 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2006. 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/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include<boost/interprocess/exceptions.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/interprocess/sync/scoped_lock.hpp>
+
+namespace boost {
+namespace interprocess {
+
+inline barrier::barrier(unsigned int count)
+ : m_threshold(count), m_count(count), m_generation(0)
+{
+ if (count == 0)
+ throw std::invalid_argument("count cannot be zero.");
+}
+
+inline barrier::~barrier(){}
+
+inline bool barrier::wait()
+{
+ scoped_lock<interprocess_mutex> lock(m_mutex);
+ unsigned int gen = m_generation;
+
+ if (--m_count == 0){
+ m_generation++;
+ m_count = m_threshold;
+ m_cond.notify_all();
+ return true;
+ }
+
+ while (gen == m_generation){
+ m_cond.wait(lock);
+ }
+ return false;
+}
+
+} //namespace interprocess {
+} //namespace boost {

Added: trunk/boost/interprocess/sync/spin/mutex.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/spin/mutex.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,116 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_DETAIL_SPIN_MUTEX_HPP
+#define BOOST_INTERPROCESS_DETAIL_SPIN_MUTEX_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/assert.hpp>
+#include <boost/interprocess/detail/atomic.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/interprocess/detail/os_thread_functions.hpp>
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+class spin_mutex
+{
+ spin_mutex(const spin_mutex &);
+ spin_mutex &operator=(const spin_mutex &);
+ public:
+
+ spin_mutex();
+ ~spin_mutex();
+
+ void lock();
+ bool try_lock();
+ bool timed_lock(const boost::posix_time::ptime &abs_time);
+ void unlock();
+ void take_ownership(){};
+ private:
+ volatile boost::uint32_t m_s;
+};
+
+inline spin_mutex::spin_mutex()
+ : m_s(0)
+{
+ //Note that this class is initialized to zero.
+ //So zeroed memory can be interpreted as an
+ //initialized mutex
+}
+
+inline spin_mutex::~spin_mutex()
+{
+ //Trivial destructor
+}
+
+inline void spin_mutex::lock(void)
+{
+ do{
+ boost::uint32_t prev_s = ipcdetail::atomic_cas32(const_cast<boost::uint32_t*>(&m_s), 1, 0);
+
+ if (m_s == 1 && prev_s == 0){
+ break;
+ }
+ // relinquish current timeslice
+ ipcdetail::thread_yield();
+ }while (true);
+}
+
+inline bool spin_mutex::try_lock(void)
+{
+ boost::uint32_t prev_s = ipcdetail::atomic_cas32(const_cast<boost::uint32_t*>(&m_s), 1, 0);
+ return m_s == 1 && prev_s == 0;
+}
+
+inline bool spin_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
+{
+ if(abs_time == boost::posix_time::pos_infin){
+ this->lock();
+ return true;
+ }
+ //Obtain current count and target time
+ boost::posix_time::ptime now = microsec_clock::universal_time();
+
+ if(now >= abs_time) return false;
+
+ do{
+ if(this->try_lock()){
+ break;
+ }
+ now = microsec_clock::universal_time();
+
+ if(now >= abs_time){
+ return false;
+ }
+ // relinquish current time slice
+ ipcdetail::thread_yield();
+ }while (true);
+
+ return true;
+}
+
+inline void spin_mutex::unlock(void)
+{ ipcdetail::atomic_cas32(const_cast<boost::uint32_t*>(&m_s), 0, 1); }
+
+} //namespace ipcdetail {
+} //namespace interprocess {
+} //namespace boost {
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //BOOST_INTERPROCESS_DETAIL_SPIN_MUTEX_HPP

Added: trunk/boost/interprocess/sync/spin/recursive_mutex.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/spin/recursive_mutex.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,176 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+//
+// Parts of the pthread code come from Boost Threads code:
+//
+//////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2001-2003
+// William E. Kempf
+//
+// Permission to use, copy, modify, distribute and sell this software
+// and its documentation for any purpose is hereby granted without fee,
+// provided that the above copyright notice appear in all copies and
+// that both that copyright notice and this permission notice appear
+// in supporting documentation. William E. Kempf makes no representations
+// about the suitability of this software for any purpose.
+// It is provided "as is" without express or implied warranty.
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_DETAIL_SPIN_RECURSIVE_MUTEX_HPP
+#define BOOST_INTERPROCESS_DETAIL_SPIN_RECURSIVE_MUTEX_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/interprocess/detail/os_thread_functions.hpp>
+#include <boost/interprocess/exceptions.hpp>
+#include <boost/interprocess/detail/atomic.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/interprocess/detail/os_thread_functions.hpp>
+#include <boost/interprocess/sync/spin/mutex.hpp>
+#include <boost/assert.hpp>
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+class spin_recursive_mutex
+{
+ spin_recursive_mutex(const spin_recursive_mutex &);
+ spin_recursive_mutex &operator=(const spin_recursive_mutex &);
+ public:
+
+ spin_recursive_mutex();
+ ~spin_recursive_mutex();
+
+ void lock();
+ bool try_lock();
+ bool timed_lock(const boost::posix_time::ptime &abs_time);
+ void unlock();
+ void take_ownership();
+ private:
+ spin_mutex m_mutex;
+ unsigned int m_nLockCount;
+ volatile ipcdetail::OS_systemwide_thread_id_t m_nOwner;
+ volatile boost::uint32_t m_s;
+};
+
+inline spin_recursive_mutex::spin_recursive_mutex()
+ : m_nLockCount(0), m_nOwner(ipcdetail::get_invalid_systemwide_thread_id()){}
+
+inline spin_recursive_mutex::~spin_recursive_mutex(){}
+
+inline void spin_recursive_mutex::lock()
+{
+ typedef ipcdetail::OS_systemwide_thread_id_t handle_t;
+ const handle_t thr_id(ipcdetail::get_current_systemwide_thread_id());
+ handle_t old_id;
+ ipcdetail::systemwide_thread_id_copy(m_nOwner, old_id);
+ if(ipcdetail::equal_systemwide_thread_id(thr_id , old_id)){
+ if((unsigned int)(m_nLockCount+1) == 0){
+ //Overflow, throw an exception
+ throw interprocess_exception("boost::interprocess::spin_recursive_mutex recursive lock overflow");
+ }
+ ++m_nLockCount;
+ }
+ else{
+ m_mutex.lock();
+ ipcdetail::systemwide_thread_id_copy(thr_id, m_nOwner);
+ m_nLockCount = 1;
+ }
+}
+
+inline bool spin_recursive_mutex::try_lock()
+{
+ typedef ipcdetail::OS_systemwide_thread_id_t handle_t;
+ handle_t thr_id(ipcdetail::get_current_systemwide_thread_id());
+ handle_t old_id;
+ ipcdetail::systemwide_thread_id_copy(m_nOwner, old_id);
+ if(ipcdetail::equal_systemwide_thread_id(thr_id , old_id)) { // we own it
+ if((unsigned int)(m_nLockCount+1) == 0){
+ //Overflow, throw an exception
+ throw interprocess_exception("boost::interprocess::spin_recursive_mutex recursive lock overflow");
+ }
+ ++m_nLockCount;
+ return true;
+ }
+ if(m_mutex.try_lock()){
+ ipcdetail::systemwide_thread_id_copy(thr_id, m_nOwner);
+ m_nLockCount = 1;
+ return true;
+ }
+ return false;
+}
+
+inline bool spin_recursive_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
+{
+ typedef ipcdetail::OS_systemwide_thread_id_t handle_t;
+ if(abs_time == boost::posix_time::pos_infin){
+ this->lock();
+ return true;
+ }
+ const handle_t thr_id(ipcdetail::get_current_systemwide_thread_id());
+ handle_t old_id;
+ ipcdetail::systemwide_thread_id_copy(m_nOwner, old_id);
+ if(ipcdetail::equal_systemwide_thread_id(thr_id , old_id)) { // we own it
+ if((unsigned int)(m_nLockCount+1) == 0){
+ //Overflow, throw an exception
+ throw interprocess_exception("boost::interprocess::spin_recursive_mutex recursive lock overflow");
+ }
+ ++m_nLockCount;
+ return true;
+ }
+ if(m_mutex.timed_lock(abs_time)){
+ ipcdetail::systemwide_thread_id_copy(thr_id, m_nOwner);
+ m_nLockCount = 1;
+ return true;
+ }
+ return false;
+}
+
+inline void spin_recursive_mutex::unlock()
+{
+ typedef ipcdetail::OS_systemwide_thread_id_t handle_t;
+ handle_t old_id;
+ ipcdetail::systemwide_thread_id_copy(m_nOwner, old_id);
+ const handle_t thr_id(ipcdetail::get_current_systemwide_thread_id());
+ (void)old_id;
+ (void)thr_id;
+ BOOST_ASSERT(ipcdetail::equal_systemwide_thread_id(thr_id, old_id));
+ --m_nLockCount;
+ if(!m_nLockCount){
+ const handle_t new_id(ipcdetail::get_invalid_systemwide_thread_id());
+ ipcdetail::systemwide_thread_id_copy(new_id, m_nOwner);
+ m_mutex.unlock();
+ }
+}
+
+inline void spin_recursive_mutex::take_ownership()
+{
+ typedef ipcdetail::OS_systemwide_thread_id_t handle_t;
+ this->m_nLockCount = 1;
+ const handle_t thr_id(ipcdetail::get_current_systemwide_thread_id());
+ ipcdetail::systemwide_thread_id_copy
+ (thr_id, m_nOwner);
+}
+
+} //namespace ipcdetail {
+} //namespace interprocess {
+} //namespace boost {
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //BOOST_INTERPROCESS_DETAIL_SPIN_RECURSIVE_MUTEX_HPP

Added: trunk/boost/interprocess/sync/spin/semaphore.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/spin/semaphore.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,112 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_DETAIL_SPIN_SEMAPHORE_HPP
+#define BOOST_INTERPROCESS_DETAIL_SPIN_SEMAPHORE_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/detail/atomic.hpp>
+#include <boost/interprocess/detail/os_thread_functions.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/cstdint.hpp>
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+class spin_semaphore
+{
+ spin_semaphore(const spin_semaphore &);
+ spin_semaphore &operator=(const spin_semaphore &);
+
+ public:
+ spin_semaphore(unsigned int initialCount);
+ ~spin_semaphore();
+
+ void post();
+ void wait();
+ bool try_wait();
+ bool timed_wait(const boost::posix_time::ptime &abs_time);
+
+// int get_count() const;
+ private:
+ volatile boost::uint32_t m_count;
+};
+
+
+inline spin_semaphore::~spin_semaphore()
+{}
+
+inline spin_semaphore::spin_semaphore(unsigned int initialCount)
+{ ipcdetail::atomic_write32(&this->m_count, boost::uint32_t(initialCount)); }
+
+inline void spin_semaphore::post()
+{
+ ipcdetail::atomic_inc32(&m_count);
+}
+
+inline void spin_semaphore::wait()
+{
+ while(!ipcdetail::atomic_add_unless32(&m_count, boost::uint32_t(-1), boost::uint32_t(0))){
+ while(ipcdetail::atomic_read32(&m_count) == 0){
+ ipcdetail::thread_yield();
+ }
+ }
+}
+
+inline bool spin_semaphore::try_wait()
+{
+ return ipcdetail::atomic_add_unless32(&m_count, boost::uint32_t(-1), boost::uint32_t(0));
+}
+
+inline bool spin_semaphore::timed_wait(const boost::posix_time::ptime &abs_time)
+{
+ if(abs_time == boost::posix_time::pos_infin){
+ this->wait();
+ return true;
+ }
+ //Obtain current count and target time
+ boost::posix_time::ptime now(microsec_clock::universal_time());
+ if(now >= abs_time)
+ return false;
+
+ do{
+ if(this->try_wait()){
+ break;
+ }
+ now = microsec_clock::universal_time();
+
+ if(now >= abs_time){
+ return this->try_wait();
+ }
+ // relinquish current time slice
+ ipcdetail::thread_yield();
+ }while (true);
+ return true;
+}
+
+
+//inline int spin_semaphore::get_count() const
+//{
+ //return (int)ipcdetail::atomic_read32(&m_count);
+//}
+
+} //namespace ipcdetail {
+} //namespace interprocess {
+} //namespace boost {
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //BOOST_INTERPROCESS_DETAIL_SPIN_SEMAPHORE_HPP

Modified: trunk/boost/interprocess/sync/upgradable_lock.hpp
==============================================================================
--- trunk/boost/interprocess/sync/upgradable_lock.hpp (original)
+++ trunk/boost/interprocess/sync/upgradable_lock.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,7 +28,7 @@
 #include <boost/interprocess/detail/type_traits.hpp>
 
 #include <boost/interprocess/exceptions.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
 
 //!\file
@@ -117,7 +117,7 @@
    //! while unlocking upgr. If upgr is unlocked, then this upgradable_lock will
    //! be unlocked as well. Only a moved upgradable_lock's will match this
    //! signature. An non-moved upgradable_lock can be moved with the
- //! expression: "boost::interprocess::move(lock);". This constructor does not alter the
+ //! expression: "boost::move(lock);". This constructor does not alter the
    //! state of the mutex, only potentially who owns it.
    upgradable_lock(BOOST_RV_REF(upgradable_lock<mutex_type>) upgr)
       : mp_mutex(0), m_locked(upgr.owns())
@@ -131,7 +131,7 @@
    //! to an upgradable-ownership of this upgradable_lock.
    //! Only a moved sharable_lock's will match this
    //! signature. An non-moved sharable_lock can be moved with the
- //! expression: "boost::interprocess::move(lock);".
+ //! expression: "boost::move(lock);".
    template<class T>
    upgradable_lock(BOOST_RV_REF(scoped_lock<T>) scop
                   , typename ipcdetail::enable_if< ipcdetail::is_same<T, UpgradableMutex> >::type * = 0)

Added: trunk/boost/interprocess/sync/windows/condition.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/windows/condition.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,383 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_DETAIL_WINDOWS_CONDITION_HPP
+#define BOOST_INTERPROCESS_DETAIL_WINDOWS_CONDITION_HPP
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+
+#include <boost/interprocess/sync/interprocess_mutex.hpp>
+#include <boost/interprocess/sync/scoped_lock.hpp>
+#include <boost/interprocess/exceptions.hpp>
+#include <boost/interprocess/sync/windows/semaphore.hpp>
+#include <boost/interprocess/sync/windows/mutex.hpp>
+#include <boost/cstdint.hpp>
+#include <limits>
+
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+//
+// Condition variable algorithm taken from pthreads-win32 discussion.
+//
+// The algorithm was developed by Alexander Terekhov in colaboration with
+// Louis Thomas.
+//
+// Algorithm 8a / IMPL_SEM,UNBLOCK_STRATEGY == UNBLOCK_ALL
+//
+// semBlockLock - bin.semaphore
+// semBlockQueue - semaphore
+// mtxExternal - mutex or CS
+// mtxUnblockLock - mutex or CS
+// nWaitersGone - int
+// nWaitersBlocked - int
+// nWaitersToUnblock - int
+//
+// wait( timeout ) {
+//
+// [auto: register int result ] // error checking omitted
+// [auto: register int nSignalsWasLeft ]
+// [auto: register int nWaitersWasGone ]
+//
+// sem_wait( semBlockLock );
+// nWaitersBlocked++;
+// sem_post( semBlockLock );
+//
+// unlock( mtxExternal );
+// bTimedOut = sem_wait( semBlockQueue,timeout );
+//
+// lock( mtxUnblockLock );
+// if ( 0 != (nSignalsWasLeft = nWaitersToUnblock) ) {
+// if ( bTimedOut ) { // timeout (or canceled)
+// if ( 0 != nWaitersBlocked ) {
+// nWaitersBlocked--;
+// }
+// else {
+// nWaitersGone++; // count spurious wakeups.
+// }
+// }
+// if ( 0 == --nWaitersToUnblock ) {
+// if ( 0 != nWaitersBlocked ) {
+// sem_post( semBlockLock ); // open the gate.
+// nSignalsWasLeft = 0; // do not open the gate
+// // below again.
+// }
+// else if ( 0 != (nWaitersWasGone = nWaitersGone) ) {
+// nWaitersGone = 0;
+// }
+// }
+// }
+// else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or
+// // spurious semaphore :-)
+// sem_wait( semBlockLock );
+// nWaitersBlocked -= nWaitersGone; // something is going on here
+// // - test of timeouts? :-)
+// sem_post( semBlockLock );
+// nWaitersGone = 0;
+// }
+// unlock( mtxUnblockLock );
+//
+// if ( 1 == nSignalsWasLeft ) {
+// if ( 0 != nWaitersWasGone ) {
+// // sem_adjust( semBlockQueue,-nWaitersWasGone );
+// while ( nWaitersWasGone-- ) {
+// sem_wait( semBlockQueue ); // better now than spurious later
+// }
+// } sem_post( semBlockLock ); // open the gate
+// }
+//
+// lock( mtxExternal );
+//
+// return ( bTimedOut ) ? ETIMEOUT : 0;
+// }
+//
+// signal(bAll) {
+//
+// [auto: register int result ]
+// [auto: register int nSignalsToIssue]
+//
+// lock( mtxUnblockLock );
+//
+// if ( 0 != nWaitersToUnblock ) { // the gate is closed!!!
+// if ( 0 == nWaitersBlocked ) { // NO-OP
+// return unlock( mtxUnblockLock );
+// }
+// if (bAll) {
+// nWaitersToUnblock += nSignalsToIssue=nWaitersBlocked;
+// nWaitersBlocked = 0;
+// }
+// else {
+// nSignalsToIssue = 1;
+// nWaitersToUnblock++;
+// nWaitersBlocked--;
+// }
+// }
+// else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION!
+// sem_wait( semBlockLock ); // close the gate
+// if ( 0 != nWaitersGone ) {
+// nWaitersBlocked -= nWaitersGone;
+// nWaitersGone = 0;
+// }
+// if (bAll) {
+// nSignalsToIssue = nWaitersToUnblock = nWaitersBlocked;
+// nWaitersBlocked = 0;
+// }
+// else {
+// nSignalsToIssue = nWaitersToUnblock = 1;
+// nWaitersBlocked--;
+// }
+// }
+// else { // NO-OP
+// return unlock( mtxUnblockLock );
+// }
+//
+// unlock( mtxUnblockLock );
+// sem_post( semBlockQueue,nSignalsToIssue );
+// return result;
+// }
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+class windows_condition
+{
+ windows_condition(const windows_condition &);
+ windows_condition &operator=(const windows_condition &);
+ public:
+ windows_condition();
+ ~windows_condition();
+
+ void notify_one();
+ void notify_all();
+
+ template <typename L>
+ bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time)
+ {
+ if(abs_time == boost::posix_time::pos_infin){
+ this->wait(lock);
+ return true;
+ }
+ if (!lock)
+ throw lock_exception();
+ return this->do_timed_wait(abs_time, *lock.mutex());
+ }
+
+ template <typename L, typename Pr>
+ bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred)
+ {
+ if(abs_time == boost::posix_time::pos_infin){
+ this->wait(lock, pred);
+ return true;
+ }
+ if (!lock)
+ throw lock_exception();
+ while (!pred()){
+ if (!this->do_timed_wait(abs_time, *lock.mutex()))
+ return pred();
+ }
+ return true;
+ }
+
+ template <typename L>
+ void wait(L& lock)
+ {
+ if (!lock)
+ throw lock_exception();
+ do_wait(*lock.mutex());
+ }
+
+ template <typename L, typename Pr>
+ void wait(L& lock, Pr pred)
+ {
+ if (!lock)
+ throw lock_exception();
+
+ while (!pred())
+ do_wait(*lock.mutex());
+ }
+
+ template<class InterprocessMutex>
+ void do_wait(InterprocessMutex &mut);
+
+ template<class InterprocessMutex>
+ bool do_timed_wait(const boost::posix_time::ptime &abs_time, InterprocessMutex &mut);
+
+ private:
+
+ template<class InterprocessMutex>
+ bool do_timed_wait(bool timeout_enabled, const boost::posix_time::ptime &abs_time, InterprocessMutex &mut);
+ void do_signal (bool broadcast);
+
+ boost::int32_t m_nwaiters_blocked;
+ boost::int32_t m_nwaiters_gone;
+ boost::int32_t m_nwaiters_to_unblock;
+ windows_semaphore m_sem_block_queue;
+ windows_semaphore m_sem_block_lock;
+ windows_mutex m_mtx_unblock_lock;
+};
+
+inline windows_condition::windows_condition()
+ : m_nwaiters_blocked(0)
+ , m_nwaiters_gone(0)
+ , m_nwaiters_to_unblock(0)
+ , m_sem_block_queue(0)
+ , m_sem_block_lock(1)
+ , m_mtx_unblock_lock()
+{}
+
+inline windows_condition::~windows_condition()
+{}
+
+inline void windows_condition::notify_one()
+{ this->do_signal(false); }
+
+inline void windows_condition::notify_all()
+{ this->do_signal(true); }
+
+inline void windows_condition::do_signal(bool broadcast)
+{
+ boost::int32_t nsignals_to_issue;
+
+ {
+ scoped_lock<windows_mutex> locker(m_mtx_unblock_lock);
+
+ if ( 0 != m_nwaiters_to_unblock ) { // the gate is closed!!!
+ if ( 0 == m_nwaiters_blocked ) { // NO-OP
+ //locker's destructor triggers m_mtx_unblock_lock.unlock()
+ return;
+ }
+ if (broadcast) {
+ m_nwaiters_to_unblock += nsignals_to_issue = m_nwaiters_blocked;
+ m_nwaiters_blocked = 0;
+ }
+ else {
+ nsignals_to_issue = 1;
+ m_nwaiters_to_unblock++;
+ m_nwaiters_blocked--;
+ }
+ }
+ else if ( m_nwaiters_blocked > m_nwaiters_gone ) { // HARMLESS RACE CONDITION!
+ m_sem_block_lock.wait(); // close the gate
+ if ( 0 != m_nwaiters_gone ) {
+ m_nwaiters_blocked -= m_nwaiters_gone;
+ m_nwaiters_gone = 0;
+ }
+ if (broadcast) {
+ nsignals_to_issue = m_nwaiters_to_unblock = m_nwaiters_blocked;
+ m_nwaiters_blocked = 0;
+ }
+ else {
+ nsignals_to_issue = m_nwaiters_to_unblock = 1;
+ m_nwaiters_blocked--;
+ }
+ }
+ else { // NO-OP
+ //locker's destructor triggers m_mtx_unblock_lock.unlock()
+ return;
+ }
+ //locker's destructor triggers m_mtx_unblock_lock.unlock()
+ }
+ m_sem_block_queue.post(nsignals_to_issue);
+}
+
+template<class InterprocessMutex>
+inline void windows_condition::do_wait(InterprocessMutex &mut)
+{ this->do_timed_wait(false, boost::posix_time::ptime(), mut); }
+
+template<class InterprocessMutex>
+inline bool windows_condition::do_timed_wait
+ (const boost::posix_time::ptime &abs_time, InterprocessMutex &mut)
+{ return this->do_timed_wait(true, abs_time, mut); }
+
+template<class InterprocessMutex>
+inline bool windows_condition::do_timed_wait
+ (bool tout_enabled, const boost::posix_time::ptime &abs_time, InterprocessMutex &mtxExternal)
+{
+ //Initialize to avoid warnings
+ boost::int32_t nsignals_was_left = 0;
+ boost::int32_t nwaiters_was_gone = 0;
+
+ m_sem_block_lock.wait();
+ ++m_nwaiters_blocked;
+ m_sem_block_lock.post();
+
+ struct scoped_unlock
+ {
+ InterprocessMutex & mut;
+ scoped_unlock(InterprocessMutex & m)
+ : mut(m)
+ { m.unlock(); }
+
+ ~scoped_unlock()
+ { mut.lock(); }
+ } unlocker(mtxExternal);
+
+
+ bool bTimedOut = tout_enabled ? !m_sem_block_queue.timed_wait(abs_time) : (m_sem_block_queue.wait(), false);
+
+ {
+ scoped_lock<windows_mutex> locker(m_mtx_unblock_lock);
+ if ( 0 != (nsignals_was_left = m_nwaiters_to_unblock) ) {
+ if ( bTimedOut ) { // timeout (or canceled)
+ if ( 0 != m_nwaiters_blocked ) {
+ m_nwaiters_blocked--;
+ }
+ else {
+ m_nwaiters_gone++; // count spurious wakeups.
+ }
+ }
+ if ( 0 == --m_nwaiters_to_unblock ) {
+ if ( 0 != m_nwaiters_blocked ) {
+ m_sem_block_lock.post(); // open the gate.
+ nsignals_was_left = 0; // do not open the gate below again.
+ }
+ else if ( 0 != (nwaiters_was_gone = m_nwaiters_gone) ) {
+ m_nwaiters_gone = 0;
+ }
+ }
+ }
+ else if ( (std::numeric_limits<boost::int32_t>::max)()/2
+ == ++m_nwaiters_gone ) { // timeout/canceled or spurious semaphore :-)
+ m_sem_block_lock.wait();
+ m_nwaiters_blocked -= m_nwaiters_gone; // something is going on here - test of timeouts? :-)
+ m_sem_block_lock.post();
+ m_nwaiters_gone = 0;
+ }
+ //locker's destructor triggers m_mtx_unblock_lock.unlock()
+ }
+
+ if ( 1 == nsignals_was_left ) {
+ if ( 0 != nwaiters_was_gone ) {
+ // sem_adjust( m_sem_block_queue,-nwaiters_was_gone );
+ while ( nwaiters_was_gone-- ) {
+ m_sem_block_queue.wait(); // better now than spurious later
+ }
+ }
+ m_sem_block_lock.post(); // open the gate
+ }
+
+ //mtxExternal.lock(); called from unlocker
+
+ return ( bTimedOut ) ? false : true;
+}
+
+} //namespace ipcdetail
+} //namespace interprocess
+} //namespace boost
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //BOOST_INTERPROCESS_DETAIL_WINDOWS_CONDITION_HPP

Added: trunk/boost/interprocess/sync/windows/mutex.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/windows/mutex.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,142 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_DETAIL_WINDOWS_MUTEX_HPP
+#define BOOST_INTERPROCESS_DETAIL_WINDOWS_MUTEX_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/interprocess/detail/win32_api.hpp>
+#include <boost/interprocess/detail/intermodule_singleton.hpp>
+#include <boost/interprocess/sync/windows/sync_utils.hpp>
+#include <boost/interprocess/exceptions.hpp>
+
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+class windows_mutex
+{
+ windows_mutex(const windows_mutex &);
+ windows_mutex &operator=(const windows_mutex &);
+ public:
+
+ windows_mutex();
+ ~windows_mutex();
+
+ void lock();
+ bool try_lock();
+ bool timed_lock(const boost::posix_time::ptime &abs_time);
+ void unlock();
+ void take_ownership(){};
+
+ private:
+ const sync_id id_;
+};
+
+inline windows_mutex::windows_mutex()
+ : id_()
+{
+ sync_handles &handles =
+ intermodule_singleton<sync_handles>::get();
+ //Create mutex with the initial count
+ bool open_or_created;
+ handles.obtain_mutex(this->id_, &open_or_created);
+ //The mutex must be created, never opened
+ assert(open_or_created);
+ assert(open_or_created && winapi::get_last_error() != winapi::error_already_exists);
+ (void)open_or_created;
+}
+
+inline windows_mutex::~windows_mutex()
+{
+ sync_handles &handles =
+ intermodule_singleton<sync_handles>::get();
+ handles.destroy_handle(this->id_);
+}
+
+inline void windows_mutex::lock(void)
+{
+ sync_handles &handles =
+ intermodule_singleton<sync_handles>::get();
+ //This can throw
+ void *hnd = handles.obtain_mutex(this->id_);
+ unsigned long ret = winapi::wait_for_single_object(hnd, winapi::infinite_time);
+ if(ret == winapi::wait_failed){
+ error_info err(winapi::get_last_error());
+ throw interprocess_exception(err);
+ }
+}
+
+inline bool windows_mutex::try_lock(void)
+{
+ sync_handles &handles =
+ intermodule_singleton<sync_handles>::get();
+ //This can throw
+ void *hnd = handles.obtain_mutex(this->id_);
+ unsigned long ret = winapi::wait_for_single_object(hnd, 0);
+ if(ret == winapi::wait_failed){
+ error_info err(winapi::get_last_error());
+ throw interprocess_exception(err);
+ }
+ return ret != winapi::wait_timeout;
+}
+
+inline bool windows_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
+{
+ if(abs_time == boost::posix_time::pos_infin){
+ this->lock();
+ return true;
+ }
+ boost::posix_time::ptime now
+ = boost::posix_time::microsec_clock::universal_time();
+
+ if(abs_time < now){
+ return false;
+ }
+ else{
+ unsigned long ms = (unsigned long)(abs_time-now).total_milliseconds();
+ sync_handles &handles =
+ intermodule_singleton<sync_handles>::get();
+ //This can throw
+ void *hnd = handles.obtain_mutex(this->id_);
+ unsigned long ret = winapi::wait_for_single_object(hnd, ms);
+ if(ret == winapi::wait_failed){
+ error_info err(winapi::get_last_error());
+ throw interprocess_exception(err);
+ }
+ return ret != winapi::wait_timeout;
+ }
+}
+
+inline void windows_mutex::unlock(void)
+{
+ sync_handles &handles =
+ intermodule_singleton<sync_handles>::get();
+ //This can throw
+ void *hnd = handles.obtain_mutex(this->id_);
+ int ret = winapi::release_mutex(hnd);
+ (void)ret;
+ assert(ret);
+}
+
+} //namespace ipcdetail {
+} //namespace interprocess {
+} //namespace boost {
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //BOOST_INTERPROCESS_DETAIL_WINDOWS_MUTEX_HPP

Added: trunk/boost/interprocess/sync/windows/recursive_mutex.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/windows/recursive_mutex.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,43 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_DETAIL_WINDOWS_RECURSIVE_MUTEX_HPP
+#define BOOST_INTERPROCESS_DETAIL_WINDOWS_RECURSIVE_MUTEX_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/sync/windows/mutex.hpp>
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+//Windows mutex is already recursive
+class windows_recursive_mutex
+ : public windows_mutex
+{
+ windows_recursive_mutex(const windows_recursive_mutex &);
+ windows_recursive_mutex &operator=(const windows_recursive_mutex &);
+ public:
+ windows_recursive_mutex() : windows_mutex() {}
+};
+
+} //namespace ipcdetail {
+} //namespace interprocess {
+} //namespace boost {
+
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //BOOST_INTERPROCESS_DETAIL_WINDOWS_RECURSIVE_MUTEX_HPP

Added: trunk/boost/interprocess/sync/windows/semaphore.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/windows/semaphore.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,142 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_DETAIL_WINDOWS_SEMAPHORE_HPP
+#define BOOST_INTERPROCESS_DETAIL_WINDOWS_SEMAPHORE_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/interprocess/detail/win32_api.hpp>
+#include <boost/interprocess/detail/intermodule_singleton.hpp>
+#include <boost/interprocess/sync/windows/sync_utils.hpp>
+#include <boost/interprocess/exceptions.hpp>
+
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+class windows_semaphore
+{
+ windows_semaphore(const windows_semaphore &);
+ windows_semaphore &operator=(const windows_semaphore &);
+ public:
+
+ windows_semaphore(unsigned int initialCount);
+ ~windows_semaphore();
+
+ void post(long release_count = 1);
+ void wait();
+ bool try_wait();
+ bool timed_wait(const boost::posix_time::ptime &abs_time);
+
+ private:
+ const sync_id id_;
+};
+
+inline windows_semaphore::windows_semaphore(unsigned int initialCount)
+ : id_()
+{
+ sync_handles &handles =
+ intermodule_singleton<sync_handles>::get();
+ //Force smeaphore creation with the initial count
+ bool open_or_created;
+ handles.obtain_semaphore(this->id_, initialCount, &open_or_created);
+ //The semaphore must be created, never opened
+ assert(open_or_created);
+ assert(open_or_created && winapi::get_last_error() != winapi::error_already_exists);
+ (void)open_or_created;
+}
+
+inline windows_semaphore::~windows_semaphore()
+{
+ sync_handles &handles =
+ intermodule_singleton<sync_handles>::get();
+ handles.destroy_handle(this->id_);
+}
+
+inline void windows_semaphore::wait(void)
+{
+ sync_handles &handles =
+ intermodule_singleton<sync_handles>::get();
+ //This can throw
+ void *hnd = handles.obtain_semaphore(this->id_, 0);
+ unsigned long ret = winapi::wait_for_single_object(hnd, winapi::infinite_time);
+ if(ret == winapi::wait_failed){
+ error_info err(winapi::get_last_error());
+ throw interprocess_exception(err);
+ }
+}
+
+inline bool windows_semaphore::try_wait(void)
+{
+ sync_handles &handles =
+ intermodule_singleton<sync_handles>::get();
+ //This can throw
+ void *hnd = handles.obtain_semaphore(this->id_, 0);
+ unsigned long ret = winapi::wait_for_single_object(hnd, 0);
+ if(ret == winapi::wait_failed){
+ error_info err(winapi::get_last_error());
+ throw interprocess_exception(err);
+ }
+ return ret != winapi::wait_timeout;
+}
+
+inline bool windows_semaphore::timed_wait(const boost::posix_time::ptime &abs_time)
+{
+ if(abs_time == boost::posix_time::pos_infin){
+ this->wait();
+ return true;
+ }
+ boost::posix_time::ptime now
+ = boost::posix_time::microsec_clock::universal_time();
+
+ if(abs_time < now){
+ return false;
+ }
+ else{
+ unsigned long ms = (unsigned long)(abs_time-now).total_milliseconds();
+ sync_handles &handles =
+ intermodule_singleton<sync_handles>::get();
+ //This can throw
+ void *hnd = handles.obtain_semaphore(this->id_, 0);
+ unsigned long ret = winapi::wait_for_single_object(hnd, ms);
+ if(ret == winapi::wait_failed){
+ error_info err(winapi::get_last_error());
+ throw interprocess_exception(err);
+ }
+ return ret != winapi::wait_timeout;
+ }
+}
+
+inline void windows_semaphore::post(long release_count)
+{
+ sync_handles &handles =
+ intermodule_singleton<sync_handles>::get();
+ //This can throw
+ void *hnd = handles.obtain_semaphore(this->id_, 0);
+ long prev_count;
+ int ret = winapi::release_semaphore(hnd, release_count, &prev_count);
+ (void)ret;
+ assert(ret);
+}
+
+} //namespace ipcdetail {
+} //namespace interprocess {
+} //namespace boost {
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //BOOST_INTERPROCESS_DETAIL_WINDOWS_SEMAPHORE_HPP

Added: trunk/boost/interprocess/sync/windows/sync_utils.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/windows/sync_utils.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,173 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_DETAIL_SYNC_UTILS_HPP
+#define BOOST_INTERPROCESS_DETAIL_SYNC_UTILS_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/detail/win32_api.hpp>
+#include <boost/interprocess/sync/spin/mutex.hpp>
+#include <boost/interprocess/exceptions.hpp>
+#include <boost/interprocess/sync/scoped_lock.hpp>
+#include <boost/unordered/unordered_map.hpp>
+#include <cstddef>
+
+namespace boost {
+namespace interprocess {
+namespace ipcdetail {
+
+inline bool bytes_to_str(const void *mem, const std::size_t mem_length, char *out_str, std::size_t &out_length)
+{
+ const std::size_t need_mem = mem_length*2+1;
+ if(out_length < need_mem){
+ return false;
+ }
+
+ const char Characters [] =
+ { '0', '1', '2', '3', '4', '5', '6', '7'
+ , '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+
+ std::size_t char_counter = 0;
+ const char *buf = (const char *)mem;
+ for(std::size_t i = 0; i != mem_length; ++i){
+ out_str[char_counter++] = Characters[(buf[i]&0xF0)>>4];
+ out_str[char_counter++] = Characters[(buf[i]&0x0F)];
+ }
+ out_str[char_counter] = 0;
+ return true;
+}
+
+struct sync_id
+{
+ sync_id()
+ { winapi::query_performance_counter(&rand); }
+
+ __int64 rand;
+
+ friend std::size_t hash_value(const sync_id &m)
+ { return boost::hash_value(m.rand); }
+
+ friend bool operator==(const sync_id &l, const sync_id &r)
+ { return l.rand == r.rand; }
+};
+/*
+#define BOOST_NO_LONG_LONG ss
+
+#if defined(BOOST_NO_LONG_LONG)
+
+#error "defined(BOOST_NO_LONG_LONG)"
+#else
+#error "NOT defined(BOOST_NO_LONG_LONG)"
+#endif
+*/
+class sync_handles
+{
+ public:
+ enum type { MUTEX, SEMAPHORE };
+
+ private:
+ typedef boost::unordered_map<sync_id, void*> map_type;
+ static const std::size_t LengthOfGlobal = sizeof("Global\\boost.ipc")-1;
+ static const std::size_t StrSize = LengthOfGlobal + (sizeof(sync_id)*2+1);
+ typedef char NameBuf[StrSize];
+
+ void fill_name(NameBuf &name, const sync_id &id)
+ {
+ const char *n = "Global\\boost.ipc";
+ std::size_t i = 0;
+ do{
+ name[i] = n[i];
+ ++i;
+ } while(n[i]);
+ std::size_t len = sizeof(NameBuf) - LengthOfGlobal;
+ bytes_to_str(&id.rand, sizeof(id.rand), &name[LengthOfGlobal], len);
+ }
+
+ void erase_and_throw_if_error(void *hnd_val, const sync_id &id)
+ {
+ if(!hnd_val){
+ map_.erase(id);
+ error_info err(winapi::get_last_error());
+ throw interprocess_exception(err);
+ }
+ }
+
+ void* open_or_create_semaphore(const sync_id &id, unsigned int initial_count)
+ {
+ NameBuf name;
+ fill_name(name, id);
+ void *hnd_val = winapi::open_or_create_semaphore
+ (name, (long)initial_count, (long)(((unsigned long)(-1))>>1), unrestricted_security.get_attributes());
+ erase_and_throw_if_error(hnd_val, id);
+ return hnd_val;
+ }
+
+ void* open_or_create_mutex(const sync_id &id)
+ {
+ NameBuf name;
+ fill_name(name, id);
+ void *hnd_val = winapi::open_or_create_mutex
+ (name, false, unrestricted_security.get_attributes());
+ erase_and_throw_if_error(hnd_val, id);
+ return hnd_val;
+ }
+
+ public:
+ void *obtain_mutex(const sync_id &id, bool *popen_created = 0)
+ {
+ scoped_lock<spin_mutex> lock(mtx_);
+ void *&hnd_val = map_[id];
+ if(!hnd_val){
+ hnd_val = open_or_create_mutex(id);
+ if(popen_created) *popen_created = true;
+ }
+ return hnd_val;
+ }
+
+ void *obtain_semaphore(const sync_id &id, unsigned int initial_count, bool *popen_created = 0)
+ {
+ scoped_lock<spin_mutex> lock(mtx_);
+ void *&hnd_val = map_[id];
+ if(!hnd_val){
+ hnd_val = open_or_create_semaphore(id, initial_count);
+ if(popen_created) *popen_created = true;
+ }
+ return hnd_val;
+ }
+
+ void destroy_handle(const sync_id &id)
+ {
+ scoped_lock<spin_mutex> lock(mtx_);
+ map_type::iterator it = map_.find(id);
+ if(it != map_.end()){
+ winapi::close_handle(it->second);
+ map_.erase(it);
+ }
+ }
+
+ private:
+ winapi::interprocess_all_access_security unrestricted_security;
+ spin_mutex mtx_;
+ map_type map_;
+};
+
+
+} //namespace ipcdetail {
+} //namespace interprocess {
+} //namespace boost {
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //BOOST_INTERPROCESS_DETAIL_SYNC_UTILS_HPP

Modified: trunk/boost/interprocess/sync/xsi/xsi_named_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/xsi/xsi_named_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/xsi/xsi_named_mutex.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -18,7 +18,7 @@
 #error "This header can't be used in Windows operating systems"
 #endif
 
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/interprocess/creation_tags.hpp>
 #include <boost/interprocess/exceptions.hpp>
 #include <boost/interprocess/detail/utilities.hpp>
@@ -73,7 +73,7 @@
    //!Does not throw
    xsi_named_mutex &operator=(BOOST_RV_REF(xsi_named_mutex) moved)
    {
- xsi_named_mutex tmp(boost::interprocess::move(moved));
+ xsi_named_mutex tmp(boost::move(moved));
       this->swap(tmp);
       return *this;
    }

Modified: trunk/boost/interprocess/windows_shared_memory.hpp
==============================================================================
--- trunk/boost/interprocess/windows_shared_memory.hpp (original)
+++ trunk/boost/interprocess/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)
 //
@@ -89,7 +89,7 @@
    //!Does not throw
    windows_shared_memory &operator=(BOOST_RV_REF(windows_shared_memory) moved)
    {
- windows_shared_memory tmp(boost::interprocess::move(moved));
+ windows_shared_memory tmp(boost::move(moved));
       this->swap(tmp);
       return *this;
    }

Modified: trunk/boost/interprocess/xsi_key.hpp
==============================================================================
--- trunk/boost/interprocess/xsi_key.hpp (original)
+++ trunk/boost/interprocess/xsi_key.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -22,7 +22,7 @@
 #include <boost/interprocess/creation_tags.hpp>
 #include <boost/interprocess/exceptions.hpp>
 #include <boost/interprocess/detail/utilities.hpp>
-#include <boost/interprocess/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/interprocess/detail/os_file_functions.hpp>
 #include <boost/interprocess/interprocess_fwd.hpp>
 #include <boost/interprocess/exceptions.hpp>

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

Modified: trunk/boost/intrusive/any_hook.hpp
==============================================================================
--- trunk/boost/intrusive/any_hook.hpp (original)
+++ trunk/boost/intrusive/any_hook.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -19,7 +19,7 @@
 #include <boost/intrusive/detail/any_node_and_algorithms.hpp>
 #include <boost/intrusive/options.hpp>
 #include <boost/intrusive/detail/generic_hook.hpp>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 
 namespace boost {
 namespace intrusive {
@@ -244,15 +244,15 @@
 template<class ValueTraits>
 struct any_to_get_base_pointer_type
 {
- typedef typename pointer_to_other
- <typename ValueTraits::boost_intrusive_tags::node_traits::node_ptr, void>::type type;
+ typedef typename pointer_traits<typename ValueTraits::boost_intrusive_tags::node_traits::node_ptr>::template
+ rebind_pointer<void>::type type;
 };
 
 template<class ValueTraits>
 struct any_to_get_member_pointer_type
 {
- typedef typename pointer_to_other
- <typename ValueTraits::node_ptr, void>::type type;
+ typedef typename pointer_traits
+ <typename ValueTraits::node_ptr>::template rebind_pointer<void>::type type;
 };
 
 //!This option setter specifies that the container

Modified: trunk/boost/intrusive/avltree.hpp
==============================================================================
--- trunk/boost/intrusive/avltree.hpp (original)
+++ trunk/boost/intrusive/avltree.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -27,9 +27,11 @@
 #include <boost/intrusive/detail/tree_node.hpp>
 #include <boost/intrusive/detail/ebo_functor_holder.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/detail/clear_on_destructor_base.hpp>
 #include <boost/intrusive/options.hpp>
+#include <boost/intrusive/detail/utilities.hpp>
 #include <boost/intrusive/avltree_algorithms.hpp>
 #include <boost/intrusive/link_mode.hpp>
 #include <boost/move/move.hpp>
@@ -96,24 +98,30 @@
    /// @endcond
    typedef typename real_value_traits::pointer pointer;
    typedef typename real_value_traits::const_pointer const_pointer;
- typedef typename std::iterator_traits<pointer>::value_type value_type;
+ typedef typename boost::intrusive::
+ pointer_traits<pointer>::element_type value_type;
    typedef value_type key_type;
- typedef typename std::iterator_traits<pointer>::reference reference;
- typedef typename std::iterator_traits<const_pointer>::reference const_reference;
- typedef typename std::iterator_traits<pointer>::difference_type difference_type;
+ typedef typename boost::intrusive::
+ pointer_traits<pointer>::reference reference;
+ typedef typename boost::intrusive::
+ pointer_traits<const_pointer>::reference const_reference;
+ typedef typename boost::intrusive::
+ pointer_traits<pointer>::difference_type difference_type;
    typedef typename Config::size_type size_type;
    typedef typename Config::compare value_compare;
    typedef value_compare key_compare;
- typedef tree_iterator<avltree_impl, false> iterator;
- typedef tree_iterator<avltree_impl, true> const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef tree_iterator<avltree_impl, false> iterator;
+ typedef tree_iterator<avltree_impl, true> const_iterator;
+ typedef boost::intrusive::detail::reverse_iterator<iterator> reverse_iterator;
+ typedef boost::intrusive::detail::reverse_iterator<const_iterator>const_reverse_iterator;
    typedef typename real_value_traits::node_traits node_traits;
    typedef typename node_traits::node node;
- typedef typename boost::pointer_to_other
- <pointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <node_ptr, const node>::type const_node_ptr;
+ typedef typename pointer_traits
+ <pointer>::template rebind_pointer
+ <node>::type node_ptr;
+ typedef typename pointer_traits
+ <pointer>::template rebind_pointer
+ <const node>::type const_node_ptr;
    typedef avltree_algorithms<node_traits> node_algorithms;
 
    static const bool constant_time_size = Config::constant_time_size;
@@ -165,16 +173,14 @@
    value_traits &priv_value_traits()
    { return data_; }
 
- const node &priv_header() const
- { return data_.node_plus_pred_.header_plus_size_.header_; }
+ node_ptr priv_header_ptr()
+ { return pointer_traits<node_ptr>::pointer_to(data_.node_plus_pred_.header_plus_size_.header_); }
 
- node &priv_header()
- { return data_.node_plus_pred_.header_plus_size_.header_; }
+ const_node_ptr priv_header_ptr() const
+ { return pointer_traits<const_node_ptr>::pointer_to(data_.node_plus_pred_.header_plus_size_.header_); }
 
- static node_ptr uncast(const_node_ptr ptr)
- {
- return node_ptr(const_cast<node*>(detail::boost_intrusive_get_pointer(ptr)));
- }
+ static node_ptr uncast(const const_node_ptr & ptr)
+ { return pointer_traits<node_ptr>::const_cast_from(ptr); }
 
    size_traits &priv_size_traits()
    { return data_.node_plus_pred_.header_plus_size_; }
@@ -217,7 +223,7 @@
                , const value_traits &v_traits = value_traits())
       : data_(cmp, v_traits)
    {
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(size_type(0));
    }
 
@@ -239,7 +245,7 @@
               , const value_traits &v_traits = value_traits())
       : data_(cmp, v_traits)
    {
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(size_type(0));
       if(unique)
          this->insert_unique(b, e);
@@ -252,7 +258,7 @@
    avltree_impl(BOOST_RV_REF(avltree_impl) x)
       : data_(::boost::move(x.priv_comp()), ::boost::move(x.priv_value_traits()))
    {
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(size_type(0));
       this->swap(x);
    }
@@ -278,7 +284,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    iterator begin()
- { return iterator (node_traits::get_left(node_ptr(&priv_header())), this); }
+ { return iterator (node_traits::get_left(this->priv_header_ptr()), this); }
 
    //! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the tree.
    //!
@@ -294,7 +300,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    const_iterator cbegin() const
- { return const_iterator (node_traits::get_left(const_node_ptr(&priv_header())), this); }
+ { return const_iterator (node_traits::get_left(this->priv_header_ptr()), this); }
 
    //! <b>Effects</b>: Returns an iterator pointing to the end of the tree.
    //!
@@ -302,7 +308,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    iterator end()
- { return iterator (node_ptr(&priv_header()), this); }
+ { return iterator (this->priv_header_ptr(), this); }
 
    //! <b>Effects</b>: Returns a const_iterator pointing to the end of the tree.
    //!
@@ -318,7 +324,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    const_iterator cend() const
- { return const_iterator (uncast(const_node_ptr(&priv_header())), this); }
+ { return const_iterator (uncast(this->priv_header_ptr()), this); }
 
    //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
    //! reversed tree.
@@ -432,7 +438,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    bool empty() const
- { return node_algorithms::unique(const_node_ptr(&priv_header())); }
+ { return node_algorithms::unique(this->priv_header_ptr()); }
 
    //! <b>Effects</b>: Returns the number of elements stored in the tree.
    //!
@@ -445,7 +451,7 @@
       if(constant_time_size)
          return this->priv_size_traits().get_size();
       else{
- return (size_type)node_algorithms::size(const_node_ptr(&priv_header()));
+ return (size_type)node_algorithms::size(this->priv_header_ptr());
       }
    }
 
@@ -460,7 +466,7 @@
       using std::swap;
       swap(priv_comp(), priv_comp());
       //These can't throw
- node_algorithms::swap_tree(node_ptr(&priv_header()), node_ptr(&other.priv_header()));
+ node_algorithms::swap_tree(this->priv_header_ptr(), other.priv_header_ptr());
       if(constant_time_size){
          size_type backup = this->priv_size_traits().get_size();
          this->priv_size_traits().set_size(other.priv_size_traits().get_size());
@@ -487,7 +493,7 @@
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       iterator ret(node_algorithms::insert_equal_upper_bound
- (node_ptr(&priv_header()), to_insert, key_node_comp), this);
+ (this->priv_header_ptr(), to_insert, key_node_comp), this);
       this->priv_size_traits().increment();
       return ret;
    }
@@ -514,7 +520,7 @@
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       iterator ret(node_algorithms::insert_equal
- (node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp), this);
+ (this->priv_header_ptr(), hint.pointed_node(), to_insert, key_node_comp), this);
       this->priv_size_traits().increment();
       return ret;
    }
@@ -650,7 +656,7 @@
          comp(key_value_comp, this);
       std::pair<node_ptr, bool> ret =
          (node_algorithms::insert_unique_check
- (node_ptr(&priv_header()), key, comp, commit_data));
+ (this->priv_header_ptr(), key, comp, commit_data));
       return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
    }
 
@@ -695,7 +701,7 @@
          comp(key_value_comp, this);
       std::pair<node_ptr, bool> ret =
          (node_algorithms::insert_unique_check
- (node_ptr(&priv_header()), hint.pointed_node(), key, comp, commit_data));
+ (this->priv_header_ptr(), hint.pointed_node(), key, comp, commit_data));
       return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
    }
 
@@ -722,7 +728,7 @@
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       node_algorithms::insert_unique_commit
- (node_ptr(&priv_header()), to_insert, commit_data);
+ (this->priv_header_ptr(), to_insert, commit_data);
       this->priv_size_traits().increment();
       return iterator(to_insert, this);
    }
@@ -747,7 +753,7 @@
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       iterator ret(node_algorithms::insert_before
- (node_ptr(&priv_header()), pos.pointed_node(), to_insert), this);
+ (this->priv_header_ptr(), pos.pointed_node(), to_insert), this);
       this->priv_size_traits().increment();
       return ret;
    }
@@ -771,7 +777,7 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- node_algorithms::push_back(node_ptr(&priv_header()), to_insert);
+ node_algorithms::push_back(this->priv_header_ptr(), to_insert);
       this->priv_size_traits().increment();
    }
 
@@ -794,7 +800,7 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- node_algorithms::push_front(node_ptr(&priv_header()), to_insert);
+ node_algorithms::push_front(this->priv_header_ptr(), to_insert);
       this->priv_size_traits().increment();
    }
 
@@ -813,7 +819,7 @@
       node_ptr to_erase(i.pointed_node());
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!node_algorithms::unique(to_erase));
- node_algorithms::erase(&priv_header(), to_erase);
+ node_algorithms::erase(this->priv_header_ptr(), to_erase);
       this->priv_size_traits().decrement();
       if(safemode_or_autounlink)
          node_algorithms::init(to_erase);
@@ -975,7 +981,7 @@
          this->clear_and_dispose(detail::null_disposer());
       }
       else{
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
          this->priv_size_traits().set_size(0);
       }
    }
@@ -992,9 +998,9 @@
    template<class Disposer>
    void clear_and_dispose(Disposer disposer)
    {
- node_algorithms::clear_and_dispose(node_ptr(&priv_header())
+ node_algorithms::clear_and_dispose(this->priv_header_ptr()
          , detail::node_disposer<Disposer, avltree_impl>(disposer, this));
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(0);
    }
 
@@ -1050,7 +1056,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, avltree_impl>
          key_node_comp(comp, this);
       return iterator(node_algorithms::lower_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Returns a const iterator to the first element whose
@@ -1065,7 +1071,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, avltree_impl>
          key_node_comp(comp, this);
       return const_iterator(node_algorithms::lower_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Returns an iterator to the first element whose
@@ -1090,7 +1096,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, avltree_impl>
          key_node_comp(comp, this);
       return iterator(node_algorithms::upper_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Returns an iterator to the first element whose
@@ -1115,7 +1121,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, avltree_impl>
          key_node_comp(comp, this);
       return const_iterator(node_algorithms::upper_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Finds an iterator to the first element whose key is
@@ -1139,7 +1145,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, avltree_impl>
          key_node_comp(comp, this);
       return iterator
- (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (node_algorithms::find(this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
@@ -1163,7 +1169,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, avltree_impl>
          key_node_comp(comp, this);
       return const_iterator
- (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (node_algorithms::find(this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Finds a range containing all elements whose key is k or
@@ -1189,7 +1195,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, avltree_impl>
          key_node_comp(comp, this);
       std::pair<node_ptr, node_ptr> ret
- (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp));
+ (node_algorithms::equal_range(this->priv_header_ptr(), key, key_node_comp));
       return std::pair<iterator, iterator>(iterator(ret.first, this), iterator(ret.second, this));
    }
 
@@ -1218,7 +1224,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, avltree_impl>
          key_node_comp(comp, this);
       std::pair<node_ptr, node_ptr> ret
- (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp));
+ (node_algorithms::equal_range(this->priv_header_ptr(), key, key_node_comp));
       return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
    }
 
@@ -1244,8 +1250,8 @@
          detail::exception_disposer<avltree_impl, Disposer>
             rollback(*this, disposer);
          node_algorithms::clone
- (const_node_ptr(&src.priv_header())
- ,node_ptr(&this->priv_header())
+ (src.priv_header_ptr()
+ ,this->priv_header_ptr()
             ,detail::node_cloner<Cloner, avltree_impl>(cloner, this)
             ,detail::node_disposer<Disposer, avltree_impl>(disposer, this));
          this->priv_size_traits().set_size(src.priv_size_traits().get_size());
@@ -1267,7 +1273,7 @@
    pointer unlink_leftmost_without_rebalance()
    {
       node_ptr to_be_disposed(node_algorithms::unlink_leftmost_without_rebalance
- (node_ptr(&priv_header())));
+ (this->priv_header_ptr()));
       if(!to_be_disposed)
          return 0;
       this->priv_size_traits().decrement();
@@ -1293,7 +1299,7 @@
    void replace_node(iterator replace_this, reference with_this)
    {
       node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this)
- , node_ptr(&priv_header())
+ , this->priv_header_ptr()
                                    , get_real_value_traits().to_node_ptr(with_this));
       if(safemode_or_autounlink)
          node_algorithms::init(replace_this.pointed_node());
@@ -1424,7 +1430,7 @@
    static avltree_impl &priv_container_from_end_iterator(const const_iterator &end_iterator)
    {
       header_plus_size *r = detail::parent_from_member<header_plus_size, node>
- ( detail::boost_intrusive_get_pointer(end_iterator.pointed_node()), &header_plus_size::header_);
+ ( boost::intrusive::detail::to_raw_pointer(end_iterator.pointed_node()), &header_plus_size::header_);
       node_plus_pred_t *n = detail::parent_from_member
          <node_plus_pred_t, header_plus_size>(r, &node_plus_pred_t::header_plus_size_);
       data_t *d = detail::parent_from_member<data_t, node_plus_pred_t>(n, &data_t::node_plus_pred_);

Modified: trunk/boost/intrusive/avltree_algorithms.hpp
==============================================================================
--- trunk/boost/intrusive/avltree_algorithms.hpp (original)
+++ trunk/boost/intrusive/avltree_algorithms.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -22,6 +22,7 @@
 #include <boost/intrusive/detail/assert.hpp>
 #include <boost/intrusive/detail/utilities.hpp>
 #include <boost/intrusive/detail/tree_algorithms.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 
 
 namespace boost {
@@ -88,7 +89,7 @@
          : base_t(f)
       {}
       
- node_ptr operator()(node_ptr p)
+ node_ptr operator()(const node_ptr &p)
       {
          node_ptr n = base_t::get()(p);
          NodeTraits::set_balance(n, NodeTraits::get_balance(p));
@@ -98,21 +99,19 @@
 
    struct avltree_erase_fixup
    {
- void operator()(node_ptr to_erase, node_ptr successor)
+ void operator()(const node_ptr &to_erase, const node_ptr &successor)
       { NodeTraits::set_balance(successor, NodeTraits::get_balance(to_erase)); }
    };
 
- static node_ptr uncast(const_node_ptr ptr)
- {
- return node_ptr(const_cast<node*>(::boost::intrusive::detail::boost_intrusive_get_pointer(ptr)));
- }
+ static node_ptr uncast(const const_node_ptr & ptr)
+ { return pointer_traits<node_ptr>::const_cast_from(ptr); }
    /// @endcond
 
    public:
- static node_ptr begin_node(const_node_ptr header)
+ static node_ptr begin_node(const const_node_ptr & header)
    { return tree_algorithms::begin_node(header); }
 
- static node_ptr end_node(const_node_ptr header)
+ static node_ptr end_node(const const_node_ptr & header)
    { return tree_algorithms::end_node(header); }
 
    //! This type is the information that will be
@@ -128,7 +127,7 @@
    //! <b>Complexity</b>: Constant.
    //!
    //! <b>Throws</b>: Nothing.
- static void swap_tree(node_ptr header1, node_ptr header2)
+ static void swap_tree(const node_ptr & header1, const node_ptr & header2)
    { return tree_algorithms::swap_tree(header1, header2); }
 
    //! <b>Requires</b>: node1 and node2 can't be header nodes
@@ -146,7 +145,7 @@
    //! node1 and node2 are not equivalent according to the ordering rules.
    //!
    //!Experimental function
- static void swap_nodes(node_ptr node1, node_ptr node2)
+ static void swap_nodes(const node_ptr & node1, const node_ptr & node2)
    {
       if(node1 == node2)
          return;
@@ -170,7 +169,7 @@
    //! node1 and node2 are not equivalent according to the ordering rules.
    //!
    //!Experimental function
- static void swap_nodes(node_ptr node1, node_ptr header1, node_ptr node2, node_ptr header2)
+ static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2)
    {
       if(node1 == node2) return;
 
@@ -197,7 +196,7 @@
    //! the node, since no rebalancing and comparison is needed.
    //!
    //!Experimental function
- static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node)
+ static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node)
    {
       if(node_to_be_replaced == new_node)
          return;
@@ -220,7 +219,7 @@
    //! the node, since no rebalancing or comparison is needed.
    //!
    //!Experimental function
- static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node)
+ static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node)
    {
       tree_algorithms::replace_node(node_to_be_replaced, header, new_node);
       NodeTraits::set_balance(new_node, NodeTraits::get_balance(node_to_be_replaced));
@@ -233,7 +232,7 @@
    //! <b>Complexity</b>: Average complexity is constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static void unlink(node_ptr node)
+ static void unlink(const node_ptr & node)
    {
       node_ptr x = NodeTraits::get_parent(node);
       if(x){
@@ -256,7 +255,7 @@
    //! only be used for more unlink_leftmost_without_rebalance calls.
    //! This function is normally used to achieve a step by step
    //! controlled destruction of the tree.
- static node_ptr unlink_leftmost_without_rebalance(node_ptr header)
+ static node_ptr unlink_leftmost_without_rebalance(const node_ptr & header)
    { return tree_algorithms::unlink_leftmost_without_rebalance(header); }
 
    //! <b>Requires</b>: node is a node of the tree or an node initialized
@@ -267,7 +266,7 @@
    //! <b>Complexity</b>: Constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static bool unique(const_node_ptr node)
+ static bool unique(const const_node_ptr & node)
    { return tree_algorithms::unique(node); }
 
    //! <b>Requires</b>: node is a node of the tree but it's not the header.
@@ -277,7 +276,7 @@
    //! <b>Complexity</b>: Linear time.
    //!
    //! <b>Throws</b>: Nothing.
- static std::size_t count(const_node_ptr node)
+ static std::size_t count(const const_node_ptr & node)
    { return tree_algorithms::count(node); }
 
    //! <b>Requires</b>: header is the header node of the tree.
@@ -287,7 +286,7 @@
    //! <b>Complexity</b>: Linear time.
    //!
    //! <b>Throws</b>: Nothing.
- static std::size_t size(const_node_ptr header)
+ static std::size_t size(const const_node_ptr & header)
    { return tree_algorithms::size(header); }
 
    //! <b>Requires</b>: p is a node from the tree except the header.
@@ -297,7 +296,7 @@
    //! <b>Complexity</b>: Average constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr next_node(node_ptr p)
+ static node_ptr next_node(const node_ptr & p)
    { return tree_algorithms::next_node(p); }
 
    //! <b>Requires</b>: p is a node from the tree except the leftmost node.
@@ -307,7 +306,7 @@
    //! <b>Complexity</b>: Average constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr prev_node(node_ptr p)
+ static node_ptr prev_node(const node_ptr & p)
    { return tree_algorithms::prev_node(p); }
 
    //! <b>Requires</b>: node must not be part of any tree.
@@ -319,7 +318,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
- static void init(node_ptr node)
+ static void init(const node_ptr & node)
    { tree_algorithms::init(node); }
 
    //! <b>Requires</b>: node must not be part of any tree.
@@ -332,7 +331,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
- static void init_header(node_ptr header)
+ static void init_header(const node_ptr & header)
    {
       tree_algorithms::init_header(header);
       NodeTraits::set_balance(header, NodeTraits::zero());
@@ -346,7 +345,7 @@
    //! <b>Complexity</b>: Amortized constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr erase(node_ptr header, node_ptr z)
+ static node_ptr erase(const node_ptr & header, const node_ptr & z)
    {
       typename tree_algorithms::data_for_rebalance info;
       tree_algorithms::erase(header, z, avltree_erase_fixup(), info);
@@ -363,13 +362,13 @@
    //! take a node_ptr and shouldn't throw.
    //!
    //! <b>Effects</b>: First empties target tree calling
- //! <tt>void disposer::operator()(node_ptr)</tt> for every node of the tree
+ //! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
    //! except the header.
    //!
    //! Then, duplicates the entire tree pointed by "source_header" cloning each
- //! source node with <tt>node_ptr Cloner::operator()(node_ptr)</tt> to obtain
+ //! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
    //! the nodes of the target tree. If "cloner" throws, the cloned target nodes
- //! are disposed using <tt>void disposer(node_ptr)</tt>.
+ //! are disposed using <tt>void disposer(const node_ptr &)</tt>.
    //!
    //! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
    //! number of elements of tree target tree when calling this function.
@@ -377,7 +376,7 @@
    //! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
    template <class Cloner, class Disposer>
    static void clone
- (const_node_ptr source_header, node_ptr target_header, Cloner cloner, Disposer disposer)
+ (const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer)
    {
       avltree_node_cloner<Cloner> new_cloner(cloner);
       tree_algorithms::clone(source_header, target_header, new_cloner, disposer);
@@ -387,7 +386,7 @@
    //! taking a node_ptr parameter and shouldn't throw.
    //!
    //! <b>Effects</b>: Empties the target tree calling
- //! <tt>void disposer::operator()(node_ptr)</tt> for every node of the tree
+ //! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
    //! except the header.
    //!
    //! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
@@ -395,7 +394,7 @@
    //!
    //! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
    template<class Disposer>
- static void clear_and_dispose(node_ptr header, Disposer disposer)
+ static void clear_and_dispose(const node_ptr & header, Disposer disposer)
    { tree_algorithms::clear_and_dispose(header, disposer); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -412,7 +411,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr lower_bound
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    { return tree_algorithms::lower_bound(header, key, comp); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -428,7 +427,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr upper_bound
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    { return tree_algorithms::upper_bound(header, key, comp); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -444,7 +443,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr find
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    { return tree_algorithms::find(header, key, comp); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -462,7 +461,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static std::pair<node_ptr, node_ptr> equal_range
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    { return tree_algorithms::equal_range(header, key, comp); }
 
    //! <b>Requires</b>: "h" must be the header node of a tree.
@@ -479,7 +478,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class NodePtrCompare>
    static node_ptr insert_equal_upper_bound
- (node_ptr h, node_ptr new_node, NodePtrCompare comp)
+ (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp)
    {
       tree_algorithms::insert_equal_upper_bound(h, new_node, comp);
       rebalance_after_insertion(h, new_node);
@@ -500,7 +499,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class NodePtrCompare>
    static node_ptr insert_equal_lower_bound
- (node_ptr h, node_ptr new_node, NodePtrCompare comp)
+ (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp)
    {
       tree_algorithms::insert_equal_lower_bound(h, new_node, comp);
       rebalance_after_insertion(h, new_node);
@@ -523,7 +522,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class NodePtrCompare>
    static node_ptr insert_equal
- (node_ptr header, node_ptr hint, node_ptr new_node, NodePtrCompare comp)
+ (const node_ptr & header, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp)
    {
       tree_algorithms::insert_equal(header, hint, new_node, comp);
       rebalance_after_insertion(header, new_node);
@@ -545,7 +544,7 @@
    //! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
    //! tree invariants might be broken.
    static node_ptr insert_before
- (node_ptr header, node_ptr pos, node_ptr new_node)
+ (const node_ptr & header, const node_ptr & pos, const node_ptr & new_node)
    {
       tree_algorithms::insert_before(header, pos, new_node);
       rebalance_after_insertion(header, new_node);
@@ -565,7 +564,7 @@
    //! <b>Note</b>: If "new_node" is less than the greatest inserted key
    //! tree invariants are broken. This function is slightly faster than
    //! using "insert_before".
- static void push_back(node_ptr header, node_ptr new_node)
+ static void push_back(const node_ptr & header, const node_ptr & new_node)
    {
       tree_algorithms::push_back(header, new_node);
       rebalance_after_insertion(header, new_node);
@@ -584,7 +583,7 @@
    //! <b>Note</b>: If "new_node" is greater than the lowest inserted key
    //! tree invariants are broken. This function is slightly faster than
    //! using "insert_before".
- static void push_front(node_ptr header, node_ptr new_node)
+ static void push_front(const node_ptr & header, const node_ptr & new_node)
    {
       tree_algorithms::push_front(header, new_node);
       rebalance_after_insertion(header, new_node);
@@ -626,7 +625,7 @@
    //! if no more objects are inserted or erased from the set.
    template<class KeyType, class KeyNodePtrCompare>
    static std::pair<node_ptr, bool> insert_unique_check
- (const_node_ptr header, const KeyType &key
+ (const const_node_ptr & header, const KeyType &key
       ,KeyNodePtrCompare comp, insert_commit_data &commit_data)
    { return tree_algorithms::insert_unique_check(header, key, comp, commit_data); }
 
@@ -671,7 +670,7 @@
    //! if no more objects are inserted or erased from the set.
    template<class KeyType, class KeyNodePtrCompare>
    static std::pair<node_ptr, bool> insert_unique_check
- (const_node_ptr header, node_ptr hint, const KeyType &key
+ (const const_node_ptr & header, const node_ptr &hint, const KeyType &key
       ,KeyNodePtrCompare comp, insert_commit_data &commit_data)
    { return tree_algorithms::insert_unique_check(header, hint, key, comp, commit_data); }
 
@@ -693,7 +692,7 @@
    //! previously executed to fill "commit_data". No value should be inserted or
    //! erased between the "insert_check" and "insert_commit" calls.
    static void insert_unique_commit
- (node_ptr header, node_ptr new_value, const insert_commit_data &commit_data)
+ (const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data)
    {
       tree_algorithms::insert_unique_commit(header, new_value, commit_data);
       rebalance_after_insertion(header, new_value);
@@ -706,7 +705,7 @@
    //! <b>Complexity</b>: Logarithmic.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr get_header(node_ptr n)
+ static node_ptr get_header(const node_ptr & n)
    { return tree_algorithms::get_header(n); }
 
    /// @cond
@@ -719,11 +718,12 @@
    //! <b>Complexity</b>: Constant.
    //!
    //! <b>Throws</b>: Nothing.
- static bool is_header(const_node_ptr p)
+ static bool is_header(const const_node_ptr & p)
    { return NodeTraits::get_balance(p) == NodeTraits::zero() && tree_algorithms::is_header(p); }
 
- static void rebalance_after_erasure(node_ptr header, node_ptr x, node_ptr x_parent)
+ static void rebalance_after_erasure(const node_ptr & header, const node_ptr & xnode, const node_ptr & xnode_parent)
    {
+ node_ptr x(xnode), x_parent(xnode_parent);
       for (node_ptr root = NodeTraits::get_parent(header); x != root; root = NodeTraits::get_parent(header)) {
          const balance x_parent_balance = NodeTraits::get_balance(x_parent);
          if(x_parent_balance == NodeTraits::zero()){
@@ -797,10 +797,10 @@
       }
    }
 
- static void rebalance_after_insertion(node_ptr header, node_ptr x)
+ static void rebalance_after_insertion(const node_ptr & header, const node_ptr & xnode)
    {
+ node_ptr x(xnode);
       NodeTraits::set_balance(x, NodeTraits::zero());
-
       // Rebalance.
       for(node_ptr root = NodeTraits::get_parent(header); x != root; root = NodeTraits::get_parent(header)){
          const balance x_parent_balance = NodeTraits::get_balance(NodeTraits::get_parent(x));
@@ -843,7 +843,7 @@
       }
    }
 
- static void left_right_balancing(node_ptr a, node_ptr b, node_ptr c)
+ static void left_right_balancing(const node_ptr & a, const node_ptr & b, const node_ptr & c)
    {
       // balancing...
       const balance c_balance = NodeTraits::get_balance(c);
@@ -866,7 +866,7 @@
       }
    }
 
- static void rotate_left_right(const node_ptr a, node_ptr hdr)
+ static void rotate_left_right(const node_ptr a, const node_ptr & hdr)
    {
       // | | //
       // a(-2) c //
@@ -883,7 +883,7 @@
       left_right_balancing(a, b, c);
    }
 
- static void rotate_right_left(const node_ptr a, node_ptr hdr)
+ static void rotate_right_left(const node_ptr a, const node_ptr & hdr)
    {
       // | | //
       // a(pos) c //
@@ -900,7 +900,7 @@
       left_right_balancing(b, a, c);
    }
 
- static void rotate_left(const node_ptr x, node_ptr hdr)
+ static void rotate_left(const node_ptr x, const node_ptr & hdr)
    {
       const node_ptr y = NodeTraits::get_right(x);
       tree_algorithms::rotate_left(x, hdr);
@@ -916,7 +916,7 @@
       }
    }
 
- static void rotate_right(const node_ptr x, node_ptr hdr)
+ static void rotate_right(const node_ptr x, const node_ptr & hdr)
    {
       const node_ptr y = NodeTraits::get_left(x);
       tree_algorithms::rotate_right(x, hdr);

Modified: trunk/boost/intrusive/circular_list_algorithms.hpp
==============================================================================
--- trunk/boost/intrusive/circular_list_algorithms.hpp (original)
+++ trunk/boost/intrusive/circular_list_algorithms.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -61,10 +61,10 @@
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static void init(node_ptr this_node)
+ static void init(const node_ptr &this_node)
    {
- NodeTraits::set_next(this_node, node_ptr(0));
- NodeTraits::set_previous(this_node, node_ptr(0));
+ NodeTraits::set_next(this_node, node_ptr());
+ NodeTraits::set_previous(this_node, node_ptr());
    }
 
    //! <b>Effects</b>: Returns true is "this_node" is in a non-used state
@@ -73,7 +73,7 @@
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static bool inited(const_node_ptr this_node)
+ static bool inited(const const_node_ptr &this_node)
    { return !NodeTraits::get_next(this_node); }
 
    //! <b>Effects</b>: Constructs an empty list, making this_node the only
@@ -84,7 +84,7 @@
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static void init_header(node_ptr this_node)
+ static void init_header(const node_ptr &this_node)
    {
       NodeTraits::set_next(this_node, this_node);
       NodeTraits::set_previous(this_node, this_node);
@@ -99,7 +99,7 @@
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static bool unique(const_node_ptr this_node)
+ static bool unique(const const_node_ptr &this_node)
    {
       node_ptr next = NodeTraits::get_next(this_node);
       return !next || next == this_node;
@@ -113,7 +113,7 @@
    //! <b>Complexity</b>: Linear
    //!
    //! <b>Throws</b>: Nothing.
- static std::size_t count(const_node_ptr this_node)
+ static std::size_t count(const const_node_ptr &this_node)
    {
       std::size_t result = 0;
       const_node_ptr p = this_node;
@@ -131,10 +131,10 @@
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr unlink(node_ptr this_node)
+ static node_ptr unlink(const node_ptr &this_node)
    {
- if(NodeTraits::get_next(this_node)){
- node_ptr next(NodeTraits::get_next(this_node));
+ node_ptr next(NodeTraits::get_next(this_node));
+ if(next){
          node_ptr prev(NodeTraits::get_previous(this_node));
          NodeTraits::set_next(prev, next);
          NodeTraits::set_previous(next, prev);
@@ -152,7 +152,7 @@
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static void unlink(node_ptr b, node_ptr e)
+ static void unlink(const node_ptr &b, const node_ptr &e)
    {
       if (b != e) {
          node_ptr prevb(NodeTraits::get_previous(b));
@@ -168,13 +168,16 @@
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static void link_before(node_ptr nxt_node, node_ptr this_node)
+ static void link_before(const node_ptr &nxt_node, const node_ptr &this_node)
    {
       node_ptr prev(NodeTraits::get_previous(nxt_node));
       NodeTraits::set_previous(this_node, prev);
- NodeTraits::set_next(prev, this_node);
- NodeTraits::set_previous(nxt_node, this_node);
       NodeTraits::set_next(this_node, nxt_node);
+ //nxt_node might be an alias for prev->next_
+ //so use it before update it before NodeTraits::set_next(prev, ...)
+ //is called and the reference changes it's value
+ NodeTraits::set_previous(nxt_node, this_node);
+ NodeTraits::set_next(prev, this_node);
    }
 
    //! <b>Requires</b>: prev_node must be a node of a circular list.
@@ -184,13 +187,16 @@
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static void link_after(node_ptr prev_node, node_ptr this_node)
+ static void link_after(const node_ptr &prev_node, const node_ptr &this_node)
    {
       node_ptr next(NodeTraits::get_next(prev_node));
       NodeTraits::set_previous(this_node, prev_node);
       NodeTraits::set_next(this_node, next);
- NodeTraits::set_previous(next, this_node);
+ //prev_node might be an alias for next->next_
+ //so use it before update it before NodeTraits::set_previous(next, ...)
+ //is called and the reference changes it's value
       NodeTraits::set_next(prev_node, this_node);
+ NodeTraits::set_previous(next, this_node);
    }
 
    //! <b>Requires</b>: this_node and other_node must be nodes inserted
@@ -204,7 +210,7 @@
    //!
    //! <b>Throws</b>: Nothing.
 /*
- static void swap_nodes(node_ptr this_node, node_ptr other_node)
+ static void swap_nodes(const node_ptr &this_node, const node_ptr &other_node)
    {
 
       if (other_node == this_node)
@@ -243,13 +249,13 @@
 
    //Watanabe version
    private:
- static void swap_prev(node_ptr this_node, node_ptr other_node)
+ static void swap_prev(const node_ptr &this_node, const node_ptr &other_node)
    {
       node_ptr temp(NodeTraits::get_previous(this_node));
       NodeTraits::set_previous(this_node, NodeTraits::get_previous(other_node));
       NodeTraits::set_previous(other_node, temp);
    }
- static void swap_next(node_ptr this_node, node_ptr other_node)
+ static void swap_next(const node_ptr &this_node, const node_ptr &other_node)
    {
       node_ptr temp(NodeTraits::get_next(this_node));
       NodeTraits::set_next(this_node, NodeTraits::get_next(other_node));
@@ -257,7 +263,7 @@
    }
 
    public:
- static void swap_nodes(node_ptr this_node, node_ptr other_node)
+ static void swap_nodes(const node_ptr &this_node, const node_ptr &other_node)
    {
       if (other_node == this_node)
          return;
@@ -298,7 +304,7 @@
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static void transfer(node_ptr p, node_ptr b, node_ptr e)
+ static void transfer(const node_ptr &p, const node_ptr &b, const node_ptr &e)
    {
       if (b != e) {
          node_ptr prev_p(NodeTraits::get_previous(p));
@@ -323,7 +329,7 @@
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static void transfer(node_ptr p, node_ptr i)
+ static void transfer(const node_ptr &p, const node_ptr &i)
    {
       node_ptr n(NodeTraits::get_next(i));
       if(n != p && i != p){
@@ -344,7 +350,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: This function is linear time.
- static void reverse(node_ptr p)
+ static void reverse(const node_ptr &p)
    {
       node_ptr f(NodeTraits::get_next(p));
       node_ptr i(NodeTraits::get_next(f)), e(p);
@@ -362,7 +368,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Linear to the number of moved positions.
- static void move_backwards(node_ptr p, std::size_t n)
+ static void move_backwards(const node_ptr &p, std::size_t n)
    {
       //Null shift, nothing to do
       if(!n) return;
@@ -382,7 +388,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Linear to the number of moved positions.
- static void move_forward(node_ptr p, std::size_t n)
+ static void move_forward(const node_ptr &p, std::size_t n)
    {
       //Null shift, nothing to do
       if(!n) return;

Modified: trunk/boost/intrusive/circular_slist_algorithms.hpp
==============================================================================
--- trunk/boost/intrusive/circular_slist_algorithms.hpp (original)
+++ trunk/boost/intrusive/circular_slist_algorithms.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -63,7 +63,7 @@
 
    //! <b>Effects</b>: Constructs an non-used list element, putting the next
    //! pointer to null:
- //! <tt>NodeTraits::get_next(this_node) == 0</tt>
+ //! <tt>NodeTraits::get_next(this_node) == node_ptr()</tt>
    //!
    //! <b>Complexity</b>: Constant
    //!
@@ -137,7 +137,7 @@
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static void init_header(node_ptr this_node)
+ static void init_header(const node_ptr &this_node)
    { NodeTraits::set_next(this_node, this_node); }
 
    //! <b>Requires</b>: this_node and prev_init_node must be in the same circular list.
@@ -149,7 +149,7 @@
    //! <b>Complexity</b>: Linear to the number of elements between prev_init_node and this_node.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr get_previous_node(node_ptr prev_init_node, node_ptr this_node)
+ static node_ptr get_previous_node(const node_ptr &prev_init_node, const node_ptr &this_node)
    { return base_t::get_previous_node(prev_init_node, this_node); }
 
    //! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
@@ -159,7 +159,7 @@
    //! <b>Complexity</b>: Linear to the number of elements in the circular list.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr get_previous_node(node_ptr this_node)
+ static node_ptr get_previous_node(const node_ptr & this_node)
    { return base_t::get_previous_node(this_node, this_node); }
 
    //! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
@@ -169,7 +169,7 @@
    //! <b>Complexity</b>: Linear to the number of elements in the circular list.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr get_previous_previous_node(node_ptr this_node)
+ static node_ptr get_previous_previous_node(const node_ptr & this_node)
    { return get_previous_previous_node(this_node, this_node); }
 
    //! <b>Requires</b>: this_node and prev_prev_init_node must be in the same circular list.
@@ -181,7 +181,7 @@
    //! <b>Complexity</b>: Linear to the number of elements in the circular list.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr get_previous_previous_node(node_ptr prev_prev_init_node, node_ptr this_node)
+ static node_ptr get_previous_previous_node(const node_ptr & prev_prev_init_node, const node_ptr & this_node)
    {
       node_ptr p = prev_prev_init_node;
       node_ptr p_next = NodeTraits::get_next(p);
@@ -202,7 +202,7 @@
    //! <b>Complexity</b>: Linear
    //!
    //! <b>Throws</b>: Nothing.
- static std::size_t count(const_node_ptr this_node)
+ static std::size_t count(const const_node_ptr & this_node)
    {
       std::size_t result = 0;
       const_node_ptr p = this_node;
@@ -220,7 +220,7 @@
    //! <b>Complexity</b>: Linear to the number of elements in the circular list
    //!
    //! <b>Throws</b>: Nothing.
- static void unlink(node_ptr this_node)
+ static void unlink(const node_ptr & this_node)
    {
       if(NodeTraits::get_next(this_node))
          base_t::unlink_after(get_previous_node(this_node));
@@ -233,7 +233,7 @@
    //! <b>Complexity</b>: Linear to the number of elements in the circular list.
    //!
    //! <b>Throws</b>: Nothing.
- static void link_before (node_ptr nxt_node, node_ptr this_node)
+ static void link_before (const node_ptr & nxt_node, const node_ptr & this_node)
    { base_t::link_after(get_previous_node(nxt_node), this_node); }
 
    //! <b>Requires</b>: this_node and other_node must be nodes inserted
@@ -246,7 +246,7 @@
    //! <b>Complexity</b>: Linear to number of elements of both lists
    //!
    //! <b>Throws</b>: Nothing.
- static void swap_nodes(node_ptr this_node, node_ptr other_node)
+ static void swap_nodes(const node_ptr & this_node, const node_ptr & other_node)
    {
       if (other_node == this_node)
          return;
@@ -284,7 +284,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: This function is linear to the contained elements.
- static void reverse(node_ptr p)
+ static void reverse(const node_ptr & p)
    {
       node_ptr i = NodeTraits::get_next(p), e(p);
       for (;;) {
@@ -303,18 +303,18 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Linear to the number of elements plus the number moved positions.
- static node_ptr move_backwards(node_ptr p, std::size_t n)
+ static node_ptr move_backwards(const node_ptr & p, std::size_t n)
    {
       //Null shift, nothing to do
- if(!n) return node_ptr(0);
+ if(!n) return node_ptr();
       node_ptr first = NodeTraits::get_next(p);
 
       //count() == 1 or 2, nothing to do
       if(NodeTraits::get_next(first) == p)
- return node_ptr(0);
+ return node_ptr();
 
       bool end_found = false;
- node_ptr new_last(0);
+ node_ptr new_last = node_ptr();
 
       //Now find the new last node according to the shift count.
       //If we find p before finding the new last node
@@ -327,7 +327,7 @@
             //Shortcut the shift with the modulo of the size of the list
             n %= i;
             if(!n)
- return node_ptr(0);
+ return node_ptr();
             i = 0;
             //Unlink p and continue the new first node search
             first = NodeTraits::get_next(p);
@@ -355,14 +355,14 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Linear to the number of elements plus the number moved positions.
- static node_ptr move_forward(node_ptr p, std::size_t n)
+ static node_ptr move_forward(const node_ptr & p, std::size_t n)
    {
       //Null shift, nothing to do
- if(!n) return node_ptr(0);
+ if(!n) return node_ptr();
       node_ptr first = node_traits::get_next(p);
 
       //count() == 1 or 2, nothing to do
- if(node_traits::get_next(first) == p) return node_ptr(0);
+ if(node_traits::get_next(first) == p) return node_ptr();
 
       //Iterate until p is found to know where the current last node is.
       //If the shift count is less than the size of the list, we can also obtain
@@ -381,7 +381,7 @@
          //Shortcut the shift with the modulo of the size of the list
          std::size_t new_before_last_pos = (distance - (n % distance))% distance;
          //If the shift is a multiple of the size there is nothing to do
- if(!new_before_last_pos) return node_ptr(0);
+ if(!new_before_last_pos) return node_ptr();
          
          for( new_last = p
             ; new_before_last_pos--

Modified: trunk/boost/intrusive/derivation_value_traits.hpp
==============================================================================
--- trunk/boost/intrusive/derivation_value_traits.hpp (original)
+++ trunk/boost/intrusive/derivation_value_traits.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -34,8 +34,10 @@
    typedef typename node_traits::const_node_ptr const_node_ptr;
    typedef typename boost::pointer_to_other<node_ptr, T>::type pointer;
    typedef typename boost::pointer_to_other<node_ptr, const T>::type const_pointer;
- typedef typename std::iterator_traits<pointer>::reference reference;
- typedef typename std::iterator_traits<const_pointer>::reference const_reference;
+ typedef typename boost::intrusive::
+ pointer_traits<pointer>::reference reference;
+ typedef typename boost::intrusive::
+ pointer_traits<const_pointer>::reference const_reference;
    static const link_mode_type link_mode = LinkMode;
 
    static node_ptr to_node_ptr(reference value)
@@ -44,7 +46,7 @@
    static const_node_ptr to_node_ptr(const_reference value)
    { return node_ptr(&value); }
 
- static pointer to_value_ptr(node_ptr n)
+ static pointer to_value_ptr(const node_ptr &n)
    {
 // This still fails in gcc < 4.4 so forget about it
 // using ::boost::static_pointer_cast;
@@ -52,7 +54,7 @@
       return pointer(&static_cast<value_type&>(*n));
    }
 
- static const_pointer to_value_ptr(const_node_ptr n)
+ static const_pointer to_value_ptr(const const_node_ptr &n)
    {
 // This still fails in gcc < 4.4 so forget about it
 // using ::boost::static_pointer_cast;

Modified: trunk/boost/intrusive/detail/any_node_and_algorithms.hpp
==============================================================================
--- trunk/boost/intrusive/detail/any_node_and_algorithms.hpp (original)
+++ trunk/boost/intrusive/detail/any_node_and_algorithms.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -16,7 +16,7 @@
 #include <boost/intrusive/detail/config_begin.hpp>
 #include <iterator>
 #include <boost/intrusive/detail/assert.hpp>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <cstddef>
 #include <boost/intrusive/detail/mpl.hpp>
 #include <boost/pointer_cast.hpp>
@@ -27,8 +27,8 @@
 template<class VoidPointer>
 struct any_node
 {
- typedef typename boost::pointer_to_other
- <VoidPointer, any_node>::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<any_node>::type node_ptr;
    node_ptr node_ptr_1;
    node_ptr node_ptr_2;
    node_ptr node_ptr_3;
@@ -39,21 +39,21 @@
 struct any_list_node_traits
 {
    typedef any_node<VoidPointer> node;
- typedef typename boost::pointer_to_other
- <VoidPointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <VoidPointer, const node>::type const_node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<node>::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
 
- static node_ptr get_next(const_node_ptr n)
+ static const node_ptr &get_next(const const_node_ptr & n)
    { return n->node_ptr_1; }
 
- static void set_next(node_ptr n, node_ptr next)
+ static void set_next(const node_ptr & n, const node_ptr & next)
    { n->node_ptr_1 = next; }
 
- static node_ptr get_previous(const_node_ptr n)
+ static const node_ptr &get_previous(const const_node_ptr & n)
    { return n->node_ptr_2; }
 
- static void set_previous(node_ptr n, node_ptr prev)
+ static void set_previous(const node_ptr & n, const node_ptr & prev)
    { n->node_ptr_2 = prev; }
 };
 
@@ -62,15 +62,15 @@
 struct any_slist_node_traits
 {
    typedef any_node<VoidPointer> node;
- typedef typename boost::pointer_to_other
- <VoidPointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <VoidPointer, const node>::type const_node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<node>::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
 
- static node_ptr get_next(const_node_ptr n)
+ static const node_ptr &get_next(const const_node_ptr & n)
    { return n->node_ptr_1; }
 
- static void set_next(node_ptr n, node_ptr next)
+ static void set_next(const node_ptr & n, const node_ptr & next)
    { n->node_ptr_1 = next; }
 };
 
@@ -87,25 +87,22 @@
    static const bool store_hash = true;
    static const bool optimize_multikey = true;
 
- static node_ptr get_next(const_node_ptr n)
- {
- using ::boost::static_pointer_cast;
- return static_pointer_cast<node>(n->node_ptr_1);
- }
+ static const node_ptr &get_next(const const_node_ptr & n)
+ { return n->node_ptr_1; }
 
- static void set_next(node_ptr n, node_ptr next)
+ static void set_next(const node_ptr & n, const node_ptr & next)
    { n->node_ptr_1 = next; }
 
- static node_ptr get_prev_in_group(const_node_ptr n)
+ static node_ptr get_prev_in_group(const const_node_ptr & n)
    { return n->node_ptr_2; }
 
- static void set_prev_in_group(node_ptr n, node_ptr prev)
+ static void set_prev_in_group(const node_ptr & n, const node_ptr & prev)
    { n->node_ptr_2 = prev; }
 
- static std::size_t get_hash(const_node_ptr n)
+ static std::size_t get_hash(const const_node_ptr & n)
    { return n->size_t_1; }
 
- static void set_hash(node_ptr n, std::size_t h)
+ static void set_hash(const node_ptr & n, std::size_t h)
    { n->size_t_1 = h; }
 };
 
@@ -115,35 +112,35 @@
 {
    typedef any_node<VoidPointer> node;
 
- typedef typename boost::pointer_to_other
- <VoidPointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <VoidPointer, const node>::type const_node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<node>::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
 
    typedef std::size_t color;
 
- static node_ptr get_parent(const_node_ptr n)
+ static const node_ptr &get_parent(const const_node_ptr & n)
    { return n->node_ptr_1; }
 
- static void set_parent(node_ptr n, node_ptr p)
+ static void set_parent(const node_ptr & n, const node_ptr & p)
    { n->node_ptr_1 = p; }
 
- static node_ptr get_left(const_node_ptr n)
+ static const node_ptr &get_left(const const_node_ptr & n)
    { return n->node_ptr_2; }
 
- static void set_left(node_ptr n, node_ptr l)
+ static void set_left(const node_ptr & n, const node_ptr & l)
    { n->node_ptr_2 = l; }
 
- static node_ptr get_right(const_node_ptr n)
+ static const node_ptr &get_right(const const_node_ptr & n)
    { return n->node_ptr_3; }
 
- static void set_right(node_ptr n, node_ptr r)
+ static void set_right(const node_ptr & n, const node_ptr & r)
    { n->node_ptr_3 = r; }
 
- static color get_color(const_node_ptr n)
+ static color get_color(const const_node_ptr & n)
    { return n->size_t_1; }
 
- static void set_color(node_ptr n, color c)
+ static void set_color(const node_ptr & n, color c)
    { n->size_t_1 = c; }
 
    static color black()
@@ -159,34 +156,34 @@
 {
    typedef any_node<VoidPointer> node;
 
- typedef typename boost::pointer_to_other
- <VoidPointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <VoidPointer, const node>::type const_node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<node>::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
    typedef std::size_t balance;
 
- static node_ptr get_parent(const_node_ptr n)
+ static const node_ptr &get_parent(const const_node_ptr & n)
    { return n->node_ptr_1; }
 
- static void set_parent(node_ptr n, node_ptr p)
+ static void set_parent(const node_ptr & n, const node_ptr & p)
    { n->node_ptr_1 = p; }
 
- static node_ptr get_left(const_node_ptr n)
+ static const node_ptr &get_left(const const_node_ptr & n)
    { return n->node_ptr_2; }
 
- static void set_left(node_ptr n, node_ptr l)
+ static void set_left(const node_ptr & n, const node_ptr & l)
    { n->node_ptr_2 = l; }
 
- static node_ptr get_right(const_node_ptr n)
+ static const node_ptr &get_right(const const_node_ptr & n)
    { return n->node_ptr_3; }
 
- static void set_right(node_ptr n, node_ptr r)
+ static void set_right(const node_ptr & n, const node_ptr & r)
    { n->node_ptr_3 = r; }
 
- static balance get_balance(const_node_ptr n)
+ static balance get_balance(const const_node_ptr & n)
    { return n->size_t_1; }
 
- static void set_balance(node_ptr n, balance b)
+ static void set_balance(const node_ptr & n, balance b)
    { n->size_t_1 = b; }
 
    static balance negative()
@@ -205,27 +202,27 @@
 {
    typedef any_node<VoidPointer> node;
 
- typedef typename boost::pointer_to_other
- <VoidPointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <VoidPointer, const node>::type const_node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<node>::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
 
- static node_ptr get_parent(const_node_ptr n)
+ static const node_ptr &get_parent(const const_node_ptr & n)
    { return n->node_ptr_1; }
 
- static void set_parent(node_ptr n, node_ptr p)
+ static void set_parent(const node_ptr & n, const node_ptr & p)
    { n->node_ptr_1 = p; }
 
- static node_ptr get_left(const_node_ptr n)
+ static const node_ptr &get_left(const const_node_ptr & n)
    { return n->node_ptr_2; }
 
- static void set_left(node_ptr n, node_ptr l)
+ static void set_left(const node_ptr & n, const node_ptr & l)
    { n->node_ptr_2 = l; }
 
- static node_ptr get_right(const_node_ptr n)
+ static const node_ptr &get_right(const const_node_ptr & n)
    { return n->node_ptr_3; }
 
- static void set_right(node_ptr n, node_ptr r)
+ static void set_right(const node_ptr & n, const node_ptr & r)
    { n->node_ptr_3 = r; }
 };
 
@@ -234,10 +231,10 @@
 {
    public:
    typedef any_node<VoidPointer> node;
- typedef typename boost::pointer_to_other
- <VoidPointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <VoidPointer, const node>::type const_node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<node>::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
 };
 
 template<class VoidPointer>
@@ -249,10 +246,10 @@
 
    public:
    typedef any_node<VoidPointer> node;
- typedef typename boost::pointer_to_other
- <VoidPointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <VoidPointer, const node>::type const_node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<node>::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
    typedef any_node_traits<VoidPointer> node_traits;
 
    //! <b>Requires</b>: node must not be part of any tree.
@@ -264,7 +261,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
- static void init(node_ptr node)
+ static void init(const node_ptr & node)
    { node->node_ptr_1 = 0; };
 
    //! <b>Effects</b>: Returns true if node is in the same state as if called init(node)
@@ -272,19 +269,19 @@
    //! <b>Complexity</b>: Constant.
    //!
    //! <b>Throws</b>: Nothing.
- static bool inited(const_node_ptr node)
+ static bool inited(const const_node_ptr & node)
    { return !node->node_ptr_1; };
 
- static bool unique(const_node_ptr node)
+ static bool unique(const const_node_ptr & node)
    { return 0 == node->node_ptr_1; }
 
- static void unlink(node_ptr)
+ static void unlink(const node_ptr &)
    {
       //Auto-unlink hooks and unlink() are not available for any hooks
       any_algorithms<VoidPointer>::template function_not_available_for_any_hooks<node_ptr>();
    }
 
- static void swap_nodes(node_ptr l, node_ptr r)
+ static void swap_nodes(const node_ptr & l, const node_ptr & r)
    {
       //Any nodes have no swap_nodes capability because they don't know
       //what algorithm they must use to unlink the node from the container

Modified: trunk/boost/intrusive/detail/avltree_node.hpp
==============================================================================
--- trunk/boost/intrusive/detail/avltree_node.hpp (original)
+++ trunk/boost/intrusive/detail/avltree_node.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -15,7 +15,7 @@
 
 #include <boost/intrusive/detail/config_begin.hpp>
 #include <iterator>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/avltree_algorithms.hpp>
 #include <boost/intrusive/pointer_plus_bits.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
@@ -33,9 +33,9 @@
 template<class VoidPointer>
 struct compact_avltree_node
 {
- typedef typename pointer_to_other
- <VoidPointer
- ,compact_avltree_node<VoidPointer> >::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer
+ <compact_avltree_node<VoidPointer> >::type node_ptr;
    enum balance { negative_t, zero_t, positive_t };
    node_ptr parent_, left_, right_;
 };
@@ -44,9 +44,9 @@
 template<class VoidPointer>
 struct avltree_node
 {
- typedef typename pointer_to_other
- <VoidPointer
- ,avltree_node<VoidPointer> >::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer
+ <avltree_node<VoidPointer> >::type node_ptr;
    enum balance { negative_t, zero_t, positive_t };
    node_ptr parent_, left_, right_;
    balance balance_;
@@ -59,34 +59,37 @@
 {
    typedef avltree_node<VoidPointer> node;
 
- typedef typename boost::pointer_to_other
- <VoidPointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <VoidPointer, const node>::type const_node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer
+ <node>::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer
+ <const node>::type const_node_ptr;
+
    typedef typename node::balance balance;
 
- static node_ptr get_parent(const_node_ptr n)
+ static const node_ptr & get_parent(const const_node_ptr & n)
    { return n->parent_; }
 
- static void set_parent(node_ptr n, node_ptr p)
+ static void set_parent(const node_ptr & n, const node_ptr & p)
    { n->parent_ = p; }
 
- static node_ptr get_left(const_node_ptr n)
+ static const node_ptr & get_left(const const_node_ptr & n)
    { return n->left_; }
 
- static void set_left(node_ptr n, node_ptr l)
+ static void set_left(const node_ptr & n, const node_ptr & l)
    { n->left_ = l; }
 
- static node_ptr get_right(const_node_ptr n)
+ static const node_ptr & get_right(const const_node_ptr & n)
    { return n->right_; }
 
- static void set_right(node_ptr n, node_ptr r)
+ static void set_right(const node_ptr & n, const node_ptr & r)
    { n->right_ = r; }
 
- static balance get_balance(const_node_ptr n)
+ static balance get_balance(const const_node_ptr & n)
    { return n->balance_; }
 
- static void set_balance(node_ptr n, balance b)
+ static void set_balance(const node_ptr & n, balance b)
    { n->balance_ = b; }
 
    static balance negative()
@@ -105,36 +108,39 @@
 struct compact_avltree_node_traits_impl
 {
    typedef compact_avltree_node<VoidPointer> node;
- typedef typename boost::pointer_to_other
- <VoidPointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <VoidPointer, const node>::type const_node_ptr;
+
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer
+ <node>::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer
+ <const node>::type const_node_ptr;
    typedef typename node::balance balance;
 
    typedef pointer_plus_bits<node_ptr, 2> ptr_bit;
 
- static node_ptr get_parent(const_node_ptr n)
+ static node_ptr get_parent(const const_node_ptr & n)
    { return ptr_bit::get_pointer(n->parent_); }
 
- static void set_parent(node_ptr n, node_ptr p)
+ static void set_parent(const node_ptr & n, const node_ptr & p)
    { ptr_bit::set_pointer(n->parent_, p); }
 
- static node_ptr get_left(const_node_ptr n)
+ static const node_ptr & get_left(const const_node_ptr & n)
    { return n->left_; }
 
- static void set_left(node_ptr n, node_ptr l)
+ static void set_left(const node_ptr & n, const node_ptr & l)
    { n->left_ = l; }
 
- static node_ptr get_right(const_node_ptr n)
+ static const node_ptr & get_right(const const_node_ptr & n)
    { return n->right_; }
 
- static void set_right(node_ptr n, node_ptr r)
+ static void set_right(const node_ptr & n, const node_ptr & r)
    { n->right_ = r; }
 
- static balance get_balance(const_node_ptr n)
+ static balance get_balance(const const_node_ptr & n)
    { return (balance)ptr_bit::get_bits(n->parent_); }
 
- static void set_balance(node_ptr n, balance b)
+ static void set_balance(const node_ptr & n, balance b)
    { ptr_bit::set_bits(n->parent_, (std::size_t)b); }
 
    static balance negative()

Modified: trunk/boost/intrusive/detail/common_slist_algorithms.hpp
==============================================================================
--- trunk/boost/intrusive/detail/common_slist_algorithms.hpp (original)
+++ trunk/boost/intrusive/detail/common_slist_algorithms.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -31,7 +31,7 @@
    typedef typename NodeTraits::const_node_ptr const_node_ptr;
    typedef NodeTraits node_traits;
 
- static node_ptr get_previous_node(node_ptr prev_init_node, node_ptr this_node)
+ static node_ptr get_previous_node(const node_ptr & prev_init_node, const node_ptr & this_node)
    {
       node_ptr p = prev_init_node;
       for( node_ptr p_next
@@ -44,44 +44,44 @@
       return p;
    }
 
- static void init_header(node_ptr this_node)
+ static void init_header(const node_ptr & this_node)
    { NodeTraits::set_next(this_node, this_node); }
 
- static void init(node_ptr this_node)
- { NodeTraits::set_next(this_node, node_ptr(0)); }
+ static void init(const node_ptr & this_node)
+ { NodeTraits::set_next(this_node, node_ptr()); }
 
- static bool unique(const_node_ptr this_node)
+ static bool unique(const const_node_ptr & this_node)
    {
       node_ptr next = NodeTraits::get_next(this_node);
       return !next || next == this_node;
    }
 
- static bool inited(const_node_ptr this_node)
+ static bool inited(const const_node_ptr & this_node)
    { return !NodeTraits::get_next(this_node); }
 
- static void unlink_after(node_ptr prev_node)
+ static void unlink_after(const node_ptr & prev_node)
    {
- node_ptr this_node(NodeTraits::get_next(prev_node));
+ const_node_ptr this_node(NodeTraits::get_next(prev_node));
       NodeTraits::set_next(prev_node, NodeTraits::get_next(this_node));
    }
 
- static void unlink_after(node_ptr prev_node, node_ptr last_node)
+ static void unlink_after(const node_ptr & prev_node, const node_ptr & last_node)
    { NodeTraits::set_next(prev_node, last_node); }
 
- static void link_after(node_ptr prev_node, node_ptr this_node)
+ static void link_after(const node_ptr & prev_node, const node_ptr & this_node)
    {
       NodeTraits::set_next(this_node, NodeTraits::get_next(prev_node));
       NodeTraits::set_next(prev_node, this_node);
    }
 
- static void incorporate_after(node_ptr bp, node_ptr b, node_ptr be)
+ static void incorporate_after(const node_ptr & bp, const node_ptr & b, const node_ptr & be)
    {
       node_ptr p(NodeTraits::get_next(bp));
       NodeTraits::set_next(bp, b);
       NodeTraits::set_next(be, p);
    }
    
- static void transfer_after(node_ptr bp, node_ptr bb, node_ptr be)
+ static void transfer_after(const node_ptr & bp, const node_ptr & bb, const node_ptr & be)
    {
       if (bp != bb && bp != be && bb != be) {
          node_ptr next_b = NodeTraits::get_next(bb);

Modified: trunk/boost/intrusive/detail/function_detector.hpp
==============================================================================
--- trunk/boost/intrusive/detail/function_detector.hpp (original)
+++ trunk/boost/intrusive/detail/function_detector.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -11,6 +11,7 @@
 /////////////////////////////////////////////////////////////////////////////
 // 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
 //

Modified: trunk/boost/intrusive/detail/generic_hook.hpp
==============================================================================
--- trunk/boost/intrusive/detail/generic_hook.hpp (original)
+++ trunk/boost/intrusive/detail/generic_hook.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -15,10 +15,11 @@
 
 #include <boost/intrusive/detail/config_begin.hpp>
 #include <boost/intrusive/intrusive_fwd.hpp>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/link_mode.hpp>
 #include <boost/intrusive/detail/utilities.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/static_assert.hpp>
 
 namespace boost {
@@ -146,20 +147,26 @@
          (int)link_mode == (int)auto_unlink || (int)link_mode == (int)safe_link;
    };
 
+ node_ptr this_ptr()
+ { return pointer_traits<node_ptr>::pointer_to(static_cast<node&>(*this)); }
+
+ const_node_ptr this_ptr() const
+ { return pointer_traits<const_node_ptr>::pointer_to(static_cast<const node&>(*this)); }
+
    public:
    /// @endcond
 
    generic_hook()
    {
       if(boost_intrusive_tags::safemode_or_autounlink){
- node_algorithms::init(static_cast<node*>(this));
+ node_algorithms::init(this->this_ptr());
       }
    }
 
    generic_hook(const generic_hook& )
    {
       if(boost_intrusive_tags::safemode_or_autounlink){
- node_algorithms::init(static_cast<node*>(this));
+ node_algorithms::init(this->this_ptr());
       }
    }
 
@@ -175,22 +182,21 @@
    void swap_nodes(generic_hook &other)
    {
       node_algorithms::swap_nodes
- ( static_cast<node*>(this), static_cast<node*>(&other));
+ (this->this_ptr(), other.this_ptr());
    }
 
    bool is_linked() const
    {
       //is_linked() can be only used in safe-mode or auto-unlink
       BOOST_STATIC_ASSERT(( boost_intrusive_tags::safemode_or_autounlink ));
- return !node_algorithms::unique
- (static_cast<const node*>(this));
+ return !node_algorithms::unique(this->this_ptr());
    }
 
    void unlink()
    {
       BOOST_STATIC_ASSERT(( (int)boost_intrusive_tags::link_mode == (int)auto_unlink ));
- node_algorithms::unlink(static_cast<node*>(this));
- node_algorithms::init(static_cast<node*>(this));
+ node_algorithms::unlink(this->this_ptr());
+ node_algorithms::init(this->this_ptr());
    }
 };
 

Added: trunk/boost/intrusive/detail/has_member_function_callable_with.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/intrusive/detail/has_member_function_callable_with.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,334 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/intrusive for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+// sample.h
+
+#if !BOOST_PP_IS_ITERATING
+
+ #ifndef BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED
+ #define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED
+
+ #include <boost/intrusive/detail/config_begin.hpp>
+ #include <boost/intrusive/detail/workaround.hpp>
+ #include <boost/intrusive/detail/preprocessor.hpp>
+ #include <boost/static_assert.hpp>
+ #include <boost/move/move.hpp>
+
+ namespace boost_intrusive_has_member_function_callable_with {
+
+ struct dont_care
+ {
+ dont_care(...);
+ };
+
+ struct private_type
+ {
+ static private_type p;
+ private_type const &operator,(int) const;
+ };
+
+ typedef char yes_type; // sizeof(yes_type) == 1
+ struct no_type{ char dummy[2]; }; // sizeof(no_type) == 2
+
+ template<typename T>
+ no_type is_private_type(T const &);
+ yes_type is_private_type(private_type const &);
+
+ } //boost_intrusive_has_member_function_callable_with
+
+ #include <boost/intrusive/detail/config_end.hpp>
+
+ #endif //BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED
+
+#else //!BOOST_PP_IS_ITERATING
+
+ #ifndef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME
+ #error "BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME not defined!"
+ #endif
+
+ #ifndef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN
+ #error "BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN not defined!"
+ #endif
+
+ #ifndef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END
+ #error "BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END not defined!"
+ #endif
+
+ #if BOOST_PP_ITERATION_START() != 0
+ #error "BOOST_PP_ITERATION_START() must be zero (0)"
+ #endif
+
+ #if BOOST_PP_ITERATION() == 0
+
+ BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN
+
+ template <typename Type>
+ class BOOST_PP_CAT(has_member_function_named_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)
+ {
+ struct BaseMixin
+ {
+ void BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME();
+ };
+
+ struct Base : public Type, public BaseMixin { Base(); };
+ template <typename T, T t> class Helper{};
+
+ template <typename U>
+ static boost_intrusive_has_member_function_callable_with::no_type deduce
+ (U*, Helper<void (BaseMixin::*)(), &U::BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME>* = 0);
+ static boost_intrusive_has_member_function_callable_with::yes_type deduce(...);
+
+ public:
+ static const bool value =
+ sizeof(boost_intrusive_has_member_function_callable_with::yes_type) == sizeof(deduce((Base*)(0)));
+ };
+
+ #if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
+
+ template<typename Fun, bool HasFunc
+ BOOST_PP_ENUM_TRAILING(BOOST_PP_ITERATION_FINISH(), BOOST_INTRUSIVE_PP_TEMPLATE_PARAM_VOID_DEFAULT, _)>
+ struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl);
+ //!
+
+ template<typename Fun BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION_FINISH(), class P)>
+ struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl)
+ <Fun, false BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION_FINISH(), P)>
+ {
+ static const bool value = false;
+ };
+ //!
+
+ #if !defined(_MSC_VER) || (_MSC_VER != 1600)
+
+ //Special case for 0 args
+ template< class F
+ , std::size_t N =
+ sizeof((boost::move_detail::declval<F>().
+ BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))>
+ struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)
+ {
+ boost_intrusive_has_member_function_callable_with::yes_type dummy;
+ BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int);
+ };
+
+ //For buggy compilers like MSVC 7.1+ ((F*)0)->func() does not
+ //SFINAE-out the zeroarg_checker_ instantiation but sizeof yields to 0.
+ template<class F>
+ struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<F, 0>
+ {
+ boost_intrusive_has_member_function_callable_with::no_type dummy;
+ BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int);
+ };
+
+ template<typename Fun>
+ struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl)
+ <Fun, true BOOST_PP_ENUM_TRAILING(BOOST_PP_SUB(BOOST_PP_ITERATION_FINISH(), BOOST_PP_ITERATION()), BOOST_INTRUSIVE_PP_IDENTITY, void)>
+ {
+ template<class U>
+ static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>
+ Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>*);
+
+ template <class U>
+ static boost_intrusive_has_member_function_callable_with::no_type Test(...);
+
+ static const bool value = sizeof(Test< Fun >(0))
+ == sizeof(boost_intrusive_has_member_function_callable_with::yes_type);
+ };
+
+ #else //#if !defined(_MSC_VER) || (_MSC_VER != 1600)
+ template<typename Fun>
+ struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl)
+ <Fun, true BOOST_PP_ENUM_TRAILING(BOOST_PP_SUB(BOOST_PP_ITERATION_FINISH(), BOOST_PP_ITERATION()), BOOST_INTRUSIVE_PP_IDENTITY, void)>
+ {
+ template<class U>
+ static decltype( boost::move_detail::declval<Fun>().BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME()
+ , boost_intrusive_has_member_function_callable_with::yes_type())
+ Test(Fun*);
+
+ template<class U>
+ static boost_intrusive_has_member_function_callable_with::no_type Test(...);
+
+ static const bool value = sizeof(Test<Fun>(0))
+ == sizeof(boost_intrusive_has_member_function_callable_with::yes_type);
+ };
+ #endif //#if !defined(_MSC_VER) || (_MSC_VER != 1600)
+
+ #else //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
+
+ template<typename Fun, bool HasFunc, class ...Args>
+ struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl);
+
+ template<typename Fun, class ...Args>
+ struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl)
+ <Fun, false, Args...>
+ {
+ static const bool value = false;
+ };
+
+ //Special case for 0 args
+ template< class F
+ , std::size_t N =
+ sizeof((boost::move_detail::declval<F>().
+ BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))>
+ struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)
+ {
+ boost_intrusive_has_member_function_callable_with::yes_type dummy;
+ BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int);
+ };
+
+ //For buggy compilers like MSVC 7.1+ ((F*)0)->func() does not
+ //SFINAE-out the zeroarg_checker_ instantiation but sizeof yields to 0.
+ template<class F>
+ struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<F, 0>
+ {
+ boost_intrusive_has_member_function_callable_with::no_type dummy;
+ BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int);
+ };
+
+ template<typename Fun>
+ struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl)
+ <Fun, true>
+ {
+ template<class U>
+ static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)
+ <U> Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>*);
+
+ template <class U>
+ static boost_intrusive_has_member_function_callable_with::no_type Test(...);
+
+ static const bool value = sizeof(Test< Fun >(0))
+ == sizeof(boost_intrusive_has_member_function_callable_with::yes_type);
+ };
+
+ template<typename Fun, class ...DontCares>
+ struct BOOST_PP_CAT( funwrap_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )
+ : Fun
+ {
+ BOOST_PP_CAT( funwrap_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )();
+ using Fun::BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME;
+
+ boost_intrusive_has_member_function_callable_with::private_type
+ BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME
+ ( DontCares...) const;
+ };
+
+ template<typename Fun, class ...Args>
+ struct BOOST_PP_CAT( BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl)
+ <Fun, true , Args...>
+ {
+ template<class T>
+ struct make_dontcare
+ {
+ typedef boost_intrusive_has_member_function_callable_with::dont_care type;
+ };
+
+ typedef BOOST_PP_CAT( funwrap_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )
+ <Fun, typename make_dontcare<Args>::type...> FunWrap;
+
+ static bool const value = (sizeof(boost_intrusive_has_member_function_callable_with::no_type) ==
+ sizeof(boost_intrusive_has_member_function_callable_with::is_private_type
+ ( (::boost::move_detail::declval< FunWrap >().
+ BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME
+ ( ::boost::move_detail::declval<Args>()... ), 0) )
+ )
+ );
+ };
+
+ template<typename Fun, class ...Args>
+ struct BOOST_PP_CAT( has_member_function_callable_with_
+ , BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)
+ : public BOOST_PP_CAT( BOOST_PP_CAT(has_member_function_callable_with_
+ , BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl)
+ < Fun
+ , BOOST_PP_CAT( has_member_function_named_
+ , BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )<Fun>::value
+ , Args... >
+ {};
+
+ #endif //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
+
+ BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END
+
+ #else //BOOST_PP_ITERATION() == 0
+
+ #if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
+
+ BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN
+
+ template<typename Fun>
+ struct BOOST_PP_CAT( BOOST_PP_CAT(funwrap, BOOST_PP_ITERATION())
+ , BOOST_PP_CAT(_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME))
+ : Fun
+ {
+ BOOST_PP_CAT( BOOST_PP_CAT(funwrap, BOOST_PP_ITERATION())
+ , BOOST_PP_CAT(_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME))();
+
+ using Fun::BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME;
+ boost_intrusive_has_member_function_callable_with::private_type
+ BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME
+ ( BOOST_PP_ENUM(BOOST_PP_ITERATION()
+ , BOOST_INTRUSIVE_PP_IDENTITY
+ , boost_intrusive_has_member_function_callable_with::dont_care)) const;
+ };
+
+ template<typename Fun BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), class P)>
+ struct BOOST_PP_CAT( BOOST_PP_CAT(has_member_function_callable_with_
+ , BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl)
+ <Fun, true
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), P)
+ BOOST_PP_ENUM_TRAILING( BOOST_PP_SUB(BOOST_PP_ITERATION_FINISH(), BOOST_PP_ITERATION())
+ , BOOST_INTRUSIVE_PP_IDENTITY
+ , void)>
+ {
+ typedef BOOST_PP_CAT( BOOST_PP_CAT(funwrap, BOOST_PP_ITERATION())
+ , BOOST_PP_CAT(_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME))<Fun>
+ FunWrap;
+ static bool const value =
+ (sizeof(boost_intrusive_has_member_function_callable_with::no_type) ==
+ sizeof(boost_intrusive_has_member_function_callable_with::is_private_type
+ ( (boost::move_detail::declval<FunWrap>().
+ BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME
+ ( BOOST_PP_ENUM( BOOST_PP_ITERATION(), BOOST_INTRUSIVE_PP_DECLVAL, _) ), 0
+ )
+ )
+ )
+ );
+ };
+
+ BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END
+ #endif //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
+
+ #endif //BOOST_PP_ITERATION() == 0
+
+ #if BOOST_PP_ITERATION() == BOOST_PP_ITERATION_FINISH()
+
+ #if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
+
+ BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN
+
+ template<typename Fun
+ BOOST_PP_ENUM_TRAILING(BOOST_PP_ITERATION_FINISH(), BOOST_INTRUSIVE_PP_TEMPLATE_PARAM_VOID_DEFAULT, _)>
+ struct BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)
+ : public BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl)
+ <Fun, BOOST_PP_CAT(has_member_function_named_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<Fun>::value
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION_FINISH(), P) >
+ {};
+
+ BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END
+
+ #endif //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
+
+ #undef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME
+ #undef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN
+ #undef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END
+
+ #endif //#if BOOST_PP_ITERATION() == BOOST_PP_ITERATION_FINISH()
+
+#endif //!BOOST_PP_IS_ITERATING

Modified: trunk/boost/intrusive/detail/hashtable_node.hpp
==============================================================================
--- trunk/boost/intrusive/detail/hashtable_node.hpp (original)
+++ trunk/boost/intrusive/detail/hashtable_node.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -16,11 +16,12 @@
 #include <boost/intrusive/detail/config_begin.hpp>
 #include <iterator>
 #include <boost/intrusive/detail/assert.hpp>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/circular_list_algorithms.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
 #include <boost/intrusive/detail/utilities.hpp>
-#include <boost/intrusive/detail/slist_node.hpp> //remove-me
+//#include <boost/intrusive/detail/slist_node.hpp> //remove-me
+#include <boost/intrusive/pointer_traits.hpp>
 #include <cstddef>
 #include <boost/pointer_cast.hpp>
 #include <boost/move/move.hpp>
@@ -84,8 +85,10 @@
 
    public:
    /// @cond
- typedef typename boost::pointer_to_other
- < typename Slist::pointer, bucket_impl<Slist> >::type bucket_ptr;
+
+ typedef typename pointer_traits
+ <typename Slist::pointer>::template rebind_pointer
+ < bucket_impl<Slist> >::type bucket_ptr;
    typedef typename Slist::size_type size_type;
    /// @endcond
 
@@ -93,14 +96,19 @@
       : buckets_(buckets), buckets_len_(len)
    {}
 
+ bucket_traits_impl(const bucket_traits_impl &x)
+ : buckets_(x.buckets_), buckets_len_(x.buckets_len_)
+ {}
+
+
    bucket_traits_impl(BOOST_RV_REF(bucket_traits_impl) x)
       : buckets_(x.buckets_), buckets_len_(x.buckets_len_)
- { x.buckets_ = bucket_ptr(0); x.buckets_len_ = 0; }
+ { x.buckets_ = bucket_ptr(); x.buckets_len_ = 0; }
 
    bucket_traits_impl& operator=(BOOST_RV_REF(bucket_traits_impl) x)
    {
       buckets_ = x.buckets_; buckets_len_ = x.buckets_len_;
- x.buckets_ = bucket_ptr(0); x.buckets_len_ = 0; return *this;
+ x.buckets_ = bucket_ptr(); x.buckets_len_ = 0; return *this;
    }
 
    bucket_traits_impl& operator=(BOOST_COPY_ASSIGN_REF(bucket_traits_impl) x)
@@ -108,7 +116,7 @@
       buckets_ = x.buckets_; buckets_len_ = x.buckets_len_; return *this;
    }
 
- bucket_ptr bucket_begin() const
+ const bucket_ptr &bucket_begin() const
    { return buckets_; }
 
    size_type bucket_count() const
@@ -124,7 +132,7 @@
    : public std::iterator
          < std::forward_iterator_tag
          , typename Container::value_type
- , typename std::iterator_traits<typename Container::value_type*>::difference_type
+ , typename pointer_traits<typename Container::value_type*>::difference_type
          , typename detail::add_const_if_c
                      <typename Container::value_type, IsConst>::type *
          , typename detail::add_const_if_c
@@ -135,16 +143,16 @@
    typedef typename Container::siterator siterator;
    typedef typename Container::const_siterator const_siterator;
    typedef typename Container::bucket_type bucket_type;
- typedef typename boost::pointer_to_other
- < typename Container::pointer, const Container>::type const_cont_ptr;
+
+ typedef typename pointer_traits
+ <typename Container::pointer>::template rebind_pointer
+ < const Container >::type const_cont_ptr;
    typedef typename Container::size_type size_type;
 
    static typename Container::node_ptr downcast_bucket(typename bucket_type::node_ptr p)
    {
-// This still fails in gcc < 4.4 so forget about it
-// using ::boost::static_pointer_cast;
-// return static_pointer_cast<typename Container::node>(p);
- return typename Container::node_ptr(&static_cast<typename Container::node&>(*p));
+ return pointer_traits<typename Container::node_ptr>::
+ pointer_to(static_cast<typename Container::node&>(*p));
    }
 
    public:
@@ -158,7 +166,7 @@
    {}
 
    explicit hashtable_iterator(siterator ptr, const Container *cont)
- : slist_it_ (ptr), cont_ (cont)
+ : slist_it_ (ptr), cont_ (cont ? pointer_traits<const_cont_ptr>::pointer_to(*cont) : const_cont_ptr() )
    {}
 
    hashtable_iterator(const hashtable_iterator<Container, false> &other)
@@ -192,10 +200,13 @@
    { return *this->operator ->(); }
 
    pointer operator->() const
- { return detail::boost_intrusive_get_pointer(this->get_real_value_traits()->to_value_ptr(downcast_bucket(slist_it_.pointed_node()))); }
+ {
+ return boost::intrusive::detail::to_raw_pointer(this->get_real_value_traits()->to_value_ptr
+ (downcast_bucket(slist_it_.pointed_node())));
+ }
 
- const Container *get_container() const
- { return detail::boost_intrusive_get_pointer(cont_); }
+ const const_cont_ptr &get_container() const
+ { return cont_; }
 
    const real_value_traits *get_real_value_traits() const
    { return &this->get_container()->get_real_value_traits(); }
@@ -203,8 +214,8 @@
    private:
    void increment()
    {
- const Container *cont = detail::boost_intrusive_get_pointer(cont_);
- bucket_type* buckets = detail::boost_intrusive_get_pointer(cont->bucket_pointer());
+ const Container *cont = boost::intrusive::detail::to_raw_pointer(cont_);
+ bucket_type* buckets = boost::intrusive::detail::to_raw_pointer(cont->bucket_pointer());
       size_type buckets_len = cont->bucket_count();
 
       ++slist_it_;

Modified: trunk/boost/intrusive/detail/list_node.hpp
==============================================================================
--- trunk/boost/intrusive/detail/list_node.hpp (original)
+++ trunk/boost/intrusive/detail/list_node.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -17,7 +17,7 @@
 #include <boost/intrusive/detail/config_begin.hpp>
 #include <iterator>
 #include <boost/intrusive/detail/assert.hpp>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 
 namespace boost {
 namespace intrusive {
@@ -29,8 +29,8 @@
 template<class VoidPointer>
 struct list_node
 {
- typedef typename boost::pointer_to_other
- <VoidPointer, list_node>::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>:: template rebind_pointer<list_node>::type node_ptr;
    node_ptr next_;
    node_ptr prev_;
 };
@@ -39,21 +39,21 @@
 struct list_node_traits
 {
    typedef list_node<VoidPointer> node;
- typedef typename boost::pointer_to_other
- <VoidPointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <VoidPointer, const node>::type const_node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>:: template rebind_pointer<node>::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>:: template rebind_pointer<const node>::type const_node_ptr;
 
- static node_ptr get_previous(const_node_ptr n)
+ static const node_ptr &get_previous(const const_node_ptr & n)
    { return n->prev_; }
 
- static void set_previous(node_ptr n, node_ptr prev)
+ static void set_previous(const node_ptr & n, const node_ptr & prev)
    { n->prev_ = prev; }
 
- static node_ptr get_next(const_node_ptr n)
+ static const node_ptr &get_next(const const_node_ptr & n)
    { return n->next_; }
 
- static void set_next(node_ptr n, node_ptr next)
+ static void set_next(const node_ptr & n, const node_ptr & next)
    { n->next_ = next; }
 };
 
@@ -74,8 +74,8 @@
    typedef typename real_value_traits::node_traits node_traits;
    typedef typename node_traits::node node;
    typedef typename node_traits::node_ptr node_ptr;
- typedef typename boost::pointer_to_other
- <node_ptr, void>::type void_pointer;
+ typedef typename pointer_traits<node_ptr>::
+ template rebind_pointer<void>::type void_pointer;
    static const bool store_container_ptr =
       detail::store_cont_ptr_on_it<Container>::value;
 
@@ -85,10 +85,10 @@
    typedef typename detail::if_c<IsConst,typename Container::const_reference,typename Container::reference>::type reference;
 
    list_iterator()
- : members_ (node_ptr(0), 0)
+ : members_ (node_ptr(), 0)
    {}
 
- explicit list_iterator(node_ptr node, const Container *cont_ptr)
+ explicit list_iterator(const node_ptr & node, const Container *cont_ptr)
       : members_ (node, cont_ptr)
    {}
 
@@ -104,8 +104,10 @@
 
    public:
    list_iterator& operator++()
- {
- members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
+ {
+ node_ptr p = node_traits::get_next(members_.nodeptr_);
+ members_.nodeptr_ = p;
+ //members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
       return static_cast<list_iterator&> (*this);
    }
    
@@ -139,7 +141,7 @@
    { return *operator->(); }
 
    pointer operator->() const
- { return detail::boost_intrusive_get_pointer(this->get_real_value_traits()->to_value_ptr(members_.nodeptr_)); }
+ { return this->get_real_value_traits()->to_value_ptr(members_.nodeptr_); }
 
    const Container *get_container() const
    {

Added: trunk/boost/intrusive/detail/memory_util.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/intrusive/detail/memory_util.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,250 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/intrusive for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTRUSIVE_ALLOCATOR_MEMORY_UTIL_HPP
+#define BOOST_INTRUSIVE_ALLOCATOR_MEMORY_UTIL_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/intrusive/detail/config_begin.hpp>
+#include <boost/intrusive/detail/workaround.hpp>
+#include <boost/intrusive/detail/mpl.hpp>
+#include <boost/intrusive/detail/preprocessor.hpp>
+
+namespace boost {
+namespace intrusive {
+namespace detail {
+
+template <typename T>
+inline T* addressof(T& obj)
+{
+ return static_cast<T*>
+ (static_cast<void*>
+ (const_cast<char*>
+ (&reinterpret_cast<const char&>(obj))
+ )
+ );
+}
+
+template <typename T> struct unvoid { typedef T type; };
+template <> struct unvoid<void> { struct type { }; };
+template <> struct unvoid<const void> { struct type { }; };
+
+template <typename T>
+struct LowPriorityConversion
+{
+ // Convertible from T with user-defined-conversion rank.
+ LowPriorityConversion(const T&) { }
+};
+
+// Infrastructure for providing a default type for T::TNAME if absent.
+#define BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(TNAME) \
+ template <typename T, typename DefaultType> \
+ struct boost_intrusive_default_type_ ## TNAME \
+ { \
+ template <typename X> \
+ static char test(int, typename X::TNAME*); \
+ \
+ template <typename X> \
+ static int test(boost::intrusive::detail:: \
+ LowPriorityConversion<int>, void*); \
+ \
+ struct DefaultWrap { typedef DefaultType TNAME; }; \
+ \
+ static const bool value = (1 == sizeof(test<T>(0, 0))); \
+ \
+ typedef typename \
+ ::boost::intrusive::detail::if_c<value, T, DefaultWrap>::type::TNAME type; \
+ } \
+//
+
+#define BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(INSTANTIATION_NS_PREFIX, T, TNAME, TIMPL) \
+ typename INSTANTIATION_NS_PREFIX \
+ boost_intrusive_default_type_ ## TNAME<T, TIMPL>::type \
+//
+
+}}} //namespace boost::intrusive::detail
+
+#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
+
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME pointer_to
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace intrusive { namespace detail {
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}}
+#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, <boost/intrusive/detail/has_member_function_callable_with.hpp>))
+#include BOOST_PP_ITERATE()
+
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME static_cast_from
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace intrusive { namespace detail {
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}}
+#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, <boost/intrusive/detail/has_member_function_callable_with.hpp>))
+#include BOOST_PP_ITERATE()
+
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME const_cast_from
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace intrusive { namespace detail {
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}}
+#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, <boost/intrusive/detail/has_member_function_callable_with.hpp>))
+#include BOOST_PP_ITERATE()
+
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME dynamic_cast_from
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace intrusive { namespace detail {
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}}
+#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, <boost/intrusive/detail/has_member_function_callable_with.hpp>))
+#include BOOST_PP_ITERATE()
+
+namespace boost {
+namespace intrusive {
+namespace detail {
+
+BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(element_type);
+BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type);
+
+//////////////////////
+//struct first_param
+//////////////////////
+
+template <typename T> struct first_param
+{ typedef void type; };
+
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+
+ template <template <typename, typename...> class TemplateClass, typename T, typename... Args>
+ struct first_param< TemplateClass<T, Args...> >
+ {
+ typedef T type;
+ };
+
+#else //C++03 compilers
+
+ #define BOOST_PP_LOCAL_MACRO(n) \
+ template < template <typename \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_INTRUSIVE_PP_IDENTITY, typename) > \
+ class TemplateClass \
+ , typename T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)> \
+ struct first_param \
+ < TemplateClass<T BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> > \
+ { \
+ typedef T type; \
+ }; \
+ //
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS)
+ #include BOOST_PP_LOCAL_ITERATE()
+
+#endif //!defined(BOOST_NO_VARIADIC_TEMPLATES)
+
+///////////////////////////
+//struct type_rebind_mode
+///////////////////////////
+template <typename Ptr, typename T>
+struct type_has_rebind
+{
+ template <typename X>
+ static char test(int, typename X::template rebind<T>*);
+
+ template <typename X>
+ static int test(boost::intrusive::detail::LowPriorityConversion<int>, void*);
+
+ static const bool value = (1 == sizeof(test<Ptr>(0, 0)));
+};
+
+template <typename Ptr, typename T>
+struct type_has_rebind_other
+{
+ template <typename X>
+ static char test(int, typename X::template rebind<T>::other*);
+
+ template <typename X>
+ static int test(boost::intrusive::detail::LowPriorityConversion<int>, void*);
+
+ static const bool value = (1 == sizeof(test<Ptr>(0, 0)));
+};
+
+template <typename Ptr, typename T>
+struct type_rebind_mode
+{
+ template <typename X>
+ static char test(int, typename X::template rebind<T>::other*);
+
+ template <typename X>
+ static int test(boost::intrusive::detail::LowPriorityConversion<int>, void*);
+
+ static const unsigned int rebind = (unsigned int)type_has_rebind<Ptr, T>::value;
+ static const unsigned int rebind_other = (unsigned int)type_has_rebind_other<Ptr, T>::value;
+ static const unsigned int mode = rebind + rebind*rebind_other;
+};
+
+////////////////////////
+//struct type_rebinder
+////////////////////////
+template <typename Ptr, typename U, unsigned int RebindMode = type_rebind_mode<Ptr, U>::mode>
+struct type_rebinder;
+
+// Implementation of pointer_traits<Ptr>::rebind if Ptr has
+// its own rebind::other type (C++03)
+template <typename Ptr, typename U>
+struct type_rebinder< Ptr, U, 2u >
+{
+ typedef typename Ptr::template rebind<U>::other type;
+};
+
+// Implementation of pointer_traits<Ptr>::rebind if Ptr has
+// its own rebind template.
+template <typename Ptr, typename U>
+struct type_rebinder< Ptr, U, 1u >
+{
+ typedef typename Ptr::template rebind<U> type;
+};
+
+// Specialization of pointer_traits<Ptr>::rebind if Ptr does not
+// have its own rebind template but has a the form Ptr<class T,
+// OtherArgs>, where OtherArgs comprises zero or more type parameters.
+// Many pointers fit this form, hence many pointers will get a
+// reasonable default for rebind.
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+
+template <template <class, class...> class Ptr, typename T, class... Tn, class U>
+struct type_rebinder<Ptr<T, Tn...>, U, 0u >
+{
+ typedef Ptr<U, Tn...> type;
+};
+
+#else //C++03 compilers
+
+#define BOOST_PP_LOCAL_MACRO(n) \
+template < template <typename \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_INTRUSIVE_PP_IDENTITY, typename) > \
+ class Ptr \
+ , typename T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \
+ , class U> \
+struct type_rebinder \
+ < Ptr<T BOOST_PP_ENUM_TRAILING_PARAMS(n, P)>, U, 0u > \
+{ \
+ typedef Ptr<U BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \
+}; \
+//
+#define BOOST_PP_LOCAL_LIMITS (0, BOOST_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS)
+#include BOOST_PP_LOCAL_ITERATE()
+
+#endif //!defined(BOOST_NO_VARIADIC_TEMPLATES)
+
+} //namespace detail {
+} //namespace intrusive {
+} //namespace boost {
+
+#include <boost/intrusive/detail/config_end.hpp>
+
+#endif // ! defined(BOOST_INTRUSIVE_ALLOCATOR_MEMORY_UTIL_HPP)

Deleted: trunk/boost/intrusive/detail/pointer_to_other.hpp
==============================================================================
--- trunk/boost/intrusive/detail/pointer_to_other.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
+++ (empty file)
@@ -1,65 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//
-// (C) Copyright Ion Gaztanaga 2006. 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/intrusive for documentation.
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef BOOST_INTRUSIVE_POINTER_TO_OTHER_HPP
-#define BOOST_INTRUSIVE_POINTER_TO_OTHER_HPP
-
-#include <boost/intrusive/detail/config_begin.hpp>
-#include <boost/version.hpp>
-
-#if (BOOST_VERSION < 103400)
-
-#ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED
-#define BOOST_POINTER_TO_OTHER_HPP_INCLUDED
-
-namespace boost {
-
-template<class T, class U>
- struct pointer_to_other;
-
-template<class T, class U, template <class> class Sp>
- struct pointer_to_other< Sp<T>, U >
-{
- typedef Sp<U> type;
-};
-
-template<class T, class T2, class U,
- template <class, class> class Sp>
- struct pointer_to_other< Sp<T, T2>, U >
-{
- typedef Sp<U, T2> type;
-};
-
-template<class T, class T2, class T3, class U,
- template <class, class, class> class Sp>
-struct pointer_to_other< Sp<T, T2, T3>, U >
-{
- typedef Sp<U, T2, T3> type;
-};
-
-template<class T, class U>
-struct pointer_to_other< T*, U >
-{
- typedef U* type;
-};
-
-} // namespace boost
-
-#endif
-
-#else
-
-#include <boost/pointer_to_other.hpp>
-
-#endif //#ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED
-
-#include <boost/intrusive/detail/config_end.hpp>
-
-#endif //#ifndef BOOST_INTRUSIVE_POINTER_TO_OTHER_HPP

Added: trunk/boost/intrusive/detail/preprocessor.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/intrusive/detail/preprocessor.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,52 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/intrusive for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTRUSIVE_DETAIL_PREPROCESSOR_HPP
+#define BOOST_INTRUSIVE_DETAIL_PREPROCESSOR_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/intrusive/detail/config_begin.hpp>
+#include <boost/intrusive/detail/workaround.hpp>
+
+#include <boost/preprocessor/iteration/local.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_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS 10
+
+#define BOOST_INTRUSIVE_PP_IDENTITY(z, n, data) data
+
+#define BOOST_INTRUSIVE_PP_DECLVAL(z, n, data) \
+boost::move_detail::declval< BOOST_PP_CAT(P, n) >() \
+//!
+
+#define BOOST_INTRUSIVE_PP_TEMPLATE_PARAM_VOID_DEFAULT(z, n, data) \
+ BOOST_PP_CAT(class P, n) = void \
+//!
+
+#include <boost/intrusive/detail/config_end.hpp>
+
+#endif //#ifndef BOOST_INTRUSIVE_DETAIL_PREPROCESSOR_HPP

Modified: trunk/boost/intrusive/detail/rbtree_node.hpp
==============================================================================
--- trunk/boost/intrusive/detail/rbtree_node.hpp (original)
+++ trunk/boost/intrusive/detail/rbtree_node.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -16,7 +16,7 @@
 
 #include <boost/intrusive/detail/config_begin.hpp>
 #include <iterator>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/rbtree_algorithms.hpp>
 #include <boost/intrusive/pointer_plus_bits.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
@@ -34,9 +34,9 @@
 template<class VoidPointer>
 struct compact_rbtree_node
 {
- typedef typename pointer_to_other
- <VoidPointer
- ,compact_rbtree_node<VoidPointer> >::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer
+ <compact_rbtree_node<VoidPointer> >::type node_ptr;
    enum color { red_t, black_t };
    node_ptr parent_, left_, right_;
 };
@@ -45,9 +45,9 @@
 template<class VoidPointer>
 struct rbtree_node
 {
- typedef typename pointer_to_other
- <VoidPointer
- ,rbtree_node<VoidPointer> >::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer
+ <rbtree_node<VoidPointer> >::type node_ptr;
 
    enum color { red_t, black_t };
    node_ptr parent_, left_, right_;
@@ -61,35 +61,35 @@
 {
    typedef rbtree_node<VoidPointer> node;
 
- typedef typename boost::pointer_to_other
- <VoidPointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <VoidPointer, const node>::type const_node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<node>::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
 
    typedef typename node::color color;
 
- static node_ptr get_parent(const_node_ptr n)
+ static const node_ptr & get_parent(const const_node_ptr & n)
    { return n->parent_; }
 
- static void set_parent(node_ptr n, node_ptr p)
+ static void set_parent(const node_ptr & n, const node_ptr & p)
    { n->parent_ = p; }
 
- static node_ptr get_left(const_node_ptr n)
+ static const node_ptr & get_left(const const_node_ptr & n)
    { return n->left_; }
 
- static void set_left(node_ptr n, node_ptr l)
+ static void set_left(const node_ptr & n, const node_ptr & l)
    { n->left_ = l; }
 
- static node_ptr get_right(const_node_ptr n)
+ static const node_ptr & get_right(const const_node_ptr & n)
    { return n->right_; }
 
- static void set_right(node_ptr n, node_ptr r)
+ static void set_right(const node_ptr & n, const node_ptr & r)
    { n->right_ = r; }
 
- static color get_color(const_node_ptr n)
+ static color get_color(const const_node_ptr & n)
    { return n->color_; }
 
- static void set_color(node_ptr n, color c)
+ static void set_color(const node_ptr & n, color c)
    { n->color_ = c; }
 
    static color black()
@@ -105,37 +105,37 @@
 struct compact_rbtree_node_traits_impl
 {
    typedef compact_rbtree_node<VoidPointer> node;
- typedef typename boost::pointer_to_other
- <VoidPointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <VoidPointer, const node>::type const_node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<node>::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
 
    typedef pointer_plus_bits<node_ptr, 1> ptr_bit;
 
    typedef typename node::color color;
 
- static node_ptr get_parent(const_node_ptr n)
+ static node_ptr get_parent(const const_node_ptr & n)
    { return ptr_bit::get_pointer(n->parent_); }
 
- static void set_parent(node_ptr n, node_ptr p)
+ static void set_parent(const node_ptr & n, const node_ptr & p)
    { ptr_bit::set_pointer(n->parent_, p); }
 
- static node_ptr get_left(const_node_ptr n)
+ static const node_ptr & get_left(const const_node_ptr & n)
    { return n->left_; }
 
- static void set_left(node_ptr n, node_ptr l)
+ static void set_left(const node_ptr & n, const node_ptr & l)
    { n->left_ = l; }
 
- static node_ptr get_right(const_node_ptr n)
+ static const node_ptr & get_right(const const_node_ptr & n)
    { return n->right_; }
 
- static void set_right(node_ptr n, node_ptr r)
+ static void set_right(const node_ptr & n, const node_ptr & r)
    { n->right_ = r; }
 
- static color get_color(const_node_ptr n)
+ static color get_color(const const_node_ptr & n)
    { return (color)ptr_bit::get_bits(n->parent_); }
 
- static void set_color(node_ptr n, color c)
+ static void set_color(const node_ptr & n, color c)
    { ptr_bit::set_bits(n->parent_, c != 0); }
 
    static color black()

Modified: trunk/boost/intrusive/detail/slist_node.hpp
==============================================================================
--- trunk/boost/intrusive/detail/slist_node.hpp (original)
+++ trunk/boost/intrusive/detail/slist_node.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -17,7 +17,7 @@
 #include <boost/intrusive/detail/config_begin.hpp>
 #include <iterator>
 #include <boost/intrusive/detail/assert.hpp>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 
 namespace boost {
 namespace intrusive {
@@ -25,8 +25,8 @@
 template<class VoidPointer>
 struct slist_node
 {
- typedef typename boost::pointer_to_other
- <VoidPointer, slist_node>::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<slist_node>::type node_ptr;
    node_ptr next_;
 };
 
@@ -37,15 +37,15 @@
 struct slist_node_traits
 {
    typedef slist_node<VoidPointer> node;
- typedef typename boost::pointer_to_other
- <VoidPointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <VoidPointer, const node>::type const_node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<node>::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
 
- static node_ptr get_next(const_node_ptr n)
+ static const node_ptr &get_next(const const_node_ptr & n)
    { return n->next_; }
 
- static void set_next(node_ptr n, node_ptr next)
+ static void set_next(const node_ptr & n, const node_ptr & next)
    { n->next_ = next; }
 };
 
@@ -66,8 +66,8 @@
    typedef typename real_value_traits::node_traits node_traits;
    typedef typename node_traits::node node;
    typedef typename node_traits::node_ptr node_ptr;
- typedef typename boost::pointer_to_other
- <node_ptr, void>::type void_pointer;
+ typedef typename pointer_traits
+ <node_ptr>::template rebind_pointer <void>::type void_pointer;
    static const bool store_container_ptr =
       detail::store_cont_ptr_on_it<Container>::value;
 
@@ -77,10 +77,10 @@
    typedef typename detail::if_c<IsConst,typename Container::const_reference,typename Container::reference>::type reference;
 
    slist_iterator()
- : members_ (node_ptr(0), 0)
+ : members_ (node_ptr(), 0)
    {}
 
- explicit slist_iterator(node_ptr node, const Container *cont_ptr)
+ explicit slist_iterator(const node_ptr & node, const Container *cont_ptr)
       : members_ (node, cont_ptr)
    {}
 
@@ -118,7 +118,7 @@
    { return *operator->(); }
 
    pointer operator->() const
- { return detail::boost_intrusive_get_pointer(this->get_real_value_traits()->to_value_ptr(members_.nodeptr_)); }
+ { return this->get_real_value_traits()->to_value_ptr(members_.nodeptr_); }
 
    const Container *get_container() const
    {

Modified: trunk/boost/intrusive/detail/tree_algorithms.hpp
==============================================================================
--- trunk/boost/intrusive/detail/tree_algorithms.hpp (original)
+++ trunk/boost/intrusive/detail/tree_algorithms.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -18,7 +18,7 @@
 #include <boost/intrusive/intrusive_fwd.hpp>
 #include <cstddef>
 #include <boost/intrusive/detail/utilities.hpp>
-//iG pending #include <boost/pointer_cast.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 
 namespace boost {
 namespace intrusive {
@@ -106,7 +106,7 @@
    {
       insert_commit_data()
          : link_left(false)
- , node(0)
+ , node()
       {}
       bool link_left;
       node_ptr node;
@@ -114,7 +114,7 @@
 
    struct nop_erase_fixup
    {
- void operator()(node_ptr, node_ptr){}
+ void operator()(const node_ptr&, const node_ptr&){}
    };
 
    /// @cond
@@ -122,7 +122,7 @@
    template<class Disposer>
    struct dispose_subtree_disposer
    {
- dispose_subtree_disposer(Disposer &disp, node_ptr subtree)
+ dispose_subtree_disposer(Disposer &disp, const node_ptr & subtree)
          : disposer_(&disp), subtree_(subtree)
       {}
 
@@ -139,21 +139,19 @@
       node_ptr subtree_;
    };
 
- static node_ptr uncast(const_node_ptr ptr)
- {
- return node_ptr(const_cast<node*>(::boost::intrusive::detail::boost_intrusive_get_pointer(ptr)));
- //iG pending return node_ptr(boost::const_pointer_cast<node>(ptr));
- }
+ static node_ptr uncast(const const_node_ptr & ptr)
+ { return pointer_traits<node_ptr>::const_cast_from(ptr); }
+
    /// @endcond
 
    public:
- static node_ptr begin_node(const_node_ptr header)
+ static node_ptr begin_node(const const_node_ptr & header)
    { return node_traits::get_left(header); }
 
- static node_ptr end_node(const_node_ptr header)
+ static node_ptr end_node(const const_node_ptr & header)
    { return uncast(header); }
 
- //! <b>Requires</b>: node is a node of the tree or an node initialized
+ //! <b>Requires</b>: 'node' is a node of the tree or an node initialized
    //! by init(...) or init_node.
    //!
    //! <b>Effects</b>: Returns true if the node is initialized by init() or init_node().
@@ -161,10 +159,10 @@
    //! <b>Complexity</b>: Constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static bool unique(const_node_ptr node)
+ static bool unique(const const_node_ptr & node)
    { return !NodeTraits::get_parent(node); }
 
- static node_ptr get_header(const_node_ptr node)
+ static node_ptr get_header(const const_node_ptr & node)
    {
       node_ptr h = uncast(node);
       if(NodeTraits::get_parent(node)){
@@ -190,7 +188,7 @@
    //! node1 and node2 are not equivalent according to the ordering rules.
    //!
    //!Experimental function
- static void swap_nodes(node_ptr node1, node_ptr node2)
+ static void swap_nodes(const node_ptr & node1, const node_ptr & node2)
    {
       if(node1 == node2)
          return;
@@ -214,7 +212,7 @@
    //! node1 and node2 are not equivalent according to the ordering rules.
    //!
    //!Experimental function
- static void swap_nodes(node_ptr node1, node_ptr header1, node_ptr node2, node_ptr header2)
+ static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2)
    {
       if(node1 == node2)
          return;
@@ -363,7 +361,7 @@
    //! the node, since no rebalancing and comparison is needed.
    //!
    //!Experimental function
- static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node)
+ static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node)
    {
       if(node_to_be_replaced == new_node)
          return;
@@ -386,7 +384,7 @@
    //! the node, since no rebalancing or comparison is needed.
    //!
    //!Experimental function
- static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node)
+ static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node)
    {
       if(node_to_be_replaced == new_node)
          return;
@@ -429,20 +427,21 @@
       }
    }
 
- //! <b>Requires</b>: p is a node from the tree except the header.
+ //! <b>Requires</b>: 'node' is a node from the tree except the header.
    //!
    //! <b>Effects</b>: Returns the next node of the tree.
    //!
    //! <b>Complexity</b>: Average constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr next_node(node_ptr p)
+ static node_ptr next_node(const node_ptr & node)
    {
- node_ptr p_right(NodeTraits::get_right(p));
+ node_ptr p_right(NodeTraits::get_right(node));
       if(p_right){
          return minimum(p_right);
       }
       else {
+ node_ptr p(node);
          node_ptr x = NodeTraits::get_parent(p);
          while(p == NodeTraits::get_right(x)){
             p = x;
@@ -452,23 +451,24 @@
       }
    }
 
- //! <b>Requires</b>: p is a node from the tree except the leftmost node.
+ //! <b>Requires</b>: 'node' is a node from the tree except the leftmost node.
    //!
    //! <b>Effects</b>: Returns the previous node of the tree.
    //!
    //! <b>Complexity</b>: Average constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr prev_node(node_ptr p)
+ static node_ptr prev_node(const node_ptr & node)
    {
- if(is_header(p)){
- return NodeTraits::get_right(p);
- //return maximum(NodeTraits::get_parent(p));
+ if(is_header(node)){
+ return NodeTraits::get_right(node);
+ //return maximum(NodeTraits::get_parent(node));
       }
- else if(NodeTraits::get_left(p)){
- return maximum(NodeTraits::get_left(p));
+ else if(NodeTraits::get_left(node)){
+ return maximum(NodeTraits::get_left(node));
       }
       else {
+ node_ptr p(node);
          node_ptr x = NodeTraits::get_parent(p);
          while(p == NodeTraits::get_left(x)){
             p = x;
@@ -478,15 +478,16 @@
       }
    }
 
- //! <b>Requires</b>: p is a node of a tree but not the header.
+ //! <b>Requires</b>: 'node' is a node of a tree but not the header.
    //!
    //! <b>Effects</b>: Returns the minimum node of the subtree starting at p.
    //!
    //! <b>Complexity</b>: Logarithmic to the size of the subtree.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr minimum (node_ptr p)
+ static node_ptr minimum (const node_ptr & node)
    {
+ node_ptr p(node);
       for(node_ptr p_left = NodeTraits::get_left(p)
          ;p_left
          ;p_left = NodeTraits::get_left(p)){
@@ -495,15 +496,16 @@
       return p;
    }
 
- //! <b>Requires</b>: p is a node of a tree but not the header.
+ //! <b>Requires</b>: 'node' is a node of a tree but not the header.
    //!
    //! <b>Effects</b>: Returns the maximum node of the subtree starting at p.
    //!
    //! <b>Complexity</b>: Logarithmic to the size of the subtree.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr maximum(node_ptr p)
+ static node_ptr maximum(const node_ptr & node)
    {
+ node_ptr p(node);
       for(node_ptr p_right = NodeTraits::get_right(p)
          ;p_right
          ;p_right = NodeTraits::get_right(p)){
@@ -512,7 +514,7 @@
       return p;
    }
 
- //! <b>Requires</b>: node must not be part of any tree.
+ //! <b>Requires</b>: 'node' must not be part of any tree.
    //!
    //! <b>Effects</b>: After the function unique(node) == true.
    //!
@@ -521,11 +523,11 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
- static void init(node_ptr node)
+ static void init(const node_ptr & node)
    {
- NodeTraits::set_parent(node, node_ptr(0));
- NodeTraits::set_left(node, node_ptr(0));
- NodeTraits::set_right(node, node_ptr(0));
+ NodeTraits::set_parent(node, node_ptr());
+ NodeTraits::set_left(node, node_ptr());
+ NodeTraits::set_right(node, node_ptr());
    };
 
    //! <b>Effects</b>: Returns true if node is in the same state as if called init(node)
@@ -533,7 +535,7 @@
    //! <b>Complexity</b>: Constant.
    //!
    //! <b>Throws</b>: Nothing.
- static bool inited(const_node_ptr node)
+ static bool inited(const const_node_ptr & node)
    {
       return !NodeTraits::get_parent(node) &&
              !NodeTraits::get_left(node) &&
@@ -550,9 +552,9 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
- static void init_header(node_ptr header)
+ static void init_header(const node_ptr & header)
    {
- NodeTraits::set_parent(header, node_ptr(0));
+ NodeTraits::set_parent(header, node_ptr());
       NodeTraits::set_left(header, header);
       NodeTraits::set_right(header, header);
    }
@@ -561,7 +563,7 @@
    //! taking a node_ptr parameter and shouldn't throw.
    //!
    //! <b>Effects</b>: Empties the target tree calling
- //! <tt>void disposer::operator()(node_ptr)</tt> for every node of the tree
+ //! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
    //! except the header.
    //!
    //! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
@@ -569,7 +571,7 @@
    //!
    //! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
    template<class Disposer>
- static void clear_and_dispose(node_ptr header, Disposer disposer)
+ static void clear_and_dispose(const node_ptr & header, Disposer disposer)
    {
       node_ptr source_root = NodeTraits::get_parent(header);
       if(!source_root)
@@ -591,11 +593,11 @@
    //! only be used for more unlink_leftmost_without_rebalance calls.
    //! This function is normally used to achieve a step by step
    //! controlled destruction of the tree.
- static node_ptr unlink_leftmost_without_rebalance(node_ptr header)
+ static node_ptr unlink_leftmost_without_rebalance(const node_ptr & header)
    {
       node_ptr leftmost = NodeTraits::get_left(header);
       if (leftmost == header)
- return node_ptr(0);
+ return node_ptr();
       node_ptr leftmost_parent(NodeTraits::get_parent(leftmost));
       node_ptr leftmost_right (NodeTraits::get_right(leftmost));
       bool is_root = leftmost_parent == header;
@@ -610,12 +612,12 @@
             NodeTraits::set_left(NodeTraits::get_parent(header), leftmost_right);
       }
       else if (is_root){
- NodeTraits::set_parent(header, node_ptr(0));
+ NodeTraits::set_parent(header, node_ptr());
          NodeTraits::set_left(header, header);
          NodeTraits::set_right(header, header);
       }
       else{
- NodeTraits::set_left(leftmost_parent, node_ptr(0));
+ NodeTraits::set_left(leftmost_parent, node_ptr());
          NodeTraits::set_left(header, leftmost_parent);
       }
       return leftmost;
@@ -628,7 +630,7 @@
    //! <b>Complexity</b>: Linear time.
    //!
    //! <b>Throws</b>: Nothing.
- static std::size_t count(const_node_ptr subtree)
+ static std::size_t count(const const_node_ptr & subtree)
    {
       if(!subtree) return 0;
       std::size_t count = 0;
@@ -664,7 +666,7 @@
    //! <b>Complexity</b>: Linear time.
    //!
    //! <b>Throws</b>: Nothing.
- static std::size_t size(const_node_ptr header)
+ static std::size_t size(const const_node_ptr & header)
    {
       node_ptr beg(begin_node(header));
       node_ptr end(end_node(header));
@@ -682,7 +684,7 @@
    //! <b>Complexity</b>: Constant.
    //!
    //! <b>Throws</b>: Nothing.
- static void swap_tree(node_ptr header1, node_ptr header2)
+ static void swap_tree(const node_ptr & header1, const node_ptr & header2)
    {
       if(header1 == header2)
          return;
@@ -722,7 +724,7 @@
       }
    }
 
- static bool is_header(const_node_ptr p)
+ static bool is_header(const const_node_ptr & p)
    {
       node_ptr p_left (NodeTraits::get_left(p));
       node_ptr p_right(NodeTraits::get_right(p));
@@ -752,7 +754,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr find
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    {
       node_ptr end = uncast(header);
       node_ptr y = lower_bound(header, key, comp);
@@ -774,7 +776,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static std::pair<node_ptr, node_ptr> equal_range
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    {
       node_ptr y = uncast(header);
       node_ptr x = NodeTraits::get_parent(header);
@@ -831,7 +833,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr lower_bound
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    {
       node_ptr y = uncast(header);
       node_ptr x = NodeTraits::get_parent(header);
@@ -860,7 +862,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr upper_bound
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    {
       node_ptr y = uncast(header);
       node_ptr x = NodeTraits::get_parent(header);
@@ -894,14 +896,14 @@
    //! previously executed to fill "commit_data". No value should be inserted or
    //! erased between the "insert_check" and "insert_commit" calls.
    static void insert_unique_commit
- (node_ptr header, node_ptr new_value, const insert_commit_data &commit_data)
+ (const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data)
    { return insert_commit(header, new_value, commit_data); }
 
    static void insert_commit
- (node_ptr header, node_ptr new_node, const insert_commit_data &commit_data)
+ (const node_ptr & header, const node_ptr & new_node, const insert_commit_data &commit_data)
    {
       //Check if commit_data has not been initialized by a insert_unique_check call.
- BOOST_INTRUSIVE_INVARIANT_ASSERT(commit_data.node != 0);
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(commit_data.node != node_ptr());
       node_ptr parent_node(commit_data.node);
       if(parent_node == header){
          NodeTraits::set_parent(header, new_node);
@@ -919,8 +921,8 @@
              NodeTraits::set_right(header, new_node);
       }
       NodeTraits::set_parent(new_node, parent_node);
- NodeTraits::set_right(new_node, node_ptr(0));
- NodeTraits::set_left(new_node, node_ptr(0));
+ NodeTraits::set_right(new_node, node_ptr());
+ NodeTraits::set_left(new_node, node_ptr());
    }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -959,14 +961,14 @@
    //! if no more objects are inserted or erased from the set.
    template<class KeyType, class KeyNodePtrCompare>
    static std::pair<node_ptr, bool> insert_unique_check
- (const_node_ptr header, const KeyType &key
+ (const const_node_ptr & header, const KeyType &key
       ,KeyNodePtrCompare comp, insert_commit_data &commit_data, std::size_t *pdepth = 0)
    {
       std::size_t depth = 0;
       node_ptr h(uncast(header));
       node_ptr y(h);
       node_ptr x(NodeTraits::get_parent(y));
- node_ptr prev(0);
+ node_ptr prev = node_ptr();
 
       //Find the upper bound, cache the previous value and if we should
       //store it in the left or right node
@@ -997,7 +999,7 @@
 
    template<class KeyType, class KeyNodePtrCompare>
    static std::pair<node_ptr, bool> insert_unique_check
- (const_node_ptr header, node_ptr hint, const KeyType &key
+ (const const_node_ptr & header, const node_ptr &hint, const KeyType &key
       ,KeyNodePtrCompare comp, insert_commit_data &commit_data, std::size_t *pdepth = 0)
    {
       //hint must be bigger than the key
@@ -1019,7 +1021,7 @@
 
    template<class NodePtrCompare>
    static void insert_equal_check
- ( node_ptr header, node_ptr hint, node_ptr new_node, NodePtrCompare comp
+ (const node_ptr &header, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp
       , insert_commit_data &commit_data, std::size_t *pdepth = 0)
    {
       if(hint == header || !comp(hint, new_node)){
@@ -1044,17 +1046,17 @@
 
    template<class NodePtrCompare>
    static void insert_equal_upper_bound_check
- (node_ptr h, node_ptr new_node, NodePtrCompare comp, insert_commit_data & commit_data, std::size_t *pdepth = 0)
+ (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp, insert_commit_data & commit_data, std::size_t *pdepth = 0)
    { insert_equal_check_impl(true, h, new_node, comp, commit_data, pdepth); }
 
    template<class NodePtrCompare>
    static void insert_equal_lower_bound_check
- (node_ptr h, node_ptr new_node, NodePtrCompare comp, insert_commit_data & commit_data, std::size_t *pdepth = 0)
+ (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp, insert_commit_data & commit_data, std::size_t *pdepth = 0)
    { insert_equal_check_impl(false, h, new_node, comp, commit_data, pdepth); }
 
    template<class NodePtrCompare>
    static node_ptr insert_equal
- (node_ptr h, node_ptr hint, node_ptr new_node, NodePtrCompare comp, std::size_t *pdepth = 0)
+ (const node_ptr & h, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp, std::size_t *pdepth = 0)
    {
       insert_commit_data commit_data;
       insert_equal_check(h, hint, new_node, comp, commit_data, pdepth);
@@ -1064,7 +1066,7 @@
 
    template<class NodePtrCompare>
    static node_ptr insert_equal_upper_bound
- (node_ptr h, node_ptr new_node, NodePtrCompare comp, std::size_t *pdepth = 0)
+ (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp, std::size_t *pdepth = 0)
    {
       insert_commit_data commit_data;
       insert_equal_upper_bound_check(h, new_node, comp, commit_data, pdepth);
@@ -1074,7 +1076,7 @@
 
    template<class NodePtrCompare>
    static node_ptr insert_equal_lower_bound
- (node_ptr h, node_ptr new_node, NodePtrCompare comp, std::size_t *pdepth = 0)
+ (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp, std::size_t *pdepth = 0)
    {
       insert_commit_data commit_data;
       insert_equal_lower_bound_check(h, new_node, comp, commit_data, pdepth);
@@ -1083,7 +1085,7 @@
    }
 
    static node_ptr insert_before
- (node_ptr header, node_ptr pos, node_ptr new_node, std::size_t *pdepth = 0)
+ (const node_ptr & header, const node_ptr & pos, const node_ptr & new_node, std::size_t *pdepth = 0)
    {
       insert_commit_data commit_data;
       insert_before_check(header, pos, commit_data, pdepth);
@@ -1092,7 +1094,7 @@
    }
 
    static void insert_before_check
- ( node_ptr header, node_ptr pos
+ (const node_ptr &header, const node_ptr & pos
       , insert_commit_data &commit_data, std::size_t *pdepth = 0)
    {
       node_ptr prev(pos);
@@ -1107,7 +1109,7 @@
    }
 
    static void push_back
- (node_ptr header, node_ptr new_node, std::size_t *pdepth = 0)
+ (const node_ptr & header, const node_ptr & new_node, std::size_t *pdepth = 0)
    {
       insert_commit_data commit_data;
       push_back_check(header, commit_data, pdepth);
@@ -1115,7 +1117,7 @@
    }
 
    static void push_back_check
- (node_ptr header, insert_commit_data &commit_data, std::size_t *pdepth = 0)
+ (const node_ptr & header, insert_commit_data &commit_data, std::size_t *pdepth = 0)
    {
       node_ptr prev(NodeTraits::get_right(header));
       if(pdepth){
@@ -1126,7 +1128,7 @@
    }
 
    static void push_front
- (node_ptr header, node_ptr new_node, std::size_t *pdepth = 0)
+ (const node_ptr & header, const node_ptr & new_node, std::size_t *pdepth = 0)
    {
       insert_commit_data commit_data;
       push_front_check(header, commit_data, pdepth);
@@ -1134,7 +1136,7 @@
    }
 
    static void push_front_check
- (node_ptr header, insert_commit_data &commit_data, std::size_t *pdepth = 0)
+ (const node_ptr & header, insert_commit_data &commit_data, std::size_t *pdepth = 0)
    {
       node_ptr pos(NodeTraits::get_left(header));
       if(pdepth){
@@ -1144,7 +1146,7 @@
       commit_data.node = pos;
    }
 
- //! <b>Requires</b>: p can't be a header node.
+ //! <b>Requires</b>: 'node' can't be a header node.
    //!
    //! <b>Effects</b>: Calculates the depth of a node: the depth of a
    //! node is the length (number of edges) of the path from the root
@@ -1153,8 +1155,9 @@
    //! <b>Complexity</b>: Logarithmic to the number of nodes in the tree.
    //!
    //! <b>Throws</b>: Nothing.
- static std::size_t depth(const_node_ptr p)
+ static std::size_t depth(const const_node_ptr & node)
    {
+ const_node_ptr p(node);
       std::size_t depth = 0;
       node_ptr p_parent;
       while(p != NodeTraits::get_parent(p_parent = NodeTraits::get_parent(p))){
@@ -1169,13 +1172,13 @@
    //! take a node_ptr and shouldn't throw.
    //!
    //! <b>Effects</b>: First empties target tree calling
- //! <tt>void disposer::operator()(node_ptr)</tt> for every node of the tree
+ //! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
    //! except the header.
    //!
    //! Then, duplicates the entire tree pointed by "source_header" cloning each
- //! source node with <tt>node_ptr Cloner::operator()(node_ptr)</tt> to obtain
+ //! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
    //! the nodes of the target tree. If "cloner" throws, the cloned target nodes
- //! are disposed using <tt>void disposer(node_ptr)</tt>.
+ //! are disposed using <tt>void disposer(const node_ptr &)</tt>.
    //!
    //! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
    //! number of elements of tree target tree when calling this function.
@@ -1183,7 +1186,7 @@
    //! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
    template <class Cloner, class Disposer>
    static void clone
- (const_node_ptr source_header, node_ptr target_header, Cloner cloner, Disposer disposer)
+ (const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer)
    {
       if(!unique(target_header)){
          clear_and_dispose(target_header, disposer);
@@ -1201,9 +1204,9 @@
 
    template <class Cloner, class Disposer>
    static node_ptr clone_subtree
- ( const_node_ptr source_parent, node_ptr target_parent
- , Cloner cloner, Disposer disposer
- , node_ptr &leftmost_out, node_ptr &rightmost_out
+ (const const_node_ptr &source_parent, const node_ptr &target_parent
+ , Cloner cloner, Disposer disposer
+ , node_ptr &leftmost_out, node_ptr &rightmost_out
       )
    {
       node_ptr target_sub_root = target_parent;
@@ -1221,8 +1224,8 @@
          node_ptr rightmost = target_sub_root;
 
          //First set the subroot
- NodeTraits::set_left(target_sub_root, node_ptr(0));
- NodeTraits::set_right(target_sub_root, node_ptr(0));
+ NodeTraits::set_left(target_sub_root, node_ptr());
+ NodeTraits::set_right(target_sub_root, node_ptr());
          NodeTraits::set_parent(target_sub_root, target_parent);
 
          dispose_subtree_disposer<Disposer> rollback(disposer, target_sub_root);
@@ -1234,8 +1237,8 @@
                node_ptr temp = insertion_point;
                //Clone and mark as leaf
                insertion_point = cloner(current);
- NodeTraits::set_left (insertion_point, node_ptr(0));
- NodeTraits::set_right (insertion_point, node_ptr(0));
+ NodeTraits::set_left (insertion_point, node_ptr());
+ NodeTraits::set_right (insertion_point, node_ptr());
                //Insert left
                NodeTraits::set_parent(insertion_point, temp);
                NodeTraits::set_left (temp, insertion_point);
@@ -1250,8 +1253,8 @@
                node_ptr temp = insertion_point;
                //Clone and mark as leaf
                insertion_point = cloner(current);
- NodeTraits::set_left (insertion_point, node_ptr(0));
- NodeTraits::set_right (insertion_point, node_ptr(0));
+ NodeTraits::set_left (insertion_point, node_ptr());
+ NodeTraits::set_right (insertion_point, node_ptr());
                //Insert right
                NodeTraits::set_parent(insertion_point, temp);
                NodeTraits::set_right (temp, insertion_point);
@@ -1276,9 +1279,10 @@
    }
 
    template<class Disposer>
- static void dispose_subtree(node_ptr x, Disposer disposer)
+ static void dispose_subtree(const node_ptr & node, Disposer disposer)
    {
       node_ptr save;
+ node_ptr x(node);
       while (x){
          save = NodeTraits::get_left(x);
          if (save) {
@@ -1302,7 +1306,7 @@
    //! <b>Complexity</b>: Constant.
    //!
    //! <b>Throws</b>: Nothing.
- static bool is_left_child(node_ptr p)
+ static bool is_left_child(const node_ptr & p)
    { return NodeTraits::get_left(NodeTraits::get_parent(p)) == p; }
 
    //! <b>Requires</b>: p is a node of a tree.
@@ -1312,11 +1316,11 @@
    //! <b>Complexity</b>: Constant.
    //!
    //! <b>Throws</b>: Nothing.
- static bool is_right_child(node_ptr p)
+ static bool is_right_child(const node_ptr & p)
    { return NodeTraits::get_right(NodeTraits::get_parent(p)) == p; }
 
    //Fix header and own's parent data when replacing x with own, providing own's old data with parent
- static void replace_own_impl(node_ptr own, node_ptr x, node_ptr header, node_ptr own_parent, bool own_was_left)
+ static void replace_own_impl(const node_ptr & own, const node_ptr & x, const node_ptr & header, const node_ptr & own_parent, bool own_was_left)
    {
       if(NodeTraits::get_parent(header) == own)
          NodeTraits::set_parent(header, x);
@@ -1328,7 +1332,7 @@
 
    //Fix header and own's parent data when replacing x with own, supposing own
    //links with its parent are still ok
- static void replace_own(node_ptr own, node_ptr x, node_ptr header)
+ static void replace_own(const node_ptr & own, const node_ptr & x, const node_ptr & header)
    {
       node_ptr own_parent(NodeTraits::get_parent(own));
       bool own_is_left(NodeTraits::get_left(own_parent) == own);
@@ -1336,7 +1340,7 @@
    }
 
    // rotate parent p to left (no header and p's parent fixup)
- static node_ptr rotate_left(node_ptr p)
+ static node_ptr rotate_left(const node_ptr & p)
    {
       node_ptr x(NodeTraits::get_right(p));
       node_ptr x_left(NodeTraits::get_left(x));
@@ -1350,7 +1354,7 @@
    }
 
    // rotate parent p to left (with header and p's parent fixup)
- static void rotate_left(node_ptr p, node_ptr header)
+ static void rotate_left(const node_ptr & p, const node_ptr & header)
    {
       bool p_was_left(is_left_child(p));
       node_ptr p_old_parent(NodeTraits::get_parent(p));
@@ -1360,7 +1364,7 @@
    }
 
    // rotate parent p to right (no header and p's parent fixup)
- static node_ptr rotate_right(node_ptr p)
+ static node_ptr rotate_right(const node_ptr & p)
    {
       node_ptr x(NodeTraits::get_left(p));
       node_ptr x_right(NodeTraits::get_right(x));
@@ -1374,7 +1378,7 @@
    }
 
    // rotate parent p to right (with header and p's parent fixup)
- static void rotate_right(node_ptr p, node_ptr header)
+ static void rotate_right(const node_ptr & p, const node_ptr & header)
    {
       bool p_was_left(is_left_child(p));
       node_ptr p_old_parent(NodeTraits::get_parent(p));
@@ -1383,7 +1387,7 @@
       replace_own_impl(p, x, header, p_old_parent, p_was_left);
    }
 
- static void erase(node_ptr header, node_ptr z)
+ static void erase(const node_ptr & header, const node_ptr & z)
    {
       data_for_rebalance ignored;
       erase_impl(header, z, ignored);
@@ -1397,7 +1401,7 @@
    };
 
    template<class F>
- static void erase(node_ptr header, node_ptr z, F z_and_successor_fixup, data_for_rebalance &info)
+ static void erase(const node_ptr & header, const node_ptr & z, F z_and_successor_fixup, data_for_rebalance &info)
    {
       erase_impl(header, z, info);
       if(info.y != z){
@@ -1405,7 +1409,7 @@
       }
    }
 
- static void unlink(node_ptr node)
+ static void unlink(const node_ptr & node)
    {
       node_ptr x = NodeTraits::get_parent(node);
       if(x){
@@ -1415,13 +1419,13 @@
       }
    }
 
- static void tree_to_vine(node_ptr header)
+ static void tree_to_vine(const node_ptr & header)
    { subtree_to_vine(NodeTraits::get_parent(header)); }
 
- static void vine_to_tree(node_ptr header, std::size_t count)
+ static void vine_to_tree(const node_ptr & header, std::size_t count)
    { vine_to_subtree(NodeTraits::get_parent(header), count); }
 
- static void rebalance(node_ptr header)
+ static void rebalance(const node_ptr & header)
    {
       //Taken from:
       //"Tree rebalancing in optimal time and space"
@@ -1431,18 +1435,18 @@
       vine_to_subtree(NodeTraits::get_parent(header), len);
    }
 
- static node_ptr rebalance_subtree(node_ptr old_root)
+ static node_ptr rebalance_subtree(const node_ptr & old_root)
    {
       std::size_t len = 0;
       node_ptr new_root = subtree_to_vine(old_root, &len);
       return vine_to_subtree(new_root, len);
    }
 
- static node_ptr subtree_to_vine(node_ptr old_root, std::size_t *plen = 0)
+ static node_ptr subtree_to_vine(const node_ptr & old_root, std::size_t *plen = 0)
    {
       std::size_t len;
       len = 0;
- if(!old_root) return node_ptr(0);
+ if(!old_root) return node_ptr();
 
       //To avoid irregularities in the algorithm (old_root can be a
       //left or right child or even the root of the tree) just put the
@@ -1499,7 +1503,7 @@
       return new_root;
    }
 
- static node_ptr vine_to_subtree(node_ptr old_root, std::size_t count)
+ static node_ptr vine_to_subtree(const node_ptr & old_root, std::size_t count)
    {
       std::size_t leaf_nodes = count + 1 - ((std::size_t) 1 << floor_log2 (count + 1));
       std::size_t vine_nodes = count - leaf_nodes;
@@ -1512,7 +1516,7 @@
       return new_root;
    }
 
- static node_ptr compress_subtree(node_ptr old_root, std::size_t count)
+ static node_ptr compress_subtree(const node_ptr & old_root, std::size_t count)
    {
       if(!old_root) return old_root;
 
@@ -1576,7 +1580,7 @@
    //! <b>Complexity</b>: Logarithmic.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr get_root(node_ptr node)
+ static node_ptr get_root(const node_ptr & node)
    {
       BOOST_INTRUSIVE_INVARIANT_ASSERT((!inited(node)));
       node_ptr x = NodeTraits::get_parent(node);
@@ -1594,7 +1598,7 @@
    private:
    template<class NodePtrCompare>
    static void insert_equal_check_impl
- (bool upper, node_ptr h, node_ptr new_node, NodePtrCompare comp, insert_commit_data & commit_data, std::size_t *pdepth = 0)
+ (bool upper, const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp, insert_commit_data & commit_data, std::size_t *pdepth = 0)
    {
       std::size_t depth = 0;
       node_ptr y(h);
@@ -1625,11 +1629,11 @@
       if(pdepth) *pdepth = depth;
    }
 
- static void erase_impl(node_ptr header, node_ptr z, data_for_rebalance &info)
+ static void erase_impl(const node_ptr & header, const node_ptr & z, data_for_rebalance &info)
    {
       node_ptr y(z);
       node_ptr x;
- node_ptr x_parent(0);
+ node_ptr x_parent = node_ptr();
       node_ptr z_left(NodeTraits::get_left(z));
       node_ptr z_right(NodeTraits::get_right(z));
       if(!z_left){

Modified: trunk/boost/intrusive/detail/tree_node.hpp
==============================================================================
--- trunk/boost/intrusive/detail/tree_node.hpp (original)
+++ trunk/boost/intrusive/detail/tree_node.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -15,7 +15,7 @@
 
 #include <boost/intrusive/detail/config_begin.hpp>
 #include <iterator>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
 
 namespace boost {
@@ -24,9 +24,9 @@
 template<class VoidPointer>
 struct tree_node
 {
- typedef typename pointer_to_other
- <VoidPointer
- ,tree_node<VoidPointer> >::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer
+ <tree_node<VoidPointer> >::type node_ptr;
 
    node_ptr parent_, left_, right_;
 };
@@ -36,27 +36,27 @@
 {
    typedef tree_node<VoidPointer> node;
 
- typedef typename boost::pointer_to_other
- <VoidPointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <VoidPointer, const node>::type const_node_ptr;
+ typedef typename pointer_traits<VoidPointer>::template
+ rebind_pointer<node>::type node_ptr;
+ typedef typename pointer_traits<VoidPointer>::template
+ rebind_pointer<const node>::type const_node_ptr;
 
- static node_ptr get_parent(const_node_ptr n)
+ static const node_ptr & get_parent(const const_node_ptr & n)
    { return n->parent_; }
 
- static void set_parent(node_ptr n, node_ptr p)
+ static void set_parent(const node_ptr & n, const node_ptr & p)
    { n->parent_ = p; }
 
- static node_ptr get_left(const_node_ptr n)
+ static const node_ptr & get_left(const const_node_ptr & n)
    { return n->left_; }
 
- static void set_left(node_ptr n, node_ptr l)
+ static void set_left(const node_ptr & n, const node_ptr & l)
    { n->left_ = l; }
 
- static node_ptr get_right(const_node_ptr n)
+ static const node_ptr & get_right(const const_node_ptr & n)
    { return n->right_; }
 
- static void set_right(node_ptr n, node_ptr r)
+ static void set_right(const node_ptr & n, const node_ptr & r)
    { n->right_ = r; }
 };
 
@@ -84,8 +84,8 @@
    typedef typename real_value_traits::node_traits node_traits;
    typedef typename node_traits::node node;
    typedef typename node_traits::node_ptr node_ptr;
- typedef typename boost::pointer_to_other
- <node_ptr, void>::type void_pointer;
+ typedef typename pointer_traits<node_ptr>::template
+ rebind_pointer<void>::type void_pointer;
    static const bool store_container_ptr =
       detail::store_cont_ptr_on_it<Container>::value;
 
@@ -96,10 +96,10 @@
 
 
    tree_iterator()
- : members_ (node_ptr(0), (const void *)0)
+ : members_ (node_ptr(), (const void *)0)
    {}
 
- explicit tree_iterator(node_ptr nodeptr, const Container *cont_ptr)
+ explicit tree_iterator(const node_ptr & nodeptr, const Container *cont_ptr)
       : members_ (nodeptr, cont_ptr)
    {}
 
@@ -150,7 +150,7 @@
    { return *operator->(); }
 
    pointer operator->() const
- { return detail::boost_intrusive_get_pointer(this->get_real_value_traits()->to_value_ptr(members_.nodeptr_)); }
+ { return this->get_real_value_traits()->to_value_ptr(members_.nodeptr_); }
 
    const Container *get_container() const
    { return static_cast<const Container*>(members_.get_ptr()); }

Modified: trunk/boost/intrusive/detail/utilities.hpp
==============================================================================
--- trunk/boost/intrusive/detail/utilities.hpp (original)
+++ trunk/boost/intrusive/detail/utilities.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -14,13 +14,14 @@
 #define BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP
 
 #include <boost/intrusive/detail/config_begin.hpp>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/detail/parent_from_member.hpp>
 #include <boost/intrusive/detail/ebo_functor_holder.hpp>
 #include <boost/intrusive/link_mode.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
 #include <boost/intrusive/detail/assert.hpp>
 #include <boost/intrusive/detail/is_stateful_value_traits.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/cstdint.hpp>
 #include <cstddef>
 #include <climits>
@@ -104,29 +105,14 @@
    : public Node
 {};
 
-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 boost_intrusive_get_pointer
-template<class Ptr>
-inline typename smart_ptr_type<Ptr>::pointer
-boost_intrusive_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::intrusive::detail::to_raw_pointer(p.operator->()); }
 
 //This functor compares a stored value
 //and the one passed as an argument
@@ -158,7 +144,7 @@
    typedef typename NodeAlgorithms::node_ptr node_ptr;
 
    public:
- void operator()(node_ptr p)
+ void operator()(const node_ptr & p)
    { NodeAlgorithms::init(p); }
 };
 
@@ -258,13 +244,14 @@
       : base_t(f), cont_(cont)
    {}
 
- node_ptr operator()(node_ptr p)
+ node_ptr operator()(const node_ptr & p)
    { return this->operator()(*p); }
 
    node_ptr operator()(const node &to_clone)
    {
       const value_type &v =
- *cont_->get_real_value_traits().to_value_ptr(const_node_ptr(&to_clone));
+ *cont_->get_real_value_traits().to_value_ptr
+ (pointer_traits<const_node_ptr>::pointer_to(to_clone));
       node_ptr n = cont_->get_real_value_traits().to_node_ptr(*base_t::get()(v));
       //Cloned node must be in default mode if the linking mode requires it
       if(safemode_or_autounlink)
@@ -291,7 +278,7 @@
       : base_t(f), cont_(cont)
    {}
 
- void operator()(node_ptr p)
+ void operator()(const node_ptr & p)
    {
       if(safemode_or_autounlink)
          node_algorithms::init(p);
@@ -312,15 +299,15 @@
 template<class VoidPointer>
 struct constptr
 {
- typedef typename boost::pointer_to_other
- <VoidPointer, const void>::type ConstVoidPtr;
+ typedef typename boost::intrusive::pointer_traits<VoidPointer>::
+ template rebind_pointer<const void>::type ConstVoidPtr;
 
    constptr(const void *ptr)
       : const_void_ptr_(ptr)
    {}
 
    const void *get_ptr() const
- { return detail::boost_intrusive_get_pointer(const_void_ptr_); }
+ { return boost::intrusive::detail::to_raw_pointer(const_void_ptr_); }
 
    ConstVoidPtr const_void_ptr_;
 };
@@ -371,27 +358,49 @@
    public:
    typedef detail::node_holder
       <typename NodeTraits::node, Tag, LinkMode, HookType> node_holder;
+ typedef typename NodeTraits::node node;
    typedef NodeTraits node_traits;
    typedef T value_type;
    typedef typename node_traits::node_ptr node_ptr;
    typedef typename node_traits::const_node_ptr const_node_ptr;
- typedef typename boost::pointer_to_other<node_ptr, T>::type pointer;
- typedef typename boost::pointer_to_other<node_ptr, const T>::type const_pointer;
- typedef typename std::iterator_traits<pointer>::reference reference;
- typedef typename std::iterator_traits<const_pointer>::reference const_reference;
+ typedef typename pointer_traits<node_ptr>::
+ template rebind_pointer<T>::type pointer;
+ typedef typename pointer_traits<node_ptr>::
+ template rebind_pointer<const T>::type const_pointer;
+ //typedef typename pointer_traits<pointer>::reference reference;
+ //typedef typename pointer_traits<const_pointer>::reference const_reference;
+ typedef T & reference;
+ typedef const T & const_reference;
+ typedef node_holder & node_holder_reference;
+ typedef const node_holder & const_node_holder_reference;
+ typedef node& node_reference;
+ typedef const node & const_node_reference;
+
    static const link_mode_type link_mode = LinkMode;
 
- static node_ptr to_node_ptr(reference value)
- { return static_cast<node_holder*>(&value); }
+ static pointer to_value_ptr(const node_ptr & n)
+ {
+ return pointer_traits<pointer>::pointer_to
+ (static_cast<reference>(static_cast<node_holder_reference>(*n)));
+ }
 
- static const_node_ptr to_node_ptr(const_reference value)
- { return static_cast<const node_holder*>(&value); }
+ static const_pointer to_value_ptr(const const_node_ptr & n)
+ {
+ return pointer_traits<const_pointer>::pointer_to
+ (static_cast<const_reference>(static_cast<const_node_holder_reference>(*n)));
+ }
 
- static pointer to_value_ptr(node_ptr n)
- { return static_cast<T*>(static_cast<node_holder*>(&*n)); }
+ static node_ptr to_node_ptr(reference value)
+ {
+ return pointer_traits<node_ptr>::pointer_to
+ (static_cast<node_reference>(static_cast<node_holder_reference>(value)));
+ }
 
- static const_pointer to_value_ptr(const_node_ptr n)
- { return static_cast<const T*>(static_cast<const node_holder*>(&*n)); }
+ static const_node_ptr to_node_ptr(const_reference value)
+ {
+ return pointer_traits<const_node_ptr>::pointer_to
+ (static_cast<const_node_reference>(static_cast<const_node_holder_reference>(value)));
+ }
 };
 
 template<class T, class Hook, Hook T::* P>
@@ -404,28 +413,43 @@
    typedef T value_type;
    typedef typename node_traits::node_ptr node_ptr;
    typedef typename node_traits::const_node_ptr const_node_ptr;
- typedef typename boost::pointer_to_other<node_ptr, T>::type pointer;
- typedef typename boost::pointer_to_other<node_ptr, const T>::type const_pointer;
- typedef typename std::iterator_traits<pointer>::reference reference;
- typedef typename std::iterator_traits<const_pointer>::reference const_reference;
+ typedef typename pointer_traits<node_ptr>::
+ template rebind_pointer<T>::type pointer;
+ typedef typename pointer_traits<node_ptr>::
+ template rebind_pointer<const T>::type const_pointer;
+ typedef T & reference;
+ typedef const T & const_reference;
+ typedef node& node_reference;
+ typedef const node & const_node_reference;
+ typedef hook_type& hook_reference;
+ typedef const hook_type & const_hook_reference;
+
    static const link_mode_type link_mode = Hook::boost_intrusive_tags::link_mode;
 
    static node_ptr to_node_ptr(reference value)
- { return static_cast<node*>(&(value.*P)); }
+ {
+ return pointer_traits<node_ptr>::pointer_to
+ (static_cast<node_reference>(static_cast<hook_reference>(value.*P)));
+ }
 
    static const_node_ptr to_node_ptr(const_reference value)
- { return static_cast<const node*>(&(value.*P)); }
+ {
+ return pointer_traits<const_node_ptr>::pointer_to
+ (static_cast<const_node_reference>(static_cast<const_hook_reference>(value.*P)));
+ }
 
- static pointer to_value_ptr(node_ptr n)
+ static pointer to_value_ptr(const node_ptr & n)
    {
- return detail::parent_from_member<T, Hook>
- (static_cast<Hook*>(detail::boost_intrusive_get_pointer(n)), P);
+ return pointer_traits<pointer>::pointer_to
+ (*detail::parent_from_member<T, Hook>
+ (static_cast<Hook*>(boost::intrusive::detail::to_raw_pointer(n)), P));
    }
 
- static const_pointer to_value_ptr(const_node_ptr n)
+ static const_pointer to_value_ptr(const const_node_ptr & n)
    {
- return detail::parent_from_member<T, Hook>
- (static_cast<const Hook*>(detail::boost_intrusive_get_pointer(n)), P);
+ return pointer_traits<const_pointer>::pointer_to
+ (*detail::parent_from_member<T, Hook>
+ (static_cast<const Hook*>(boost::intrusive::detail::to_raw_pointer(n)), P));
    }
 };
 
@@ -441,29 +465,31 @@
    typedef typename Functor::value_type value_type;
    typedef typename node_traits::node_ptr node_ptr;
    typedef typename node_traits::const_node_ptr const_node_ptr;
- typedef typename boost::pointer_to_other<node_ptr, value_type>::type pointer;
- typedef typename boost::pointer_to_other<node_ptr, const value_type>::type const_pointer;
- typedef typename std::iterator_traits<pointer>::reference reference;
- typedef typename std::iterator_traits<const_pointer>::reference const_reference;
+ typedef typename pointer_traits<node_ptr>::
+ template rebind_pointer<value_type>::type pointer;
+ typedef typename pointer_traits<node_ptr>::
+ template rebind_pointer<const value_type>::type const_pointer;
+ typedef value_type & reference;
+ typedef const value_type & const_reference;
    static const link_mode_type link_mode = hook_type::boost_intrusive_tags::link_mode;
 
    static node_ptr to_node_ptr(reference value)
- { return static_cast<node*>(&*Functor::to_hook_ptr(value)); }
+ { return static_cast<node*>(boost::intrusive::detail::to_raw_pointer(Functor::to_hook_ptr(value))); }
 
    static const_node_ptr to_node_ptr(const_reference value)
- { return static_cast<const node*>(&*Functor::to_hook_ptr(value)); }
+ { return static_cast<const node*>(boost::intrusive::detail::to_raw_pointer(Functor::to_hook_ptr(value))); }
 
- static pointer to_value_ptr(node_ptr n)
+ static pointer to_value_ptr(const node_ptr & n)
    { return Functor::to_value_ptr(to_hook_ptr(n)); }
 
- static const_pointer to_value_ptr(const_node_ptr n)
+ static const_pointer to_value_ptr(const const_node_ptr & n)
    { return Functor::to_value_ptr(to_hook_ptr(n)); }
 
    private:
- static hook_ptr to_hook_ptr(node_ptr n)
+ static hook_ptr to_hook_ptr(const node_ptr & n)
    { return hook_ptr(&*static_cast<hook_type*>(&*n)); }
 
- static const_hook_ptr to_hook_ptr(const_node_ptr n)
+ static const_hook_ptr to_hook_ptr(const const_node_ptr & n)
    { return const_hook_ptr(&*static_cast<const hook_type*>(&*n)); }
 };
 
@@ -624,8 +650,8 @@
 template<class Container, bool IsConst>
 struct node_to_value
    : public detail::select_constptr
- < typename boost::pointer_to_other
- <typename Container::pointer, void>::type
+ < typename pointer_traits
+ <typename Container::pointer>::template rebind_pointer<void>::type
       , detail::store_cont_ptr_on_it<Container>::value
>::type
 {
@@ -635,16 +661,16 @@
    typedef typename Container::real_value_traits real_value_traits;
    typedef typename real_value_traits::value_type value_type;
    typedef typename detail::select_constptr
- < typename boost::pointer_to_other
- <typename Container::pointer, void>::type
+ < typename pointer_traits
+ <typename Container::pointer>::template rebind_pointer<void>::type
       , store_container_ptr >::type Base;
    typedef typename real_value_traits::node_traits::node node;
    typedef typename detail::add_const_if_c
          <value_type, IsConst>::type vtype;
    typedef typename detail::add_const_if_c
          <node, IsConst>::type ntype;
- typedef typename boost::pointer_to_other
- <typename Container::pointer, ntype>::type npointer;
+ typedef typename pointer_traits
+ <typename Container::pointer>::template rebind_pointer<ntype>::type npointer;
 
    node_to_value(const Container *cont)
       : Base(cont)
@@ -670,7 +696,10 @@
    }
 
    result_type operator()(first_argument_type arg) const
- { return *(this->get_real_value_traits()->to_value_ptr(npointer(&arg))); }
+ {
+ return *(this->get_real_value_traits()->to_value_ptr
+ (pointer_traits<npointer>::pointer_to(arg)));
+ }
 };
 
 //This is not standard, but should work with all compilers
@@ -732,6 +761,115 @@
    detail::max_align rawbuf[(N*sizeof(T)-1)/sizeof(detail::max_align)+1];
 };
 
+
+
+
+template<class It>
+class reverse_iterator
+ : public std::iterator<
+ typename std::iterator_traits<It>::iterator_category,
+ typename std::iterator_traits<It>::value_type,
+ typename std::iterator_traits<It>::difference_type,
+ typename std::iterator_traits<It>::pointer,
+ typename std::iterator_traits<It>::reference>
+{
+ public:
+ typedef typename std::iterator_traits<It>::pointer pointer;
+ typedef typename std::iterator_traits<It>::reference reference;
+ typedef typename std::iterator_traits<It>::difference_type difference_type;
+ typedef It iterator_type;
+
+ reverse_iterator(){}
+
+ explicit reverse_iterator(It r)
+ : m_current(r)
+ {}
+
+ template<class OtherIt>
+ reverse_iterator(const reverse_iterator<OtherIt>& r)
+ : m_current(r.base())
+ {}
+
+ It base() const
+ { return m_current; }
+
+ reference operator*() const
+ { It temp(m_current); --temp; return *temp; }
+
+ pointer operator->() const
+ { It temp(m_current); --temp; return temp.operator->(); }
+
+ reference operator[](difference_type off) const
+ { return this->m_current[-off]; }
+
+ reverse_iterator& operator++()
+ { --m_current; return *this; }
+
+ reverse_iterator operator++(int)
+ {
+ reverse_iterator temp = *this;
+ --m_current;
+ return temp;
+ }
+
+ reverse_iterator& operator--()
+ {
+ ++m_current;
+ return *this;
+ }
+
+ reverse_iterator operator--(int)
+ {
+ reverse_iterator temp(*this);
+ ++m_current;
+ return temp;
+ }
+
+ friend bool operator==(const reverse_iterator& l, const reverse_iterator& r)
+ { return l.m_current == r.m_current; }
+
+ friend bool operator!=(const reverse_iterator& l, const reverse_iterator& r)
+ { return l.m_current != r.m_current; }
+
+ friend bool operator<(const reverse_iterator& l, const reverse_iterator& r)
+ { return l.m_current < r.m_current; }
+
+ friend bool operator<=(const reverse_iterator& l, const reverse_iterator& r)
+ { return l.m_current <= r.m_current; }
+
+ friend bool operator>(const reverse_iterator& l, const reverse_iterator& r)
+ { return l.m_current > r.m_current; }
+
+ friend bool operator>=(const reverse_iterator& l, const reverse_iterator& r)
+ { return l.m_current >= r.m_current; }
+
+ reverse_iterator& operator+=(difference_type off)
+ { m_current -= off; return *this; }
+
+ friend reverse_iterator operator+(const reverse_iterator & l, difference_type off)
+ {
+ reverse_iterator tmp(l.m_current);
+ tmp.m_current -= off;
+ return tmp;
+ }
+
+ reverse_iterator& operator-=(difference_type off)
+ { m_current += off; return *this; }
+
+ friend reverse_iterator operator-(const reverse_iterator & l, difference_type off)
+ {
+ reverse_iterator tmp(l.m_current);
+ tmp.m_current += off;
+ return tmp;
+ }
+
+ friend difference_type operator-(const reverse_iterator& l, const reverse_iterator& r)
+ { return r.m_current - l.m_current; }
+
+ private:
+ It m_current; // the wrapped iterator
+};
+
 } //namespace detail
 } //namespace intrusive
 } //namespace boost

Modified: trunk/boost/intrusive/detail/workaround.hpp
==============================================================================
--- trunk/boost/intrusive/detail/workaround.hpp (original)
+++ trunk/boost/intrusive/detail/workaround.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -11,20 +11,12 @@
 #ifndef BOOST_INTRUSIVE_DETAIL_WRKRND_HPP
 #define BOOST_INTRUSIVE_DETAIL_WRKRND_HPP
 
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)
-// C++0x features are only enabled when -std=c++0x or -std=gnu++0x are
-// passed on the command line, which in turn defines
-// __GXX_EXPERIMENTAL_CXX0X__. Note: __GXX_EXPERIMENTAL_CPP0X__ is
-// defined by some very early development versions of GCC 4.3; we will
-// remove this part of the check in the near future.
-# if defined(__GXX_EXPERIMENTAL_CPP0X__) || defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define BOOST_INTRUSIVE_RVALUE_REFERENCE
-# define BOOST_INTRUSIVE_VARIADIC_TEMPLATES
-# endif
-#endif
+#include <boost/intrusive/detail/config_begin.hpp>
 
-#if defined(BOOST_INTRUSIVE_RVALUE_REFERENCE) && defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
-#define BOOST_INTRUSIVE_PERFECT_FORWARDING
+#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)
+ #define BOOST_INTRUSIVE_PERFECT_FORWARDING
 #endif
 
+#include <boost/intrusive/detail/config_end.hpp>
+
 #endif //#ifndef BOOST_INTRUSIVE_DETAIL_WRKRND_HPP

Modified: trunk/boost/intrusive/hashtable.hpp
==============================================================================
--- trunk/boost/intrusive/hashtable.hpp (original)
+++ trunk/boost/intrusive/hashtable.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -18,7 +18,6 @@
 #include <utility> //std::pair
 #include <algorithm> //std::swap, std::lower_bound, std::upper_bound
 #include <cstddef> //std::size_t
-#include <iterator> //std::iterator_traits
 //boost
 #include <boost/intrusive/detail/assert.hpp>
 #include <boost/static_assert.hpp>
@@ -26,7 +25,6 @@
 #include <boost/pointer_cast.hpp>
 //General intrusive utilities
 #include <boost/intrusive/intrusive_fwd.hpp>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
 #include <boost/intrusive/detail/hashtable_node.hpp>
 #include <boost/intrusive/detail/transform_iterator.hpp>
 #include <boost/intrusive/link_mode.hpp>
@@ -36,6 +34,7 @@
 #include <boost/intrusive/trivial_value_traits.hpp>
 #include <boost/intrusive/unordered_set_hook.hpp>
 #include <boost/intrusive/slist.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
 #include <boost/type_traits.hpp>
 #include <boost/move/move.hpp>
@@ -125,7 +124,8 @@
       < typename NodeTraits::node
       , boost::intrusive::value_traits<trivial_traits>
       , boost::intrusive::constant_time_size<false>
- , boost::intrusive::size_type<typename boost::make_unsigned<typename std::iterator_traits<typename NodeTraits::node_ptr>::difference_type>::type>
+ , boost::intrusive::size_type<typename boost::make_unsigned
+ <typename pointer_traits<typename NodeTraits::node_ptr>::difference_type>::type >
>::type
    {};
 };
@@ -174,8 +174,10 @@
       <SupposedValueTraits>::type::node_ptr node_ptr;
    typedef typename unordered_bucket_impl
       <SupposedValueTraits>::type bucket_type;
- typedef typename boost::pointer_to_other
- <node_ptr, bucket_type>::type implementation_defined;
+
+ typedef typename pointer_traits
+ <node_ptr>::template rebind_pointer
+ < bucket_type >::type implementation_defined;
    typedef implementation_defined type;
 };
 
@@ -267,6 +269,11 @@
       : detail::ebo_functor_holder<typename Config::equal>(e)//equal()
       , bucket_hash(::boost::forward<BucketTraits>(b_traits), h)
    {}
+
+ template<class T>
+ void set_cache(T)
+ {}
+
    bucket_hash_t<Config> bucket_hash;
 };
 
@@ -285,6 +292,10 @@
       : detail::ebo_functor_holder<typename Config::equal>(e) //equal()
       , bucket_hash(::boost::forward<BucketTraits>(b_traits), h)
    {}
+
+ void set_cache(const bucket_ptr & c)
+ { cached_begin_ = c; }
+
    bucket_hash_t<Config> bucket_hash;
    bucket_ptr cached_begin_;
 };
@@ -344,16 +355,11 @@
    typedef typename reduced_node_traits::node slist_node;
    typedef circular_slist_algorithms<group_traits> group_algorithms;
 
- static node_ptr dcast_bucket_ptr(slist_node_ptr p)
- {
-// This still fails in gcc < 4.4 so forget about it
-// using ::boost::static_pointer_cast;
-// return static_pointer_cast<node>(p);
- return node_ptr(&static_cast<node&>(*p));
- }
+ static node_ptr dcast_bucket_ptr(const slist_node_ptr &p)
+ { return pointer_traits<node_ptr>::pointer_to(static_cast<node&>(*p)); }
 
- static slist_node_ptr priv_get_bucket_before_begin
- (slist_node_ptr bucket_beg, slist_node_ptr bucket_end, node_ptr p)
+ static slist_node_ptr get_bucket_before_begin
+ (const slist_node_ptr &bucket_beg, const slist_node_ptr &bucket_end, const node_ptr &p)
    {
       //First find the last node of p's group.
       //This requires checking the first node of the next group or
@@ -384,7 +390,7 @@
       return possible_end;
    }
 
- static node_ptr priv_get_prev_to_first_in_group(slist_node_ptr bucket_node, node_ptr first_in_group)
+ static node_ptr get_prev_to_first_in_group(const slist_node_ptr &bucket_node, const node_ptr &first_in_group)
    {
       //Just iterate using group links and obtain the node
       //before "first_in_group)"
@@ -397,7 +403,7 @@
       return prev_node;
    }
 
- static node_ptr priv_get_first_in_group_of_last_in_group(node_ptr last_in_group)
+ static node_ptr get_first_in_group_of_last_in_group(const node_ptr &last_in_group)
    {
       //Just iterate using group links and obtain the node
       //before "last_in_group"
@@ -413,8 +419,7 @@
       return possible_first;
    }
 
-
- static void priv_erase_from_group(slist_node_ptr end_ptr, node_ptr to_erase_ptr, detail::true_)
+ static void erase_from_group(const slist_node_ptr &end_ptr, const node_ptr &to_erase_ptr, detail::true_)
    {
       node_ptr nxt_ptr(node_traits::get_next(to_erase_ptr));
       node_ptr prev_in_group_ptr(group_traits::get_next(to_erase_ptr));
@@ -430,7 +435,7 @@
       }
       else if(last_in_group){
          node_ptr first_in_group =
- priv_get_first_in_group_of_last_in_group(to_erase_ptr);
+ get_first_in_group_of_last_in_group(to_erase_ptr);
          group_algorithms::unlink_after(first_in_group);
       }
       else{
@@ -438,14 +443,87 @@
       }
    }
 
- static void priv_erase_from_group(slist_node_ptr, node_ptr, detail::false_)
+ static void erase_from_group(const slist_node_ptr&, const node_ptr&, detail::false_)
    {}
 
- static node_ptr priv_get_last_in_group(node_ptr first_in_group, detail::true_)
+ static node_ptr get_last_in_group(const node_ptr &first_in_group, detail::true_)
    { return group_traits::get_next(first_in_group); }
 
- static node_ptr priv_get_last_in_group(node_ptr n, detail::false_)
+ static node_ptr get_last_in_group(const node_ptr &n, detail::false_)
    { return n; }
+
+ static void init_group(const node_ptr &n, true_)
+ { group_algorithms::init(n); }
+
+ static void init_group(const node_ptr &, false_)
+ {}
+
+ static void insert_in_group(const node_ptr &first_in_group, const node_ptr &n, true_)
+ {
+ if(first_in_group){
+ if(group_algorithms::unique(first_in_group))
+ group_algorithms::link_after(first_in_group, n);
+ else{
+ group_algorithms::link_after(group_algorithms::node_traits::get_next(first_in_group), n);
+ }
+ }
+ else{
+ group_algorithms::init_header(n);
+ }
+ }
+
+ static slist_node_ptr get_previous_and_next_in_group
+ ( const slist_node_ptr &i, node_ptr &nxt_in_group
+ //If first_end_ptr == last_end_ptr, then first_end_ptr is the bucket of i
+ //Otherwise first_end_ptr is the first bucket and last_end_ptr the last one.
+ , const slist_node_ptr &first_end_ptr, const slist_node_ptr &last_end_ptr)
+ {
+ slist_node_ptr prev;
+ node_ptr elem(dcast_bucket_ptr(i));
+
+ //It's the last in group if the next_node is a bucket
+ slist_node_ptr nxt(node_traits::get_next(elem));
+ bool last_in_group = (first_end_ptr <= nxt && nxt <= last_end_ptr)/* ||
+ (group_traits::get_next(nxt) != elem)*/;
+ //It's the first in group if group_previous's next_node is not
+ //itself, as group list does not link bucket
+ node_ptr prev_in_group(group_traits::get_next(elem));
+ bool first_in_group = node_traits::get_next(prev_in_group) != elem;
+
+ if(first_in_group){
+ node_ptr start_pos;
+ if(last_in_group){
+ start_pos = elem;
+ nxt_in_group = node_ptr();
+ }
+ else{
+ start_pos = prev_in_group;
+ nxt_in_group = node_traits::get_next(elem);
+ }
+ slist_node_ptr bucket_node;
+ if(first_end_ptr != last_end_ptr){
+ bucket_node = group_functions::get_bucket_before_begin
+ (first_end_ptr, last_end_ptr, start_pos);
+ }
+ else{
+ bucket_node = first_end_ptr;
+ }
+ prev = group_functions::get_prev_to_first_in_group(bucket_node, elem);
+ }
+ else{
+ if(last_in_group){
+ nxt_in_group = group_functions::get_first_in_group_of_last_in_group(elem);
+ }
+ else{
+ nxt_in_group = node_traits::get_next(elem);
+ }
+ prev = group_traits::get_next(elem);
+ }
+ return prev;
+ }
+
+ static void insert_in_group(const node_ptr&, const node_ptr&, false_)
+ {}
 };
 
 template<class BucketType, class SplitTraits>
@@ -486,6 +564,16 @@
    bool released_;
 };
 
+template<class NodeTraits>
+struct node_functions
+{
+ static void store_hash(typename NodeTraits::node_ptr p, std::size_t h, true_)
+ { return NodeTraits::set_hash(p, h); }
+
+ static void store_hash(typename NodeTraits::node_ptr, std::size_t, false_)
+ {}
+};
+
 } //namespace detail {
 
 //!This metafunction will obtain the type of a bucket
@@ -620,27 +708,30 @@
 
    typedef typename real_value_traits::pointer pointer;
    typedef typename real_value_traits::const_pointer const_pointer;
- typedef typename real_value_traits::value_type value_type;
- typedef typename std::iterator_traits<pointer>::reference reference;
- typedef typename std::iterator_traits<const_pointer>::reference const_reference;
- typedef typename std::iterator_traits<pointer>::difference_type difference_type;
+ typedef typename real_value_traits::value_type value_type;
+ typedef typename pointer_traits<pointer>::reference reference;
+ typedef typename pointer_traits<const_pointer>::reference const_reference;
+ typedef typename pointer_traits<pointer>::difference_type difference_type;
    typedef typename Config::size_type size_type;
    typedef value_type key_type;
    typedef typename Config::equal key_equal;
    typedef typename Config::hash hasher;
    typedef detail::bucket_impl<slist_impl> bucket_type;
- typedef typename boost::pointer_to_other
- <pointer, bucket_type>::type bucket_ptr;
+ typedef typename pointer_traits
+ <pointer>::template rebind_pointer
+ < bucket_type >::type bucket_ptr;
    typedef typename slist_impl::iterator siterator;
    typedef typename slist_impl::const_iterator const_siterator;
    typedef detail::hashtable_iterator<hashtable_impl, false> iterator;
    typedef detail::hashtable_iterator<hashtable_impl, true> const_iterator;
    typedef typename real_value_traits::node_traits node_traits;
    typedef typename node_traits::node node;
- typedef typename boost::pointer_to_other
- <pointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <node_ptr, const node>::type const_node_ptr;
+ typedef typename pointer_traits
+ <pointer>::template rebind_pointer
+ < node >::type node_ptr;
+ typedef typename pointer_traits
+ <pointer>::template rebind_pointer
+ < const node >::type const_node_ptr;
    typedef typename slist_impl::node_algorithms node_algorithms;
 
    static const bool stateful_value_traits = detail::is_stateful_value_traits<real_value_traits>::value;
@@ -664,8 +755,9 @@
    BOOST_STATIC_ASSERT((!compare_hash || store_hash));
 
    typedef typename slist_impl::node_ptr slist_node_ptr;
- typedef typename boost::pointer_to_other
- <slist_node_ptr, void>::type void_pointer;
+ typedef typename pointer_traits
+ <slist_node_ptr>::template rebind_pointer
+ < void >::type void_pointer;
    //We'll define group traits, but these won't be instantiated if
    //optimize_multikey is not true
    typedef unordered_group_adapter<node_traits> group_traits;
@@ -677,6 +769,7 @@
    typedef detail::size_holder<constant_time_size, size_type> size_traits;
    typedef detail::size_holder<incremental, size_type> split_traits;
    typedef detail::group_functions<node_traits> group_functions_t;
+ typedef detail::node_functions<node_traits> node_functions_t;
 
    static const std::size_t hashtable_data_bool_flags_mask =
       ( detail::hash_bool_flags::cache_begin_pos
@@ -721,7 +814,9 @@
       { return base_t::operator()(static_cast<const node &>(to_clone)); }
 
       void operator()(typename slist_impl::node_ptr to_clone)
- { base_t::operator()(node_ptr(&static_cast<node &>(*to_clone))); }
+ {
+ base_t::operator()(pointer_traits<node_ptr>::pointer_to(static_cast<node &>(*to_clone)));
+ }
    };
 
    private:
@@ -757,16 +852,16 @@
 
    /// @cond
 
- const real_value_traits &get_real_value_traits(detail::bool_<false>) const
+ const real_value_traits &get_real_value_traits(detail::false_) const
    { return this->data_; }
 
- const real_value_traits &get_real_value_traits(detail::bool_<true>) const
+ const real_value_traits &get_real_value_traits(detail::true_) const
    { return data_.get_value_traits(*this); }
 
- real_value_traits &get_real_value_traits(detail::bool_<false>)
+ real_value_traits &get_real_value_traits(detail::false_)
    { return this->data_; }
 
- real_value_traits &get_real_value_traits(detail::bool_<true>)
+ real_value_traits &get_real_value_traits(detail::true_)
    { return data_.get_value_traits(*this); }
 
    /// @endcond
@@ -931,7 +1026,7 @@
       }
       else{
          size_type buckets_len = this->priv_buckets_len();
- const bucket_type *b = detail::boost_intrusive_get_pointer(this->priv_buckets());
+ const bucket_type *b = boost::intrusive::detail::to_raw_pointer(this->priv_buckets());
          for (size_type n = 0; n < buckets_len; ++n, ++b){
             if(!b->empty()){
                return false;
@@ -954,7 +1049,7 @@
       else{
          size_type len = 0;
          size_type buckets_len = this->priv_buckets_len();
- const bucket_type *b = detail::boost_intrusive_get_pointer(this->priv_buckets());
+ const bucket_type *b = boost::intrusive::detail::to_raw_pointer(this->priv_buckets());
          for (size_type n = 0; n < buckets_len; ++n, ++b){
             len += b->size();
          }
@@ -1258,12 +1353,12 @@
       size_type bucket_num = priv_hash_to_bucket(commit_data.hash);
       bucket_type &b = this->priv_buckets()[bucket_num];
       this->priv_size_traits().increment();
- node_ptr n = node_ptr(&priv_value_to_node(value));
- this->priv_store_hash(n, commit_data.hash, store_hash_t());
+ node_ptr n = pointer_traits<node_ptr>::pointer_to(priv_value_to_node(value));
+ node_functions_t::store_hash(n, commit_data.hash, store_hash_t());
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n));
       priv_insertion_update_cache(bucket_num);
- this->priv_insert_in_group(node_ptr(0), n, optimize_multikey_t());
+ group_functions_t::insert_in_group(node_ptr(), n, optimize_multikey_t());
       return iterator(b.insert_after(b.before_begin(), *n), this);
    }
 
@@ -1442,7 +1537,7 @@
       }
       else if(optimize_multikey){
          siterator last = bucket_type::s_iterator_to
- (*node_traits::get_next(group_functions_t::priv_get_last_in_group
+ (*node_traits::get_next(group_functions_t::get_last_in_group
                (dcast_bucket_ptr(it.pointed_node()), optimize_multikey_t())));
          this->priv_erase_range_impl(bucket_num, prev, last, disposer, count);
       }
@@ -2012,7 +2107,7 @@
                if(cache_begin && new_n < new_first_bucket_num)
                   new_first_bucket_num = new_n;
                siterator last = bucket_type::s_iterator_to
- (*group_functions_t::priv_get_last_in_group
+ (*group_functions_t::get_last_in_group
                      (dcast_bucket_ptr(i.pointed_node()), optimize_multikey_t()));
                if(same_buffer && new_n == n){
                   before_i = last;
@@ -2086,7 +2181,7 @@
             const std::size_t hash_value = this->priv_stored_or_compute_hash(v, store_hash_t());
             const size_type new_n = priv_hash_to_bucket(hash_value);
             siterator last = bucket_type::s_iterator_to
- (*group_functions_t::priv_get_last_in_group
+ (*group_functions_t::get_last_in_group
                   (dcast_bucket_ptr(i.pointed_node()), optimize_multikey_t()));
             if(new_n == bucket_to_rehash){
                before_i = last;
@@ -2234,10 +2329,10 @@
       return bucket_number;
    }
 
- std::size_t priv_hash_to_bucket_impl(std::size_t hash_value, std::size_t bucket_len, detail::bool_<false>) const
+ std::size_t priv_hash_to_bucket_impl(std::size_t hash_value, std::size_t bucket_len, detail::false_) const
    { return hash_value % bucket_len; }
 
- std::size_t priv_hash_to_bucket_impl(std::size_t hash_value, std::size_t bucket_len, detail::bool_<true>) const
+ std::size_t priv_hash_to_bucket_impl(std::size_t hash_value, std::size_t bucket_len, detail::true_) const
    { return hash_value & (bucket_len - 1); }
 
    const key_equal &priv_equal() const
@@ -2258,16 +2353,16 @@
    const value_type &priv_value_from_slist_node(slist_node_ptr n) const
    { return *this->get_real_value_traits().to_value_ptr(dcast_bucket_ptr(n)); }
 
- const real_bucket_traits &priv_real_bucket_traits(detail::bool_<false>) const
+ const real_bucket_traits &priv_real_bucket_traits(detail::false_) const
    { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_; }
 
- const real_bucket_traits &priv_real_bucket_traits(detail::bool_<true>) const
+ const real_bucket_traits &priv_real_bucket_traits(detail::true_) const
    { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_.get_bucket_traits(*this); }
 
- real_bucket_traits &priv_real_bucket_traits(detail::bool_<false>)
+ real_bucket_traits &priv_real_bucket_traits(detail::false_)
    { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_; }
 
- real_bucket_traits &priv_real_bucket_traits(detail::bool_<true>)
+ real_bucket_traits &priv_real_bucket_traits(detail::true_)
    { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_.get_bucket_traits(*this); }
 
    const real_bucket_traits &priv_real_bucket_traits() const
@@ -2294,8 +2389,8 @@
    size_type priv_buckets_len() const
    { return this->priv_real_bucket_traits().bucket_count(); }
 
- static node_ptr uncast(const_node_ptr ptr)
- { return node_ptr(const_cast<node*>(detail::boost_intrusive_get_pointer(ptr))); }
+ static node_ptr uncast(const const_node_ptr & ptr)
+ { return node_ptr(const_cast<node*>(boost::intrusive::detail::to_raw_pointer(ptr))); }
 
    node &priv_value_to_node(value_type &v)
    { return *this->get_real_value_traits().to_node_ptr(v); }
@@ -2331,7 +2426,7 @@
          ++to_erase;
          slist_node_ptr end_ptr = end.pointed_node();
          while(to_erase != end){
- group_functions_t::priv_erase_from_group(end_ptr, dcast_bucket_ptr(to_erase.pointed_node()), optimize_multikey_t());
+ group_functions_t::erase_from_group(end_ptr, dcast_bucket_ptr(to_erase.pointed_node()), optimize_multikey_t());
             to_erase = b.erase_after_and_dispose(before_first_it, make_node_disposer(disposer));
             ++num_erased;
          }
@@ -2353,7 +2448,7 @@
          ++nxt;
          siterator end(b.end());
          while(nxt != end){
- priv_init_group(nxt.pointed_node(), optimize_multikey_t());
+ group_functions_t::init_group(dcast_bucket_ptr(nxt.pointed_node()), optimize_multikey_t());
             nxt = b.erase_after_and_dispose
                (b_begin, make_node_disposer(disposer));
             this->priv_size_traits().decrement();
@@ -2381,12 +2476,7 @@
    }
 
    static node_ptr dcast_bucket_ptr(typename slist_impl::node_ptr p)
- {
-// This still fails in gcc < 4.4 so forget about it
-// using ::boost::static_pointer_cast;
-// return static_pointer_cast<node>(p);
- return node_ptr(&static_cast<node&>(*p));
- }
+ { return pointer_traits<node_ptr>::pointer_to(static_cast<node&>(*p)); }
 
    std::size_t priv_stored_or_compute_hash(const value_type &v, detail::true_) const
    { return node_traits::get_hash(this->get_real_value_traits().to_node_ptr(v)); }
@@ -2404,12 +2494,6 @@
       return 0;
    }
 
- static void priv_store_hash(node_ptr p, std::size_t h, detail::true_)
- { return node_traits::set_hash(p, h); }
-
- static void priv_store_hash(node_ptr, std::size_t, detail::false_)
- {}
-
    static void priv_clear_group_nodes(bucket_type &b, detail::true_)
    {
       siterator it(b.begin()), itend(b.end());
@@ -2438,7 +2522,7 @@
    std::size_t priv_get_bucket_num_no_hash_store(siterator it, detail::true_)
    {
       bucket_ptr f(priv_buckets()), l(f + priv_buckets_len() - 1);
- slist_node_ptr bb = group_functions_t::priv_get_bucket_before_begin
+ slist_node_ptr bb = group_functions_t::get_bucket_before_begin
          ( f->end().pointed_node()
          , l->end().pointed_node()
          , dcast_bucket_ptr(it.pointed_node()));
@@ -2468,29 +2552,6 @@
       return static_cast<std::size_t>(&b - &*f);
    }
 
- void priv_init_group(slist_node_ptr n, detail::true_)
- { group_algorithms::init(dcast_bucket_ptr(n)); }
-
- void priv_init_group(slist_node_ptr, detail::false_)
- {}
-
- void priv_insert_in_group(node_ptr first_in_group, node_ptr n, detail::true_)
- {
- if(first_in_group){
- if(group_algorithms::unique(first_in_group))
- group_algorithms::link_after(first_in_group, n);
- else{
- group_algorithms::link_after(node_traits::get_next(first_in_group), n);
- }
- }
- else{
- group_algorithms::init_header(n);
- }
- }
-
- void priv_insert_in_group(node_ptr, node_ptr, detail::false_)
- {}
-
    siterator priv_get_previous
       (bucket_type &b, siterator i)
    { return priv_get_previous(b, i, optimize_multikey_t()); }
@@ -2502,7 +2563,7 @@
       node_ptr prev_in_group(group_traits::get_next(elem));
       bool first_in_group = node_traits::get_next(prev_in_group) != elem;
       typename bucket_type::node &n = first_in_group
- ? *group_functions_t::priv_get_prev_to_first_in_group(b.end().pointed_node(), elem)
+ ? *group_functions_t::get_prev_to_first_in_group(b.end().pointed_node(), elem)
          : *group_traits::get_next(elem)
          ;
       return bucket_type::s_iterator_to(n);
@@ -2533,7 +2594,7 @@
 
    static siterator priv_get_last(bucket_type &b, detail::false_)
    { return b.previous(b.end()); }
-
+/*
    siterator priv_get_previous_and_next_in_group
       (siterator i, node_ptr &nxt_in_group)
    {
@@ -2554,7 +2615,7 @@
          node_ptr start_pos;
          if(last_in_group){
             start_pos = elem;
- nxt_in_group = 0;
+ nxt_in_group = node_ptr();
          }
          else{
             start_pos = prev_in_group;
@@ -2568,15 +2629,15 @@
                ].before_begin().pointed_node();
          }
          else{
- bucket_node = group_functions_t::priv_get_bucket_before_begin
+ bucket_node = group_functions_t::get_bucket_before_begin
                   (first_end_ptr, last_end_ptr, start_pos);
          }
          prev = bucket_type::s_iterator_to
- (*group_functions_t::priv_get_prev_to_first_in_group(bucket_node, elem));
+ (*group_functions_t::get_prev_to_first_in_group(bucket_node, elem));
       }
       else{
          if(last_in_group){
- nxt_in_group = group_functions_t::priv_get_first_in_group_of_last_in_group(elem);
+ nxt_in_group = group_functions_t::get_first_in_group_of_last_in_group(elem);
          }
          else{
             nxt_in_group = node_traits::get_next(elem);
@@ -2585,7 +2646,9 @@
       }
       return prev;
    }
+*/
 
+/*
    template<class Disposer>
    void priv_erase(const_iterator i, Disposer disposer, detail::true_)
    {
@@ -2598,6 +2661,47 @@
       if(safemode_or_autounlink)
          group_algorithms::init(dcast_bucket_ptr(elem.pointed_node()));
    }
+*/
+
+/*
+ if(store_hash){
+ bucket_node = this->priv_buckets()
+ [this->priv_hash_to_bucket
+ (this->priv_stored_hash(elem, store_hash_t()))
+ ].before_begin().pointed_node();
+ }
+ else{
+ bucket_node = group_functions_t::get_bucket_before_begin
+ (first_end_ptr, last_end_ptr, start_pos);
+ }
+*/
+ template<class Disposer>
+ void priv_erase(const_iterator i, Disposer disposer, detail::true_)
+ {
+ slist_node_ptr elem(i.slist_it().pointed_node());
+ slist_node_ptr f_bucket_end, l_bucket_end;
+ if(store_hash){
+ f_bucket_end = l_bucket_end =
+ (this->priv_buckets()
+ [this->priv_hash_to_bucket
+ (this->priv_stored_hash(elem, store_hash_t()))
+ ]).before_begin().pointed_node();
+ }
+ else{
+ f_bucket_end = this->priv_buckets()->cend().pointed_node();
+ l_bucket_end = f_bucket_end + priv_buckets_len() - 1;
+ }
+ node_ptr nxt_in_group;
+ siterator prev = bucket_type::s_iterator_to
+ (*group_functions_t::get_previous_and_next_in_group
+ ( elem, nxt_in_group, f_bucket_end, l_bucket_end)
+ );
+ bucket_type::s_erase_after_and_dispose(prev, make_node_disposer(disposer));
+ if(nxt_in_group)
+ group_algorithms::unlink_after(nxt_in_group);
+ if(safemode_or_autounlink)
+ group_algorithms::init(dcast_bucket_ptr(elem));
+ }
 
    template <class Disposer>
    void priv_erase(const_iterator i, Disposer disposer, detail::false_)
@@ -2620,7 +2724,7 @@
    siterator priv_begin() const
    { return priv_begin(cache_begin_t()); }
 
- siterator priv_begin(detail::bool_<false>) const
+ siterator priv_begin(detail::false_) const
    {
       size_type n = 0;
       size_type buckets_len = this->priv_buckets_len();
@@ -2633,7 +2737,7 @@
       return priv_invalid_local_it();
    }
 
- siterator priv_begin(detail::bool_<true>) const
+ siterator priv_begin(detail::true_) const
    {
       if(this->data_.internal_.bucket_hash_equal_.cached_begin_ == priv_invalid_bucket()){
          return priv_invalid_local_it();
@@ -2646,16 +2750,16 @@
    void priv_initialize_cache()
    { priv_initialize_cache(cache_begin_t()); }
 
- void priv_initialize_cache(detail::bool_<true>)
+ void priv_initialize_cache(detail::true_)
    { this->data_.internal_.bucket_hash_equal_.cached_begin_ = priv_invalid_bucket(); }
 
- void priv_initialize_cache(detail::bool_<false>)
+ void priv_initialize_cache(detail::false_)
    {}
 
    void priv_insertion_update_cache(size_type insertion_bucket)
    { priv_insertion_update_cache(insertion_bucket, cache_begin_t()); }
 
- void priv_insertion_update_cache(size_type insertion_bucket, detail::bool_<true>)
+ void priv_insertion_update_cache(size_type insertion_bucket, detail::true_)
    {
       bucket_ptr p = priv_buckets() + insertion_bucket;
       if(p < this->data_.internal_.bucket_hash_equal_.cached_begin_){
@@ -2663,13 +2767,13 @@
       }
    }
 
- void priv_insertion_update_cache(size_type, detail::bool_<false>)
+ void priv_insertion_update_cache(size_type, detail::false_)
    {}
 
    void priv_erasure_update_cache(size_type first_bucket, size_type last_bucket)
    { priv_erasure_update_cache(first_bucket, last_bucket, cache_begin_t()); }
 
- void priv_erasure_update_cache(size_type first_bucket_num, size_type last_bucket_num, detail::bool_<true>)
+ void priv_erasure_update_cache(size_type first_bucket_num, size_type last_bucket_num, detail::true_)
    {
       //If the last bucket is the end, the cache must be updated
       //to the last position if all
@@ -2680,13 +2784,13 @@
       }
    }
 
- void priv_erasure_update_cache(size_type, size_type, detail::bool_<false>)
+ void priv_erasure_update_cache(size_type, size_type, detail::false_)
    {}
 
    void priv_erasure_update_cache()
    { priv_erasure_update_cache(cache_begin_t()); }
 
- void priv_erasure_update_cache(detail::bool_<true>)
+ void priv_erasure_update_cache(detail::true_)
    {
       if(constant_time_size && !size()){
          priv_initialize_cache();
@@ -2704,43 +2808,37 @@
       }
    }
 
- void priv_erasure_update_cache(detail::bool_<false>)
+ void priv_erasure_update_cache(detail::false_)
    {}
 
- void priv_swap_cache(detail::bool_<true>, hashtable_impl &other)
+ void priv_swap_cache(detail::true_, hashtable_impl &other)
    {
       std::swap( this->data_.internal_.bucket_hash_equal_.cached_begin_
                , other.data_.internal_.bucket_hash_equal_.cached_begin_);
    }
 
- void priv_swap_cache(detail::bool_<false>, hashtable_impl &)
+ void priv_swap_cache(detail::false_, hashtable_impl &)
    {}
 
    bucket_ptr priv_get_cache()
    { return priv_get_cache(cache_begin_t()); }
 
- bucket_ptr priv_get_cache(detail::bool_<true>)
+ bucket_ptr priv_get_cache(detail::true_)
    { return this->data_.internal_.bucket_hash_equal_.cached_begin_; }
 
- bucket_ptr priv_get_cache(detail::bool_<false>)
+ bucket_ptr priv_get_cache(detail::false_)
    { return this->priv_buckets(); }
 
- void priv_set_cache(bucket_ptr p)
- { priv_set_cache(p, cache_begin_t()); }
-
- void priv_set_cache(bucket_ptr p, detail::bool_<true>)
- { this->data_.internal_.bucket_hash_equal_.cached_begin_ = p; }
-
- void priv_set_cache(bucket_ptr, detail::bool_<false>)
- {}
+ void priv_set_cache(const bucket_ptr &p)
+ { this->data_.internal_.bucket_hash_equal_.set_cache(p); }
 
    size_type priv_get_cache_bucket_num()
    { return priv_get_cache_bucket_num(cache_begin_t()); }
 
- size_type priv_get_cache_bucket_num(detail::bool_<true>)
+ size_type priv_get_cache_bucket_num(detail::true_)
    { return this->data_.internal_.bucket_hash_equal_.cached_begin_ - this->priv_buckets(); }
 
- size_type priv_get_cache_bucket_num(detail::bool_<false>)
+ size_type priv_get_cache_bucket_num(detail::false_)
    { return 0u; }
 
    void priv_clear_buckets()
@@ -2803,7 +2901,7 @@
          }
          if(optimize_multikey){
             previt = bucket_type::s_iterator_to
- (*group_functions_t::priv_get_last_in_group
+ (*group_functions_t::get_last_in_group
                   (dcast_bucket_ptr(it.pointed_node()), optimize_multikey_t()));
             it = previt;
          }
@@ -2833,16 +2931,16 @@
          it = b.before_begin();
       }
       //Now store hash if needed
- node_ptr n = node_ptr(&priv_value_to_node(value));
- this->priv_store_hash(n, hash_value, store_hash_t());
+ node_ptr n = pointer_traits<node_ptr>::pointer_to(priv_value_to_node(value));
+ node_functions_t::store_hash(n, hash_value, store_hash_t());
       //Checks for some modes
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n));
       //Shorcut for optimize_multikey cases
       if(optimize_multikey){
          node_ptr first_in_group = found_equal ?
- dcast_bucket_ptr(it.pointed_node()) : node_ptr(0);
- this->priv_insert_in_group(first_in_group, n, optimize_multikey_t());
+ dcast_bucket_ptr(it.pointed_node()) : node_ptr();
+ group_functions_t::insert_in_group(first_in_group, n, optimize_multikey_t());
       }
       //Update cache and increment size if needed
       priv_insertion_update_cache(bucket_num);
@@ -2877,7 +2975,7 @@
       siterator it = to_return.first;
       if(optimize_multikey){
          to_return.second = bucket_type::s_iterator_to
- (*node_traits::get_next(group_functions_t::priv_get_last_in_group
+ (*node_traits::get_next(group_functions_t::get_last_in_group
                (dcast_bucket_ptr(it.pointed_node()), optimize_multikey_t())));
          count = std::distance(it, to_return.second);
          if(to_return.second != b.end()){

Modified: trunk/boost/intrusive/linear_slist_algorithms.hpp
==============================================================================
--- trunk/boost/intrusive/linear_slist_algorithms.hpp (original)
+++ trunk/boost/intrusive/linear_slist_algorithms.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -62,12 +62,12 @@
 
    //! <b>Effects</b>: Constructs an non-used list element, putting the next
    //! pointer to null:
- //! <tt>NodeTraits::get_next(this_node) == 0
+ //! <tt>NodeTraits::get_next(this_node) == node_ptr()
    //!
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static void init(node_ptr this_node);
+ static void init(const node_ptr & this_node);
 
    //! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
    //!
@@ -95,7 +95,7 @@
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static void unlink_after(node_ptr prev_node);
+ static void unlink_after(const node_ptr & prev_node);
 
    //! <b>Requires</b>: prev_node and last_node must be in a circular list
    //! or be an empty circular list.
@@ -105,7 +105,7 @@
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static void unlink_after(node_ptr prev_node, node_ptr last_node);
+ static void unlink_after(const node_ptr & prev_node, const node_ptr & last_node);
 
    //! <b>Requires</b>: prev_node must be a node of a linear list.
    //!
@@ -114,7 +114,7 @@
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static void link_after(node_ptr prev_node, node_ptr this_node);
+ static void link_after(const node_ptr & prev_node, const node_ptr & this_node);
 
    //! <b>Requires</b>: b and e must be nodes of the same linear list or an empty range.
    //! and p must be a node of a different linear list.
@@ -125,7 +125,7 @@
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static void transfer_after(node_ptr p, node_ptr b, node_ptr e);
+ static void transfer_after(const node_ptr & p, const node_ptr & b, const node_ptr & e);
 
    #endif //#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
 
@@ -136,8 +136,8 @@
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static void init_header(node_ptr this_node)
- { NodeTraits::set_next(this_node, node_ptr(0)); }
+ static void init_header(const node_ptr & this_node)
+ { NodeTraits::set_next(this_node, node_ptr ()); }
 
    //! <b>Requires</b>: this_node and prev_init_node must be in the same linear list.
    //!
@@ -148,7 +148,7 @@
    //! <b>Complexity</b>: Linear to the number of elements between prev_init_node and this_node.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr get_previous_node(node_ptr prev_init_node, node_ptr this_node)
+ static node_ptr get_previous_node(const node_ptr & prev_init_node, const node_ptr & this_node)
    { return base_t::get_previous_node(prev_init_node, this_node); }
 
    //! <b>Requires</b>: this_node must be in a linear list or be an empty linear list.
@@ -159,7 +159,7 @@
    //! <b>Complexity</b>: Linear
    //!
    //! <b>Throws</b>: Nothing.
- static std::size_t count(const_node_ptr this_node)
+ static std::size_t count(const const_node_ptr & this_node)
    {
       std::size_t result = 0;
       const_node_ptr p = this_node;
@@ -179,7 +179,7 @@
    //! <b>Complexity</b>: Constant
    //!
    //! <b>Throws</b>: Nothing.
- static void swap_trailing_nodes(node_ptr this_node, node_ptr other_node)
+ static void swap_trailing_nodes(const node_ptr & this_node, const node_ptr & other_node)
    {
       node_ptr this_nxt = NodeTraits::get_next(this_node);
       node_ptr other_nxt = NodeTraits::get_next(other_node);
@@ -194,9 +194,9 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: This function is linear to the contained elements.
- static node_ptr reverse(node_ptr p)
+ static node_ptr reverse(const node_ptr & p)
    {
- if(!p) return node_ptr(0);
+ if(!p) return node_ptr();
       node_ptr i = NodeTraits::get_next(p);
       node_ptr first(p);
       while(i){
@@ -217,9 +217,9 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Linear to the number of elements plus the number moved positions.
- static std::pair<node_ptr, node_ptr> move_first_n_backwards(node_ptr p, std::size_t n)
+ static std::pair<node_ptr, node_ptr> move_first_n_backwards(const node_ptr & p, std::size_t n)
    {
- std::pair<node_ptr, node_ptr> ret(node_ptr(0), node_ptr(0));
+ std::pair<node_ptr, node_ptr> ret;
       //Null shift, or count() == 0 or 1, nothing to do
       if(!n || !p || !NodeTraits::get_next(p)){
          return ret;
@@ -227,8 +227,8 @@
 
       node_ptr first = p;
       bool end_found = false;
- node_ptr new_last(0);
- node_ptr old_last(0);
+ node_ptr new_last = node_ptr();
+ node_ptr old_last = node_ptr();
 
       //Now find the new last node according to the shift count.
       //If we find 0 before finding the new last node
@@ -237,7 +237,7 @@
       for(std::size_t i = 1; i <= n; ++i){
          new_last = first;
          first = NodeTraits::get_next(first);
- if(first == 0){
+ if(first == node_ptr()){
             //Shortcut the shift with the modulo of the size of the list
             n %= i;
             if(!n) return ret;
@@ -253,12 +253,12 @@
       //If the p has not been found in the previous loop, find it
       //starting in the new first node and unlink it
       if(!end_found){
- old_last = base_t::get_previous_node(first, node_ptr(0));
+ old_last = base_t::get_previous_node(first, node_ptr());
       }
       
       //Now link p after the new last node
       NodeTraits::set_next(old_last, p);
- NodeTraits::set_next(new_last, node_ptr(0));
+ NodeTraits::set_next(new_last, node_ptr());
       ret.first = first;
       ret.second = new_last;
       return ret;
@@ -272,9 +272,9 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Linear to the number of elements plus the number moved positions.
- static std::pair<node_ptr, node_ptr> move_first_n_forward(node_ptr p, std::size_t n)
+ static std::pair<node_ptr, node_ptr> move_first_n_forward(const node_ptr & p, std::size_t n)
    {
- std::pair<node_ptr, node_ptr> ret(node_ptr(0), node_ptr(0));
+ std::pair<node_ptr, node_ptr> ret;
       //Null shift, or count() == 0 or 1, nothing to do
       if(!n || !p || !NodeTraits::get_next(p))
          return ret;
@@ -312,7 +312,7 @@
       node_ptr new_first(node_traits::get_next(new_last));
       //Now put the old beginning after the old end
       NodeTraits::set_next(old_last, p);
- NodeTraits::set_next(new_last, node_ptr(0));
+ NodeTraits::set_next(new_last, node_ptr());
       ret.first = new_first;
       ret.second = new_last;
       return ret;

Modified: trunk/boost/intrusive/list.hpp
==============================================================================
--- trunk/boost/intrusive/list.hpp (original)
+++ trunk/boost/intrusive/list.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -19,12 +19,13 @@
 #include <boost/intrusive/intrusive_fwd.hpp>
 #include <boost/intrusive/list_hook.hpp>
 #include <boost/intrusive/circular_list_algorithms.hpp>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/detail/clear_on_destructor_base.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
 #include <boost/intrusive/link_mode.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/intrusive/options.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/detail/utilities.hpp>
 #include <iterator>
 #include <algorithm>
@@ -91,15 +92,15 @@
    /// @endcond
    typedef typename real_value_traits::pointer pointer;
    typedef typename real_value_traits::const_pointer const_pointer;
- typedef typename std::iterator_traits<pointer>::value_type value_type;
- typedef typename std::iterator_traits<pointer>::reference reference;
- typedef typename std::iterator_traits<const_pointer>::reference const_reference;
- typedef typename std::iterator_traits<pointer>::difference_type difference_type;
+ typedef typename pointer_traits<pointer>::element_type value_type;
+ typedef typename pointer_traits<pointer>::reference reference;
+ typedef typename pointer_traits<const_pointer>::reference const_reference;
+ typedef typename pointer_traits<pointer>::difference_type difference_type;
    typedef typename Config::size_type size_type;
    typedef list_iterator<list_impl, false> iterator;
    typedef list_iterator<list_impl, true> const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef boost::intrusive::detail::reverse_iterator<iterator> reverse_iterator;
+ typedef boost::intrusive::detail::reverse_iterator<const_iterator>const_reverse_iterator;
    typedef typename real_value_traits::node_traits node_traits;
    typedef typename node_traits::node node;
    typedef typename node_traits::node_ptr node_ptr;
@@ -127,17 +128,14 @@
                       ));
 
    //Const cast emulation for smart pointers
- static node_ptr uncast(const_node_ptr ptr)
- {
- return const_cast<node*>(detail::boost_intrusive_get_pointer(ptr));
- //iG pending return node_ptr(boost::const_pointer_cast<node>(ptr));
- }
+ static node_ptr uncast(const const_node_ptr & ptr)
+ { return pointer_traits<node_ptr>::const_cast_from(ptr); }
 
    node_ptr get_root_node()
- { return node_ptr(&data_.root_plus_size_.root_); }
+ { return pointer_traits<node_ptr>::pointer_to(data_.root_plus_size_.root_); }
 
    const_node_ptr get_root_node() const
- { return const_node_ptr(&data_.root_plus_size_.root_); }
+ { return pointer_traits<const_node_ptr>::pointer_to(data_.root_plus_size_.root_); }
 
    struct root_plus_size : public size_traits
    {
@@ -1299,7 +1297,7 @@
    static list_impl &priv_container_from_end_iterator(const const_iterator &end_iterator)
    {
       root_plus_size *r = detail::parent_from_member<root_plus_size, node>
- ( detail::boost_intrusive_get_pointer(end_iterator.pointed_node()), &root_plus_size::root_);
+ ( boost::intrusive::detail::to_raw_pointer(end_iterator.pointed_node()), &root_plus_size::root_);
       data_t *d = detail::parent_from_member<data_t, root_plus_size>
          ( r, &data_t::root_plus_size_);
       list_impl *s = detail::parent_from_member<list_impl, data_t>(d, &list_impl::data_);

Modified: trunk/boost/intrusive/member_value_traits.hpp
==============================================================================
--- trunk/boost/intrusive/member_value_traits.hpp (original)
+++ trunk/boost/intrusive/member_value_traits.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -16,6 +16,7 @@
 #include <boost/intrusive/link_mode.hpp>
 #include <iterator>
 #include <boost/intrusive/detail/parent_from_member.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 
 namespace boost {
 namespace intrusive {
@@ -29,15 +30,19 @@
 struct member_value_traits
 {
    public:
- typedef NodeTraits node_traits;
- typedef T value_type;
- typedef typename node_traits::node node;
- typedef typename node_traits::node_ptr node_ptr;
- typedef typename node_traits::const_node_ptr const_node_ptr;
- typedef typename boost::pointer_to_other<node_ptr, T>::type pointer;
- typedef typename boost::pointer_to_other<node_ptr, const T>::type const_pointer;
- typedef typename std::iterator_traits<pointer>::reference reference;
- typedef typename std::iterator_traits<const_pointer>::reference const_reference;
+ typedef NodeTraits node_traits;
+ typedef T value_type;
+ typedef typename node_traits::node node;
+ typedef typename node_traits::node_ptr node_ptr;
+ typedef typename node_traits::const_node_ptr const_node_ptr;
+ typedef typename pointer_traits<node_ptr>::template
+ rebind_pointer<T>::type pointer;
+ typedef typename pointer_traits<node_ptr>::template
+ rebind_pointer<const T>::type const_pointer;
+ //typedef typename pointer_traits<pointer>::reference reference;
+ //typedef typename pointer_traits<const_pointer>::reference const_reference;
+ typedef value_type & reference;
+ typedef const value_type & const_reference;
    static const link_mode_type link_mode = LinkMode;
 
    static node_ptr to_node_ptr(reference value)
@@ -46,16 +51,16 @@
    static const_node_ptr to_node_ptr(const_reference value)
    { return node_ptr(&(value.*PtrToMember)); }
 
- static pointer to_value_ptr(node_ptr n)
+ static pointer to_value_ptr(const node_ptr &n)
    {
       return pointer(detail::parent_from_member<value_type, node>
- (detail::boost_intrusive_get_pointer(n), PtrToMember));
+ (boost::intrusive::detail::to_raw_pointer(n), PtrToMember));
    }
 
- static const_pointer to_value_ptr(const_node_ptr n)
+ static const_pointer to_value_ptr(const const_node_ptr &n)
    {
       return pointer(detail::parent_from_member<value_type, node>
- (detail::boost_intrusive_get_pointer(n), PtrToMember));
+ (boost::intrusive::detail::to_raw_pointer(n), PtrToMember));
    }
 };
 

Added: trunk/boost/intrusive/pointer_traits.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/intrusive/pointer_traits.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -0,0 +1,265 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/intrusive for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTRUSIVE_POINTER_TRAITS_HPP
+#define BOOST_INTRUSIVE_POINTER_TRAITS_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/intrusive/detail/config_begin.hpp>
+#include <boost/intrusive/detail/workaround.hpp>
+#include <boost/intrusive/detail/memory_util.hpp>
+#include <boost/type_traits/integral_constant.hpp>
+#include <cstddef>
+
+namespace boost {
+namespace intrusive {
+
+//! pointer_traits is the implementation of C++11 std::pointer_traits class with some
+//! extensions like castings.
+//!
+//! pointer_traits supplies a uniform interface to certain attributes of pointer-like types.
+template <typename Ptr>
+struct pointer_traits
+{
+ #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ //!Ptr::element_type if such a type exists; otherwise, T if Ptr is a class
+ //!template instantiation of the form SomePointer<T, Args>, where Args is zero or
+ //!more type arguments ; otherwise , the specialization is ill-formed.
+ typedef unspecified_type element_type;
+
+ //!Ptr::difference_type if such a type exists; otherwise,
+ //!std::ptrdiff_t.
+ typedef unspecified_type difference_type;
+
+ //!Ptr::difference_type if such a type exists; otherwise,
+ //!std::ptrdiff_t.
+ typedef unspecified_type difference_type;
+
+ //!Ptr::rebind<U> if such a type exists; otherwise, SomePointer<U, Args> if Ptr is
+ //!a class template instantiation of the form SomePointer<T, Args>, where Args is zero or
+ //!more type arguments ; otherwise, the instantiation of rebind is ill-formed.
+ //!
+ //!For portable code for C++03 and C++11, <pre>typename rebind_pointer<U>::type</pre>
+ //!shall be used instead of rebind<U> to obtain a pointer to U.
+ template <class U> using rebind = unspecified;
+
+ //!Ptr::rebind<U> if such a type exists; otherwise, SomePointer<U, Args> if Ptr is
+ //!a class template instantiation of the form SomePointer<T, Args>, where Args is zero or
+ //!more type arguments ; otherwise, the instantiation of rebind is ill-formed.
+ //!
+ typedef element_type &reference;
+ #else
+ typedef Ptr pointer;
+ //
+ typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
+ ( boost::intrusive::detail::, Ptr, element_type
+ , typename boost::intrusive::detail::first_param<Ptr>::type) element_type;
+ //
+ typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
+ (boost::intrusive::detail::, Ptr, difference_type, std::ptrdiff_t) difference_type;
+ //
+ typedef typename boost::intrusive::detail::unvoid<element_type>::type& reference;
+ //
+ template <class U> struct rebind_pointer
+ {
+ typedef typename boost::intrusive::detail::type_rebinder<Ptr, U>::type type;
+ };
+
+ #if !defined(BOOST_NO_TEMPLATE_ALIASES)
+ template <class U> using rebind = typename boost::intrusive::detail::type_rebinder<Ptr, U>::type;
+ #endif
+ #endif //#if !defined(BOOST_NO_TEMPLATE_ALIASES)
+
+ //!<b>Remark</b>: If element_type is (possibly cv-qualified) void, r type is unspecified; otherwise,
+ //! it is element_type &.
+ //
+ //!<b>Returns</b>: A dereferenceable pointer to r obtained by calling Ptr::pointer_to(r).
+ //! Non-standard extension: If such function does not exist, returns pointer(addressof(r));
+ static pointer pointer_to(reference r)
+ {
+ //Non-standard extension, it does not require Ptr::pointer_to. If not present
+ //tries to converts &r to pointer.
+ const bool value = boost::intrusive::detail::
+ has_member_function_callable_with_pointer_to
+ <Ptr, typename boost::intrusive::detail::unvoid<element_type &>::type>::value;
+ ::boost::integral_constant<bool, value> flag;
+ return pointer_traits::priv_pointer_to(flag, r);
+ }
+
+ //!<b>Remark</b>: Non-standard extension.
+ //
+ //!<b>Returns</b>: A dereferenceable pointer to r obtained by calling Ptr::static_cast_from(r).
+ //! If such function does not exist, returns pointer_to(static_cast<element_type&>(*uptr))
+ template<class UPtr>
+ static pointer static_cast_from(const UPtr &uptr)
+ {
+ const bool value = boost::intrusive::detail::
+ has_member_function_callable_with_static_cast_from
+ <Ptr, const UPtr>::value;
+ ::boost::integral_constant<bool, value> flag;
+ return pointer_traits::priv_static_cast_from(flag, uptr);
+ }
+
+ //!<b>Remark</b>: Non-standard extension.
+ //
+ //!<b>Returns</b>: A dereferenceable pointer to r obtained by calling Ptr::const_cast_from(r).
+ //! If such function does not exist, returns pointer_to(const_cast<element_type&>(*uptr))
+ template<class UPtr>
+ static pointer const_cast_from(const UPtr &uptr)
+ {
+ const bool value = boost::intrusive::detail::
+ has_member_function_callable_with_const_cast_from
+ <Ptr, const UPtr>::value;
+ ::boost::integral_constant<bool, value> flag;
+ return pointer_traits::priv_const_cast_from(flag, uptr);
+ }
+
+ //!<b>Remark</b>: Non-standard extension.
+ //
+ //!<b>Returns</b>: A dereferenceable pointer to r obtained by calling Ptr::dynamic_cast_from(r).
+ //! If such function does not exist, returns pointer_to(*dynamic_cast<element_type*>(&*uptr))
+ template<class UPtr>
+ static pointer dynamic_cast_from(const UPtr &uptr)
+ {
+ const bool value = boost::intrusive::detail::
+ has_member_function_callable_with_dynamic_cast_from
+ <Ptr, const UPtr>::value;
+ ::boost::integral_constant<bool, value> flag;
+ return pointer_traits::priv_dynamic_cast_from(flag, uptr);
+ }
+
+ ///@cond
+ private:
+ //priv_to_raw_pointer
+ template <class T>
+ static T* to_raw_pointer(T* p)
+ { return p; }
+
+ template <class Pointer>
+ static typename pointer_traits<Pointer>::element_type*
+ to_raw_pointer(const Pointer &p)
+ { return pointer_traits::to_raw_pointer(p.operator->()); }
+
+ //priv_pointer_to
+ static pointer priv_pointer_to(boost::true_type, typename boost::intrusive::detail::unvoid<element_type>::type& r)
+ { return Ptr::pointer_to(r); }
+
+ static pointer priv_pointer_to(boost::false_type, typename boost::intrusive::detail::unvoid<element_type>::type& r)
+ { return pointer(boost::intrusive::detail::addressof(r)); }
+
+ //priv_static_cast_from
+ template<class UPtr>
+ static pointer priv_static_cast_from(boost::true_type, const UPtr &uptr)
+ { return Ptr::static_cast_from(uptr); }
+
+ template<class UPtr>
+ static pointer priv_static_cast_from(boost::false_type, const UPtr &uptr)
+ { return pointer_to(static_cast<element_type&>(*uptr)); }
+
+ //priv_const_cast_from
+ template<class UPtr>
+ static pointer priv_const_cast_from(boost::true_type, const UPtr &uptr)
+ { return Ptr::const_cast_from(uptr); }
+
+ template<class UPtr>
+ static pointer priv_const_cast_from(boost::false_type, const UPtr &uptr)
+ { return pointer_to(const_cast<element_type&>(*uptr)); }
+
+ //priv_dynamic_cast_from
+ template<class UPtr>
+ static pointer priv_dynamic_cast_from(boost::true_type, const UPtr &uptr)
+ { return Ptr::dynamic_cast_from(uptr); }
+
+ template<class UPtr>
+ static pointer priv_dynamic_cast_from(boost::false_type, const UPtr &uptr)
+ { return pointer_to(*dynamic_cast<element_type*>(&*uptr)); }
+ ///@endcond
+};
+
+///@cond
+
+// Remove cv qualification from Ptr parameter to pointer_traits:
+template <typename Ptr>
+struct pointer_traits<const Ptr> : pointer_traits<Ptr> {};
+template <typename Ptr>
+struct pointer_traits<volatile Ptr> : pointer_traits<Ptr> { };
+template <typename Ptr>
+struct pointer_traits<const volatile Ptr> : pointer_traits<Ptr> { };
+// Remove reference from Ptr parameter to pointer_traits:
+template <typename Ptr>
+struct pointer_traits<Ptr&> : pointer_traits<Ptr> { };
+
+///@endcond
+
+//! Specialization of pointer_traits for raw pointers
+//!
+template <typename T>
+struct pointer_traits<T*>
+{
+ typedef T element_type;
+ typedef T* pointer;
+ typedef std::ptrdiff_t difference_type;
+
+ #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ typedef T & reference;
+ //!typedef for <pre>U *</pre>
+ //!
+ //!For portable code for C++03 and C++11, <pre>typename rebind_pointer<U>::type</pre>
+ //!shall be used instead of rebind<U> to obtain a pointer to U.
+ template <class U> using rebind = U*;
+ #else
+ typedef typename boost::intrusive::detail::unvoid<element_type>::type& reference;
+ #if !defined(BOOST_NO_TEMPLATE_ALIASES)
+ template <class U> using rebind = U*;
+ #endif
+ #endif
+
+ template <class U> struct rebind_pointer
+ { typedef U* type; };
+
+ //! <b>Returns</b>: addressof(r)
+ //!
+ static pointer pointer_to(reference r)
+ { return boost::intrusive::detail::addressof(r); }
+
+ //! <b>Returns</b>: static_cast<pointer>(uptr)
+ //!
+ template<class U>
+ static pointer static_cast_from(U *uptr)
+ { return static_cast<pointer>(uptr); }
+
+ //! <b>Returns</b>: const_cast<pointer>(uptr)
+ //!
+ template<class U>
+ static pointer const_cast_from(U *uptr)
+ { return const_cast<pointer>(uptr); }
+
+ //! <b>Returns</b>: dynamic_cast<pointer>(uptr)
+ //!
+ template<class U>
+ static pointer dynamic_cast_from(U *uptr)
+ { return dynamic_cast<pointer>(uptr); }
+};
+
+} //namespace container {
+} //namespace boost {
+
+#include <boost/intrusive/detail/config_end.hpp>
+
+#endif // ! defined(BOOST_INTRUSIVE_POINTER_TRAITS_HPP)

Modified: trunk/boost/intrusive/rbtree.hpp
==============================================================================
--- trunk/boost/intrusive/rbtree.hpp (original)
+++ trunk/boost/intrusive/rbtree.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -27,9 +27,10 @@
 #include <boost/intrusive/detail/tree_node.hpp>
 #include <boost/intrusive/detail/ebo_functor_holder.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/detail/clear_on_destructor_base.hpp>
 #include <boost/intrusive/detail/function_detector.hpp>
+#include <boost/intrusive/detail/utilities.hpp>
 #include <boost/intrusive/options.hpp>
 #include <boost/intrusive/rbtree_algorithms.hpp>
 #include <boost/intrusive/link_mode.hpp>
@@ -97,18 +98,19 @@
    /// @endcond
    typedef typename real_value_traits::pointer pointer;
    typedef typename real_value_traits::const_pointer const_pointer;
- typedef typename std::iterator_traits<pointer>::value_type value_type;
+
+ typedef typename pointer_traits<pointer>::element_type value_type;
    typedef value_type key_type;
- typedef typename std::iterator_traits<pointer>::reference reference;
- typedef typename std::iterator_traits<const_pointer>::reference const_reference;
- typedef typename std::iterator_traits<pointer>::difference_type difference_type;
+ typedef typename pointer_traits<pointer>::reference reference;
+ typedef typename pointer_traits<const_pointer>::reference const_reference;
+ typedef typename pointer_traits<const_pointer>::difference_type difference_type;
    typedef typename Config::size_type size_type;
    typedef typename Config::compare value_compare;
    typedef value_compare key_compare;
    typedef tree_iterator<rbtree_impl, false> iterator;
    typedef tree_iterator<rbtree_impl, true> const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef boost::intrusive::detail::reverse_iterator<iterator> reverse_iterator;
+ typedef boost::intrusive::detail::reverse_iterator<const_iterator>const_reverse_iterator;
    typedef typename real_value_traits::node_traits node_traits;
    typedef typename node_traits::node node;
    typedef typename node_traits::node_ptr node_ptr;
@@ -163,17 +165,14 @@
    value_traits &priv_value_traits()
    { return data_; }
 
- const node &priv_header() const
- { return data_.node_plus_pred_.header_plus_size_.header_; }
+ node_ptr priv_header_ptr()
+ { return pointer_traits<node_ptr>::pointer_to(data_.node_plus_pred_.header_plus_size_.header_); }
 
- node &priv_header()
- { return data_.node_plus_pred_.header_plus_size_.header_; }
+ const_node_ptr priv_header_ptr() const
+ { return pointer_traits<const_node_ptr>::pointer_to(data_.node_plus_pred_.header_plus_size_.header_); }
 
- static node_ptr uncast(const_node_ptr ptr)
- {
- return node_ptr(const_cast<node*>(detail::boost_intrusive_get_pointer(ptr)));
-//iG pending return node_ptr(boost::const_pointer_cast<node>(ptr));
- }
+ static node_ptr uncast(const const_node_ptr & ptr)
+ { return pointer_traits<node_ptr>::const_cast_from(ptr); }
 
    size_traits &priv_size_traits()
    { return data_.node_plus_pred_.header_plus_size_; }
@@ -198,10 +197,10 @@
    { return priv_comp(); }
 
    const node &prot_header_node() const
- { return priv_header(); }
+ { return data_.node_plus_pred_.header_plus_size_.header_; }
 
    node &prot_header_node()
- { return priv_header(); }
+ { return data_.node_plus_pred_.header_plus_size_.header_; }
 
    void prot_set_size(size_type s)
    { this->priv_size_traits().set_size(s); }
@@ -229,7 +228,7 @@
               , const value_traits &v_traits = value_traits())
       : data_(cmp, v_traits)
    {
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(size_type(0));
    }
 
@@ -251,7 +250,7 @@
               , const value_traits &v_traits = value_traits())
       : data_(cmp, v_traits)
    {
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(size_type(0));
       if(unique)
          this->insert_unique(b, e);
@@ -264,7 +263,7 @@
    rbtree_impl(BOOST_RV_REF(rbtree_impl) x)
       : data_(::boost::move(x.priv_comp()), ::boost::move(x.priv_value_traits()))
    {
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(size_type(0));
       this->swap(x);
    }
@@ -290,7 +289,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    iterator begin()
- { return iterator (node_traits::get_left(node_ptr(&priv_header())), this); }
+ { return iterator (node_traits::get_left(this->priv_header_ptr()), this); }
 
    //! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the tree.
    //!
@@ -306,7 +305,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    const_iterator cbegin() const
- { return const_iterator (node_traits::get_left(const_node_ptr(&priv_header())), this); }
+ { return const_iterator (node_traits::get_left(this->priv_header_ptr()), this); }
 
    //! <b>Effects</b>: Returns an iterator pointing to the end of the tree.
    //!
@@ -314,7 +313,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    iterator end()
- { return iterator (node_ptr(&priv_header()), this); }
+ { return iterator (this->priv_header_ptr(), this); }
 
    //! <b>Effects</b>: Returns a const_iterator pointing to the end of the tree.
    //!
@@ -330,7 +329,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    const_iterator cend() const
- { return const_iterator (uncast(const_node_ptr(&priv_header())), this); }
+ { return const_iterator (uncast(this->priv_header_ptr()), this); }
 
    //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
    //! reversed tree.
@@ -444,7 +443,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    bool empty() const
- { return node_algorithms::unique(const_node_ptr(&priv_header())); }
+ { return node_algorithms::unique(this->priv_header_ptr()); }
 
    //! <b>Effects</b>: Returns the number of elements stored in the tree.
    //!
@@ -457,7 +456,7 @@
       if(constant_time_size)
          return this->priv_size_traits().get_size();
       else{
- return (size_type)node_algorithms::size(const_node_ptr(&priv_header()));
+ return (size_type)node_algorithms::size(this->priv_header_ptr());
       }
    }
 
@@ -472,7 +471,7 @@
       using std::swap;
       swap(priv_comp(), priv_comp());
       //These can't throw
- node_algorithms::swap_tree(node_ptr(&priv_header()), node_ptr(&other.priv_header()));
+ node_algorithms::swap_tree(this->priv_header_ptr(), node_ptr(other.priv_header_ptr()));
       if(constant_time_size){
          size_type backup = this->priv_size_traits().get_size();
          this->priv_size_traits().set_size(other.priv_size_traits().get_size());
@@ -499,7 +498,7 @@
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       iterator ret(node_algorithms::insert_equal_upper_bound
- (node_ptr(&priv_header()), to_insert, key_node_comp), this);
+ (this->priv_header_ptr(), to_insert, key_node_comp), this);
       this->priv_size_traits().increment();
       return ret;
    }
@@ -526,7 +525,7 @@
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       iterator ret(node_algorithms::insert_equal
- (node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp), this);
+ (this->priv_header_ptr(), hint.pointed_node(), to_insert, key_node_comp), this);
       this->priv_size_traits().increment();
       return ret;
    }
@@ -662,7 +661,7 @@
          comp(key_value_comp, this);
       std::pair<node_ptr, bool> ret =
          (node_algorithms::insert_unique_check
- (node_ptr(&priv_header()), key, comp, commit_data));
+ (this->priv_header_ptr(), key, comp, commit_data));
       return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
    }
 
@@ -707,7 +706,7 @@
          comp(key_value_comp, this);
       std::pair<node_ptr, bool> ret =
          (node_algorithms::insert_unique_check
- (node_ptr(&priv_header()), hint.pointed_node(), key, comp, commit_data));
+ (this->priv_header_ptr(), hint.pointed_node(), key, comp, commit_data));
       return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
    }
 
@@ -734,7 +733,7 @@
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       node_algorithms::insert_unique_commit
- (node_ptr(&priv_header()), to_insert, commit_data);
+ (this->priv_header_ptr(), to_insert, commit_data);
       this->priv_size_traits().increment();
       return iterator(to_insert, this);
    }
@@ -760,7 +759,7 @@
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       this->priv_size_traits().increment();
       return iterator(node_algorithms::insert_before
- (node_ptr(&priv_header()), pos.pointed_node(), to_insert), this);
+ (this->priv_header_ptr(), pos.pointed_node(), to_insert), this);
    }
 
    //! <b>Requires</b>: value must be an lvalue, and it must be no less
@@ -783,7 +782,7 @@
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       this->priv_size_traits().increment();
- node_algorithms::push_back(node_ptr(&priv_header()), to_insert);
+ node_algorithms::push_back(this->priv_header_ptr(), to_insert);
    }
 
    //! <b>Requires</b>: value must be an lvalue, and it must be no greater
@@ -806,7 +805,7 @@
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       this->priv_size_traits().increment();
- node_algorithms::push_front(node_ptr(&priv_header()), to_insert);
+ node_algorithms::push_front(this->priv_header_ptr(), to_insert);
    }
 
    //! <b>Effects</b>: Erases the element pointed to by pos.
@@ -824,7 +823,7 @@
       node_ptr to_erase(i.pointed_node());
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!node_algorithms::unique(to_erase));
- node_algorithms::erase(&priv_header(), to_erase);
+ node_algorithms::erase(this->priv_header_ptr(), to_erase);
       this->priv_size_traits().decrement();
       if(safemode_or_autounlink)
          node_algorithms::init(to_erase);
@@ -986,7 +985,7 @@
          this->clear_and_dispose(detail::null_disposer());
       }
       else{
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
          this->priv_size_traits().set_size(0);
       }
    }
@@ -1003,9 +1002,9 @@
    template<class Disposer>
    void clear_and_dispose(Disposer disposer)
    {
- node_algorithms::clear_and_dispose(node_ptr(&priv_header())
+ node_algorithms::clear_and_dispose(this->priv_header_ptr()
          , detail::node_disposer<Disposer, rbtree_impl>(disposer, this));
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(0);
    }
 
@@ -1061,7 +1060,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, rbtree_impl>
          key_node_comp(comp, this);
       return iterator(node_algorithms::lower_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Returns a const iterator to the first element whose
@@ -1076,7 +1075,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, rbtree_impl>
          key_node_comp(comp, this);
       return const_iterator(node_algorithms::lower_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Returns an iterator to the first element whose
@@ -1101,7 +1100,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, rbtree_impl>
          key_node_comp(comp, this);
       return iterator(node_algorithms::upper_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Returns an iterator to the first element whose
@@ -1126,7 +1125,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, rbtree_impl>
          key_node_comp(comp, this);
       return const_iterator(node_algorithms::upper_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Finds an iterator to the first element whose key is
@@ -1150,7 +1149,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, rbtree_impl>
          key_node_comp(comp, this);
       return iterator
- (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (node_algorithms::find(this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
@@ -1174,7 +1173,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, rbtree_impl>
          key_node_comp(comp, this);
       return const_iterator
- (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (node_algorithms::find(this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Finds a range containing all elements whose key is k or
@@ -1200,7 +1199,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, rbtree_impl>
          key_node_comp(comp, this);
       std::pair<node_ptr, node_ptr> ret
- (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp));
+ (node_algorithms::equal_range(this->priv_header_ptr(), key, key_node_comp));
       return std::pair<iterator, iterator>(iterator(ret.first, this), iterator(ret.second, this));
    }
 
@@ -1229,7 +1228,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, rbtree_impl>
          key_node_comp(comp, this);
       std::pair<node_ptr, node_ptr> ret
- (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp));
+ (node_algorithms::equal_range(this->priv_header_ptr(), key, key_node_comp));
       return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
    }
 
@@ -1255,8 +1254,8 @@
          detail::exception_disposer<rbtree_impl, Disposer>
             rollback(*this, disposer);
          node_algorithms::clone
- (const_node_ptr(&src.priv_header())
- ,node_ptr(&this->priv_header())
+ (const_node_ptr(src.priv_header_ptr())
+ ,node_ptr(this->priv_header_ptr())
             ,detail::node_cloner<Cloner, rbtree_impl>(cloner, this)
             ,detail::node_disposer<Disposer, rbtree_impl>(disposer, this));
          this->priv_size_traits().set_size(src.priv_size_traits().get_size());
@@ -1278,7 +1277,7 @@
    pointer unlink_leftmost_without_rebalance()
    {
       node_ptr to_be_disposed(node_algorithms::unlink_leftmost_without_rebalance
- (node_ptr(&priv_header())));
+ (this->priv_header_ptr()));
       if(!to_be_disposed)
          return 0;
       this->priv_size_traits().decrement();
@@ -1304,7 +1303,7 @@
    void replace_node(iterator replace_this, reference with_this)
    {
       node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this)
- , node_ptr(&priv_header())
+ , this->priv_header_ptr()
                                    , get_real_value_traits().to_node_ptr(with_this));
       if(safemode_or_autounlink)
          node_algorithms::init(replace_this.pointed_node());
@@ -1427,7 +1426,7 @@
    static rbtree_impl &priv_container_from_end_iterator(const const_iterator &end_iterator)
    {
       header_plus_size *r = detail::parent_from_member<header_plus_size, node>
- ( detail::boost_intrusive_get_pointer(end_iterator.pointed_node()), &header_plus_size::header_);
+ ( boost::intrusive::detail::to_raw_pointer(end_iterator.pointed_node()), &header_plus_size::header_);
       node_plus_pred_t *n = detail::parent_from_member
          <node_plus_pred_t, header_plus_size>(r, &node_plus_pred_t::header_plus_size_);
       data_t *d = detail::parent_from_member<data_t, node_plus_pred_t>(n, &data_t::node_plus_pred_);

Modified: trunk/boost/intrusive/rbtree_algorithms.hpp
==============================================================================
--- trunk/boost/intrusive/rbtree_algorithms.hpp (original)
+++ trunk/boost/intrusive/rbtree_algorithms.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -56,6 +56,7 @@
 #include <boost/intrusive/detail/assert.hpp>
 #include <boost/intrusive/detail/utilities.hpp>
 #include <boost/intrusive/detail/tree_algorithms.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 
 namespace boost {
 namespace intrusive {
@@ -135,7 +136,7 @@
          : base_t(f)
       {}
       
- node_ptr operator()(node_ptr p)
+ node_ptr operator()(const node_ptr & p)
       {
          node_ptr n = base_t::get()(p);
          NodeTraits::set_color(n, NodeTraits::get_color(p));
@@ -145,7 +146,7 @@
 
    struct rbtree_erase_fixup
    {
- void operator()(node_ptr to_erase, node_ptr successor)
+ void operator()(const node_ptr & to_erase, const node_ptr & successor)
       {
          //Swap color of y and z
          color tmp(NodeTraits::get_color(successor));
@@ -154,17 +155,15 @@
       }
    };
 
- static node_ptr uncast(const_node_ptr ptr)
- {
- return node_ptr(const_cast<node*>(::boost::intrusive::detail::boost_intrusive_get_pointer(ptr)));
- }
+ static node_ptr uncast(const const_node_ptr & ptr)
+ { return pointer_traits<node_ptr>::const_cast_from(ptr); }
    /// @endcond
 
    public:
- static node_ptr begin_node(const_node_ptr header)
+ static node_ptr begin_node(const const_node_ptr & header)
    { return tree_algorithms::begin_node(header); }
 
- static node_ptr end_node(const_node_ptr header)
+ static node_ptr end_node(const const_node_ptr & header)
    { return tree_algorithms::end_node(header); }
 
    //! This type is the information that will be
@@ -180,7 +179,7 @@
    //! <b>Complexity</b>: Constant.
    //!
    //! <b>Throws</b>: Nothing.
- static void swap_tree(node_ptr header1, node_ptr header2)
+ static void swap_tree(const node_ptr & header1, const node_ptr & header2)
    { return tree_algorithms::swap_tree(header1, header2); }
 
    //! <b>Requires</b>: node1 and node2 can't be header nodes
@@ -198,7 +197,7 @@
    //! node1 and node2 are not equivalent according to the ordering rules.
    //!
    //!Experimental function
- static void swap_nodes(node_ptr node1, node_ptr node2)
+ static void swap_nodes(const node_ptr & node1, const node_ptr & node2)
    {
       if(node1 == node2)
          return;
@@ -222,7 +221,7 @@
    //! node1 and node2 are not equivalent according to the ordering rules.
    //!
    //!Experimental function
- static void swap_nodes(node_ptr node1, node_ptr header1, node_ptr node2, node_ptr header2)
+ static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2)
    {
       if(node1 == node2) return;
 
@@ -249,7 +248,7 @@
    //! the node, since no rebalancing and comparison is needed.
    //!
    //!Experimental function
- static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node)
+ static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node)
    {
       if(node_to_be_replaced == new_node)
          return;
@@ -272,7 +271,7 @@
    //! the node, since no rebalancing or comparison is needed.
    //!
    //!Experimental function
- static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node)
+ static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node)
    {
       tree_algorithms::replace_node(node_to_be_replaced, header, new_node);
       NodeTraits::set_color(new_node, NodeTraits::get_color(node_to_be_replaced));
@@ -285,7 +284,7 @@
    //! <b>Complexity</b>: Average complexity is constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static void unlink(node_ptr node)
+ static void unlink(const node_ptr & node)
    {
       node_ptr x = NodeTraits::get_parent(node);
       if(x){
@@ -308,7 +307,7 @@
    //! only be used for more unlink_leftmost_without_rebalance calls.
    //! This function is normally used to achieve a step by step
    //! controlled destruction of the tree.
- static node_ptr unlink_leftmost_without_rebalance(node_ptr header)
+ static node_ptr unlink_leftmost_without_rebalance(const node_ptr & header)
    { return tree_algorithms::unlink_leftmost_without_rebalance(header); }
 
    //! <b>Requires</b>: node is a node of the tree or an node initialized
@@ -319,7 +318,7 @@
    //! <b>Complexity</b>: Constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static bool unique(const_node_ptr node)
+ static bool unique(const const_node_ptr & node)
    { return tree_algorithms::unique(node); }
 
    //! <b>Requires</b>: node is a node of the tree but it's not the header.
@@ -329,7 +328,7 @@
    //! <b>Complexity</b>: Linear time.
    //!
    //! <b>Throws</b>: Nothing.
- static std::size_t count(const_node_ptr node)
+ static std::size_t count(const const_node_ptr & node)
    { return tree_algorithms::count(node); }
 
    //! <b>Requires</b>: header is the header node of the tree.
@@ -339,7 +338,7 @@
    //! <b>Complexity</b>: Linear time.
    //!
    //! <b>Throws</b>: Nothing.
- static std::size_t size(const_node_ptr header)
+ static std::size_t size(const const_node_ptr & header)
    { return tree_algorithms::size(header); }
 
    //! <b>Requires</b>: p is a node from the tree except the header.
@@ -349,7 +348,7 @@
    //! <b>Complexity</b>: Average constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr next_node(node_ptr p)
+ static node_ptr next_node(const node_ptr & p)
    { return tree_algorithms::next_node(p); }
 
    //! <b>Requires</b>: p is a node from the tree except the leftmost node.
@@ -359,7 +358,7 @@
    //! <b>Complexity</b>: Average constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr prev_node(node_ptr p)
+ static node_ptr prev_node(const node_ptr & p)
    { return tree_algorithms::prev_node(p); }
 
    //! <b>Requires</b>: node must not be part of any tree.
@@ -371,7 +370,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
- static void init(node_ptr node)
+ static void init(const node_ptr & node)
    { tree_algorithms::init(node); }
 
    //! <b>Requires</b>: node must not be part of any tree.
@@ -384,7 +383,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
- static void init_header(node_ptr header)
+ static void init_header(const node_ptr & header)
    {
       tree_algorithms::init_header(header);
       NodeTraits::set_color(header, NodeTraits::red());
@@ -398,7 +397,7 @@
    //! <b>Complexity</b>: Amortized constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr erase(node_ptr header, node_ptr z)
+ static node_ptr erase(const node_ptr & header, const node_ptr & z)
    {
       typename tree_algorithms::data_for_rebalance info;
       tree_algorithms::erase(header, z, rbtree_erase_fixup(), info);
@@ -417,13 +416,13 @@
    //! take a node_ptr and shouldn't throw.
    //!
    //! <b>Effects</b>: First empties target tree calling
- //! <tt>void disposer::operator()(node_ptr)</tt> for every node of the tree
+ //! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
    //! except the header.
    //!
    //! Then, duplicates the entire tree pointed by "source_header" cloning each
- //! source node with <tt>node_ptr Cloner::operator()(node_ptr)</tt> to obtain
+ //! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
    //! the nodes of the target tree. If "cloner" throws, the cloned target nodes
- //! are disposed using <tt>void disposer(node_ptr)</tt>.
+ //! are disposed using <tt>void disposer(const node_ptr &)</tt>.
    //!
    //! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
    //! number of elements of tree target tree when calling this function.
@@ -431,7 +430,7 @@
    //! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
    template <class Cloner, class Disposer>
    static void clone
- (const_node_ptr source_header, node_ptr target_header, Cloner cloner, Disposer disposer)
+ (const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer)
    {
       rbtree_node_cloner<Cloner> new_cloner(cloner);
       tree_algorithms::clone(source_header, target_header, new_cloner, disposer);
@@ -441,7 +440,7 @@
    //! taking a node_ptr parameter and shouldn't throw.
    //!
    //! <b>Effects</b>: Empties the target tree calling
- //! <tt>void disposer::operator()(node_ptr)</tt> for every node of the tree
+ //! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
    //! except the header.
    //!
    //! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
@@ -449,7 +448,7 @@
    //!
    //! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
    template<class Disposer>
- static void clear_and_dispose(node_ptr header, Disposer disposer)
+ static void clear_and_dispose(const node_ptr & header, Disposer disposer)
    { tree_algorithms::clear_and_dispose(header, disposer); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -466,7 +465,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr lower_bound
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    { return tree_algorithms::lower_bound(header, key, comp); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -482,7 +481,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr upper_bound
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    { return tree_algorithms::upper_bound(header, key, comp); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -498,7 +497,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr find
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    { return tree_algorithms::find(header, key, comp); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -516,7 +515,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static std::pair<node_ptr, node_ptr> equal_range
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    { return tree_algorithms::equal_range(header, key, comp); }
 
    //! <b>Requires</b>: "h" must be the header node of a tree.
@@ -533,7 +532,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class NodePtrCompare>
    static node_ptr insert_equal_upper_bound
- (node_ptr h, node_ptr new_node, NodePtrCompare comp)
+ (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp)
    {
       tree_algorithms::insert_equal_upper_bound(h, new_node, comp);
       rebalance_after_insertion(h, new_node);
@@ -554,7 +553,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class NodePtrCompare>
    static node_ptr insert_equal_lower_bound
- (node_ptr h, node_ptr new_node, NodePtrCompare comp)
+ (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp)
    {
       tree_algorithms::insert_equal_lower_bound(h, new_node, comp);
       rebalance_after_insertion(h, new_node);
@@ -577,7 +576,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class NodePtrCompare>
    static node_ptr insert_equal
- (node_ptr header, node_ptr hint, node_ptr new_node, NodePtrCompare comp)
+ (const node_ptr & header, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp)
    {
       tree_algorithms::insert_equal(header, hint, new_node, comp);
       rebalance_after_insertion(header, new_node);
@@ -599,7 +598,7 @@
    //! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
    //! tree invariants might be broken.
    static node_ptr insert_before
- (node_ptr header, node_ptr pos, node_ptr new_node)
+ (const node_ptr & header, const node_ptr & pos, const node_ptr & new_node)
    {
       tree_algorithms::insert_before(header, pos, new_node);
       rebalance_after_insertion(header, new_node);
@@ -619,7 +618,7 @@
    //! <b>Note</b>: If "new_node" is less than the greatest inserted key
    //! tree invariants are broken. This function is slightly faster than
    //! using "insert_before".
- static void push_back(node_ptr header, node_ptr new_node)
+ static void push_back(const node_ptr & header, const node_ptr & new_node)
    {
       tree_algorithms::push_back(header, new_node);
       rebalance_after_insertion(header, new_node);
@@ -638,7 +637,7 @@
    //! <b>Note</b>: If "new_node" is greater than the lowest inserted key
    //! tree invariants are broken. This function is slightly faster than
    //! using "insert_before".
- static void push_front(node_ptr header, node_ptr new_node)
+ static void push_front(const node_ptr & header, const node_ptr & new_node)
    {
       tree_algorithms::push_front(header, new_node);
       rebalance_after_insertion(header, new_node);
@@ -680,7 +679,7 @@
    //! if no more objects are inserted or erased from the set.
    template<class KeyType, class KeyNodePtrCompare>
    static std::pair<node_ptr, bool> insert_unique_check
- (const_node_ptr header, const KeyType &key
+ (const const_node_ptr & header, const KeyType &key
       ,KeyNodePtrCompare comp, insert_commit_data &commit_data)
    { return tree_algorithms::insert_unique_check(header, key, comp, commit_data); }
 
@@ -725,7 +724,7 @@
    //! if no more objects are inserted or erased from the set.
    template<class KeyType, class KeyNodePtrCompare>
    static std::pair<node_ptr, bool> insert_unique_check
- (const_node_ptr header, node_ptr hint, const KeyType &key
+ (const const_node_ptr & header, const node_ptr &hint, const KeyType &key
       ,KeyNodePtrCompare comp, insert_commit_data &commit_data)
    { return tree_algorithms::insert_unique_check(header, hint, key, comp, commit_data); }
 
@@ -747,7 +746,7 @@
    //! previously executed to fill "commit_data". No value should be inserted or
    //! erased between the "insert_check" and "insert_commit" calls.
    static void insert_unique_commit
- (node_ptr header, node_ptr new_value, const insert_commit_data &commit_data)
+ (const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data)
    {
       tree_algorithms::insert_unique_commit(header, new_value, commit_data);
       rebalance_after_insertion(header, new_value);
@@ -760,7 +759,7 @@
    //! <b>Complexity</b>: Logarithmic.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr get_header(node_ptr n)
+ static node_ptr get_header(const node_ptr & n)
    { return tree_algorithms::get_header(n); }
 
    /// @cond
@@ -773,7 +772,7 @@
    //! <b>Complexity</b>: Constant.
    //!
    //! <b>Throws</b>: Nothing.
- static bool is_header(const_node_ptr p)
+ static bool is_header(const const_node_ptr & p)
    {
       return NodeTraits::get_color(p) == NodeTraits::red() &&
             tree_algorithms::is_header(p);
@@ -781,9 +780,10 @@
       // NodeTraits::get_parent(NodeTraits::get_parent(p)) == p;
    }
 
- static void rebalance_after_erasure(node_ptr header, node_ptr x, node_ptr x_parent)
+ static void rebalance_after_erasure(const node_ptr & header, const node_ptr &xnode, const node_ptr &xnode_parent)
    {
- while(x != NodeTraits::get_parent(header) && (x == 0 || NodeTraits::get_color(x) == NodeTraits::black())){
+ node_ptr x(xnode), x_parent(xnode_parent);
+ while(x != NodeTraits::get_parent(header) && (x == node_ptr() || NodeTraits::get_color(x) == NodeTraits::black())){
          if(x == NodeTraits::get_left(x_parent)){
             node_ptr w = NodeTraits::get_right(x_parent);
             if(NodeTraits::get_color(w) == NodeTraits::red()){
@@ -792,14 +792,14 @@
                tree_algorithms::rotate_left(x_parent, header);
                w = NodeTraits::get_right(x_parent);
             }
- if((NodeTraits::get_left(w) == 0 || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black()) &&
- (NodeTraits::get_right(w) == 0 || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black())){
+ if((NodeTraits::get_left(w) == node_ptr() || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black()) &&
+ (NodeTraits::get_right(w) == node_ptr() || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black())){
                NodeTraits::set_color(w, NodeTraits::red());
                x = x_parent;
                x_parent = NodeTraits::get_parent(x_parent);
             }
             else {
- if(NodeTraits::get_right(w) == 0 || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black()){
+ if(NodeTraits::get_right(w) == node_ptr() || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black()){
                   NodeTraits::set_color(NodeTraits::get_left(w), NodeTraits::black());
                   NodeTraits::set_color(w, NodeTraits::red());
                   tree_algorithms::rotate_right(w, header);
@@ -822,14 +822,14 @@
                tree_algorithms::rotate_right(x_parent, header);
                w = NodeTraits::get_left(x_parent);
             }
- if((NodeTraits::get_right(w) == 0 || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black()) &&
- (NodeTraits::get_left(w) == 0 || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black())){
+ if((NodeTraits::get_right(w) == node_ptr() || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black()) &&
+ (NodeTraits::get_left(w) == node_ptr() || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black())){
                NodeTraits::set_color(w, NodeTraits::red());
                x = x_parent;
                x_parent = NodeTraits::get_parent(x_parent);
             }
             else {
- if(NodeTraits::get_left(w) == 0 || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black()){
+ if(NodeTraits::get_left(w) == node_ptr() || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black()){
                   NodeTraits::set_color(NodeTraits::get_right(w), NodeTraits::black());
                   NodeTraits::set_color(w, NodeTraits::red());
                   tree_algorithms::rotate_left(w, header);
@@ -849,8 +849,9 @@
    }
 
 
- static void rebalance_after_insertion(node_ptr header, node_ptr p)
+ static void rebalance_after_insertion(const node_ptr & header, const node_ptr &pnode)
    {
+ node_ptr p(pnode);
       NodeTraits::set_color(p, NodeTraits::red());
       while(p != NodeTraits::get_parent(header) && NodeTraits::get_color(NodeTraits::get_parent(p)) == NodeTraits::red()){
          node_ptr p_parent(NodeTraits::get_parent(p));

Modified: trunk/boost/intrusive/sgtree.hpp
==============================================================================
--- trunk/boost/intrusive/sgtree.hpp (original)
+++ trunk/boost/intrusive/sgtree.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -32,9 +32,10 @@
 #include <boost/intrusive/bs_set_hook.hpp>
 #include <boost/intrusive/detail/tree_node.hpp>
 #include <boost/intrusive/detail/ebo_functor_holder.hpp>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/detail/clear_on_destructor_base.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
+#include <boost/intrusive/detail/utilities.hpp>
 #include <boost/intrusive/options.hpp>
 #include <boost/intrusive/sgtree_algorithms.hpp>
 #include <boost/intrusive/link_mode.hpp>
@@ -223,24 +224,26 @@
    /// @endcond
    typedef typename real_value_traits::pointer pointer;
    typedef typename real_value_traits::const_pointer const_pointer;
- typedef typename std::iterator_traits<pointer>::value_type value_type;
+ typedef typename pointer_traits<pointer>::element_type value_type;
    typedef value_type key_type;
- typedef typename std::iterator_traits<pointer>::reference reference;
- typedef typename std::iterator_traits<const_pointer>::reference const_reference;
- typedef typename std::iterator_traits<pointer>::difference_type difference_type;
+ typedef typename pointer_traits<pointer>::reference reference;
+ typedef typename pointer_traits<const_pointer>::reference const_reference;
+ typedef typename pointer_traits<const_pointer>::difference_type difference_type;
    typedef typename Config::size_type size_type;
    typedef typename Config::compare value_compare;
    typedef value_compare key_compare;
    typedef tree_iterator<sgtree_impl, false> iterator;
    typedef tree_iterator<sgtree_impl, true> const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef boost::intrusive::detail::reverse_iterator<iterator> reverse_iterator;
+ typedef boost::intrusive::detail::reverse_iterator<const_iterator>const_reverse_iterator;
    typedef typename real_value_traits::node_traits node_traits;
    typedef typename node_traits::node node;
- typedef typename boost::pointer_to_other
- <pointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <node_ptr, const node>::type const_node_ptr;
+ typedef typename pointer_traits
+ <pointer>::template rebind_pointer
+ <node>::type node_ptr;
+ typedef typename pointer_traits
+ <pointer>::template rebind_pointer
+ <const node>::type const_node_ptr;
    typedef sgtree_algorithms<node_traits> node_algorithms;
 
    static const bool floating_point = Config::floating_point;
@@ -309,14 +312,14 @@
    value_traits &priv_value_traits()
    { return data_; }
 
- const node &priv_header() const
- { return data_.node_plus_pred_.header_plus_alpha_.header_; }
+ node_ptr priv_header_ptr()
+ { return pointer_traits<node_ptr>::pointer_to(data_.node_plus_pred_.header_plus_alpha_.header_); }
 
- node &priv_header()
- { return data_.node_plus_pred_.header_plus_alpha_.header_; }
+ const_node_ptr priv_header_ptr() const
+ { return pointer_traits<const_node_ptr>::pointer_to(data_.node_plus_pred_.header_plus_alpha_.header_); }
 
- static node_ptr uncast(const_node_ptr ptr)
- { return node_ptr(const_cast<node*>(detail::boost_intrusive_get_pointer(ptr))); }
+ static node_ptr uncast(const const_node_ptr & ptr)
+ { return pointer_traits<node_ptr>::const_cast_from(ptr); }
 
    size_traits &priv_size_traits()
    { return data_.node_plus_pred_.size_traits_; }
@@ -371,7 +374,7 @@
               , const value_traits &v_traits = value_traits())
       : data_(cmp, v_traits)
    {
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(size_type(0));
    }
 
@@ -393,7 +396,7 @@
               , const value_traits &v_traits = value_traits())
       : data_(cmp, v_traits)
    {
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(size_type(0));
       if(unique)
          this->insert_unique(b, e);
@@ -406,7 +409,7 @@
    sgtree_impl(BOOST_RV_REF(sgtree_impl) x)
       : data_(::boost::move(x.priv_comp()), ::boost::move(x.priv_value_traits()))
    {
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(size_type(0));
       this->swap(x);
    }
@@ -432,7 +435,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    iterator begin()
- { return iterator (node_traits::get_left(node_ptr(&priv_header())), this); }
+ { return iterator (node_traits::get_left(this->priv_header_ptr()), this); }
 
    //! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the tree.
    //!
@@ -448,7 +451,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    const_iterator cbegin() const
- { return const_iterator (node_traits::get_left(const_node_ptr(&priv_header())), this); }
+ { return const_iterator (node_traits::get_left(this->priv_header_ptr()), this); }
 
    //! <b>Effects</b>: Returns an iterator pointing to the end of the tree.
    //!
@@ -456,7 +459,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    iterator end()
- { return iterator (node_ptr(&priv_header()), this); }
+ { return iterator (this->priv_header_ptr(), this); }
 
    //! <b>Effects</b>: Returns a const_iterator pointing to the end of the tree.
    //!
@@ -472,7 +475,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    const_iterator cend() const
- { return const_iterator (uncast(const_node_ptr(&priv_header())), this); }
+ { return const_iterator (uncast(this->priv_header_ptr()), this); }
 
    //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
    //! reversed tree.
@@ -586,7 +589,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    bool empty() const
- { return node_algorithms::unique(const_node_ptr(&priv_header())); }
+ { return node_algorithms::unique(this->priv_header_ptr()); }
 
    //! <b>Effects</b>: Returns the number of elements stored in the tree.
    //!
@@ -599,7 +602,7 @@
       if(constant_time_size)
          return this->priv_size_traits().get_size();
       else{
- return (size_type)node_algorithms::size(const_node_ptr(&priv_header()));
+ return (size_type)node_algorithms::size(this->priv_header_ptr());
       }
    }
 
@@ -616,7 +619,7 @@
       swap(priv_alpha_traits(), priv_alpha_traits());
       swap(data_.max_tree_size_, other.data_.max_tree_size_);
       //These can't throw
- node_algorithms::swap_tree(node_ptr(&priv_header()), node_ptr(&other.priv_header()));
+ node_algorithms::swap_tree(this->priv_header_ptr(), other.priv_header_ptr());
       if(constant_time_size){
          size_type backup = this->priv_size_traits().get_size();
          this->priv_size_traits().set_size(other.priv_size_traits().get_size());
@@ -644,7 +647,7 @@
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
       node_ptr p = node_algorithms::insert_equal_upper_bound
- (node_ptr(&priv_header()), to_insert, key_node_comp
+ (this->priv_header_ptr(), to_insert, key_node_comp
          , (size_type)this->size(), this->get_h_alpha_func(), max_tree_size);
       this->priv_size_traits().increment();
       data_.max_tree_size_ = (size_type)max_tree_size;
@@ -674,7 +677,7 @@
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
       node_ptr p = node_algorithms::insert_equal
- (node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp
+ (this->priv_header_ptr(), hint.pointed_node(), to_insert, key_node_comp
          , (std::size_t)this->size(), this->get_h_alpha_func(), max_tree_size);
       this->priv_size_traits().increment();
       data_.max_tree_size_ = (size_type)max_tree_size;
@@ -812,7 +815,7 @@
          comp(key_value_comp, this);
       std::pair<node_ptr, bool> ret =
          (node_algorithms::insert_unique_check
- (node_ptr(&priv_header()), key, comp, commit_data));
+ (this->priv_header_ptr(), key, comp, commit_data));
       return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
    }
 
@@ -857,7 +860,7 @@
          comp(key_value_comp, this);
       std::pair<node_ptr, bool> ret =
          (node_algorithms::insert_unique_check
- (node_ptr(&priv_header()), hint.pointed_node(), key, comp, commit_data));
+ (this->priv_header_ptr(), hint.pointed_node(), key, comp, commit_data));
       return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
    }
 
@@ -885,7 +888,7 @@
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
       node_algorithms::insert_unique_commit
- ( node_ptr(&priv_header()), to_insert, commit_data
+ ( this->priv_header_ptr(), to_insert, commit_data
          , (std::size_t)this->size(), this->get_h_alpha_func(), max_tree_size);
       this->priv_size_traits().increment();
       data_.max_tree_size_ = (size_type)max_tree_size;
@@ -913,7 +916,7 @@
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
       node_ptr p = node_algorithms::insert_before
- ( node_ptr(&priv_header()), pos.pointed_node(), to_insert
+ ( this->priv_header_ptr(), pos.pointed_node(), to_insert
          , (size_type)this->size(), this->get_h_alpha_func(), max_tree_size);
       this->priv_size_traits().increment();
       data_.max_tree_size_ = (size_type)max_tree_size;
@@ -941,7 +944,7 @@
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
       node_algorithms::push_back
- ( node_ptr(&priv_header()), to_insert
+ ( this->priv_header_ptr(), to_insert
          , (size_type)this->size(), this->get_h_alpha_func(), max_tree_size);
       this->priv_size_traits().increment();
       data_.max_tree_size_ = (size_type)max_tree_size;
@@ -968,7 +971,7 @@
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
       node_algorithms::push_front
- ( node_ptr(&priv_header()), to_insert
+ ( this->priv_header_ptr(), to_insert
          , (size_type)this->size(), this->get_h_alpha_func(), max_tree_size);
       this->priv_size_traits().increment();
       data_.max_tree_size_ = (size_type)max_tree_size;
@@ -991,7 +994,7 @@
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!node_algorithms::unique(to_erase));
       std::size_t max_tree_size = data_.max_tree_size_;
       node_algorithms::erase
- ( &priv_header(), to_erase, (std::size_t)this->size()
+ ( this->priv_header_ptr(), to_erase, (std::size_t)this->size()
          , max_tree_size, this->get_alpha_by_max_size_func());
       data_.max_tree_size_ = (size_type)max_tree_size;
       this->priv_size_traits().decrement();
@@ -1155,7 +1158,7 @@
          this->clear_and_dispose(detail::null_disposer());
       }
       else{
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
          this->priv_size_traits().set_size(0);
       }
    }
@@ -1172,7 +1175,7 @@
    template<class Disposer>
    void clear_and_dispose(Disposer disposer)
    {
- node_algorithms::clear_and_dispose(node_ptr(&priv_header())
+ node_algorithms::clear_and_dispose(this->priv_header_ptr()
          , detail::node_disposer<Disposer, sgtree_impl>(disposer, this));
       this->priv_size_traits().set_size(0);
    }
@@ -1229,7 +1232,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, sgtree_impl>
          key_node_comp(comp, this);
       return iterator(node_algorithms::lower_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Returns a const iterator to the first element whose
@@ -1244,7 +1247,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, sgtree_impl>
          key_node_comp(comp, this);
       return const_iterator(node_algorithms::lower_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Returns an iterator to the first element whose
@@ -1269,7 +1272,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, sgtree_impl>
          key_node_comp(comp, this);
       return iterator(node_algorithms::upper_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Returns an iterator to the first element whose
@@ -1294,7 +1297,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, sgtree_impl>
          key_node_comp(comp, this);
       return const_iterator(node_algorithms::upper_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Finds an iterator to the first element whose key is
@@ -1318,7 +1321,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, sgtree_impl>
          key_node_comp(comp, this);
       return iterator
- (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (node_algorithms::find(this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
@@ -1342,7 +1345,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, sgtree_impl>
          key_node_comp(comp, this);
       return const_iterator
- (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (node_algorithms::find(this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Finds a range containing all elements whose key is k or
@@ -1368,7 +1371,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, sgtree_impl>
          key_node_comp(comp, this);
       std::pair<node_ptr, node_ptr> ret
- (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp));
+ (node_algorithms::equal_range(this->priv_header_ptr(), key, key_node_comp));
       return std::pair<iterator, iterator>(iterator(ret.first, this), iterator(ret.second, this));
    }
 
@@ -1397,7 +1400,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, sgtree_impl>
          key_node_comp(comp, this);
       std::pair<node_ptr, node_ptr> ret
- (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp));
+ (node_algorithms::equal_range(this->priv_header_ptr(), key, key_node_comp));
       return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
    }
 
@@ -1423,8 +1426,8 @@
          detail::exception_disposer<sgtree_impl, Disposer>
             rollback(*this, disposer);
          node_algorithms::clone
- (const_node_ptr(&src.priv_header())
- ,node_ptr(&this->priv_header())
+ (src.priv_header_ptr()
+ ,this->priv_header_ptr()
             ,detail::node_cloner<Cloner, sgtree_impl>(cloner, this)
             ,detail::node_disposer<Disposer, sgtree_impl>(disposer, this));
          this->priv_size_traits().set_size(src.priv_size_traits().get_size());
@@ -1446,7 +1449,7 @@
    pointer unlink_leftmost_without_rebalance()
    {
       node_ptr to_be_disposed(node_algorithms::unlink_leftmost_without_rebalance
- (node_ptr(&priv_header())));
+ (this->priv_header_ptr()));
       if(!to_be_disposed)
          return 0;
       this->priv_size_traits().decrement();
@@ -1472,7 +1475,7 @@
    void replace_node(iterator replace_this, reference with_this)
    {
       node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this)
- , node_ptr(&priv_header())
+ , this->priv_header_ptr()
                                    , get_real_value_traits().to_node_ptr(with_this));
       if(safemode_or_autounlink)
          node_algorithms::init(replace_this.pointed_node());
@@ -1558,7 +1561,7 @@
    //!
    //! <b>Complexity</b>: Linear.
    void rebalance()
- { node_algorithms::rebalance(node_ptr(&priv_header())); }
+ { node_algorithms::rebalance(this->priv_header_ptr()); }
 
    //! <b>Requires</b>: old_root is a node of a tree.
    //!
@@ -1654,7 +1657,7 @@
    static sgtree_impl &priv_container_from_end_iterator(const const_iterator &end_iterator)
    {
       header_plus_alpha *r = detail::parent_from_member<header_plus_alpha, node>
- ( detail::boost_intrusive_get_pointer(end_iterator.pointed_node()), &header_plus_alpha::header_);
+ ( boost::intrusive::detail::to_raw_pointer(end_iterator.pointed_node()), &header_plus_alpha::header_);
       node_plus_pred_t *n = detail::parent_from_member
          <node_plus_pred_t, header_plus_alpha>(r, &node_plus_pred_t::header_plus_alpha_);
       data_t *d = detail::parent_from_member<data_t, node_plus_pred_t>(n, &data_t::node_plus_pred_);

Modified: trunk/boost/intrusive/sgtree_algorithms.hpp
==============================================================================
--- trunk/boost/intrusive/sgtree_algorithms.hpp (original)
+++ trunk/boost/intrusive/sgtree_algorithms.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -24,6 +24,7 @@
 #include <boost/intrusive/detail/assert.hpp>
 #include <boost/intrusive/detail/utilities.hpp>
 #include <boost/intrusive/detail/tree_algorithms.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 
 
 namespace boost {
@@ -68,17 +69,15 @@
 
    typedef detail::tree_algorithms<NodeTraits> tree_algorithms;
 
- static node_ptr uncast(const_node_ptr ptr)
- {
- return node_ptr(const_cast<node*>(::boost::intrusive::detail::boost_intrusive_get_pointer(ptr)));
- }
+ static node_ptr uncast(const const_node_ptr & ptr)
+ { return pointer_traits<node_ptr>::const_cast_from(ptr); }
    /// @endcond
 
    public:
- static node_ptr begin_node(const_node_ptr header)
+ static node_ptr begin_node(const const_node_ptr & header)
    { return tree_algorithms::begin_node(header); }
 
- static node_ptr end_node(const_node_ptr header)
+ static node_ptr end_node(const const_node_ptr & header)
    { return tree_algorithms::end_node(header); }
 
    //! This type is the information that will be
@@ -98,7 +97,7 @@
    //! <b>Complexity</b>: Constant.
    //!
    //! <b>Throws</b>: Nothing.
- static void swap_tree(node_ptr header1, node_ptr header2)
+ static void swap_tree(const node_ptr & header1, const node_ptr & header2)
    { return tree_algorithms::swap_tree(header1, header2); }
 
    //! <b>Requires</b>: node1 and node2 can't be header nodes
@@ -116,7 +115,7 @@
    //! node1 and node2 are not equivalent according to the ordering rules.
    //!
    //!Experimental function
- static void swap_nodes(node_ptr node1, node_ptr node2)
+ static void swap_nodes(const node_ptr & node1, const node_ptr & node2)
    {
       if(node1 == node2)
          return;
@@ -140,7 +139,7 @@
    //! node1 and node2 are not equivalent according to the ordering rules.
    //!
    //!Experimental function
- static void swap_nodes(node_ptr node1, node_ptr header1, node_ptr node2, node_ptr header2)
+ static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2)
    { tree_algorithms::swap_nodes(node1, header1, node2, header2); }
 
    //! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
@@ -159,7 +158,7 @@
    //! the node, since no rebalancing and comparison is needed.
    //!
    //!Experimental function
- static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node)
+ static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node)
    {
       if(node_to_be_replaced == new_node)
          return;
@@ -182,7 +181,7 @@
    //! the node, since no rebalancing or comparison is needed.
    //!
    //!Experimental function
- static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node)
+ static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node)
    { tree_algorithms::replace_node(node_to_be_replaced, header, new_node); }
 
    //! <b>Requires</b>: node is a tree node but not the header.
@@ -192,7 +191,7 @@
    //! <b>Complexity</b>: Average complexity is constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static void unlink(node_ptr node)
+ static void unlink(const node_ptr & node)
    {
       node_ptr x = NodeTraits::get_parent(node);
       if(x){
@@ -215,7 +214,7 @@
    //! only be used for more unlink_leftmost_without_rebalance calls.
    //! This function is normally used to achieve a step by step
    //! controlled destruction of the tree.
- static node_ptr unlink_leftmost_without_rebalance(node_ptr header)
+ static node_ptr unlink_leftmost_without_rebalance(const node_ptr & header)
    { return tree_algorithms::unlink_leftmost_without_rebalance(header); }
 
    //! <b>Requires</b>: node is a node of the tree or an node initialized
@@ -226,7 +225,7 @@
    //! <b>Complexity</b>: Constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static bool unique(const_node_ptr node)
+ static bool unique(const const_node_ptr & node)
    { return tree_algorithms::unique(node); }
 
    //! <b>Requires</b>: node is a node of the tree but it's not the header.
@@ -236,7 +235,7 @@
    //! <b>Complexity</b>: Linear time.
    //!
    //! <b>Throws</b>: Nothing.
- static std::size_t count(const_node_ptr node)
+ static std::size_t count(const const_node_ptr & node)
    { return tree_algorithms::count(node); }
 
    //! <b>Requires</b>: header is the header node of the tree.
@@ -246,7 +245,7 @@
    //! <b>Complexity</b>: Linear time.
    //!
    //! <b>Throws</b>: Nothing.
- static std::size_t size(const_node_ptr header)
+ static std::size_t size(const const_node_ptr & header)
    { return tree_algorithms::size(header); }
 
    //! <b>Requires</b>: p is a node from the tree except the header.
@@ -256,7 +255,7 @@
    //! <b>Complexity</b>: Average constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr next_node(node_ptr p)
+ static node_ptr next_node(const node_ptr & p)
    { return tree_algorithms::next_node(p); }
 
    //! <b>Requires</b>: p is a node from the tree except the leftmost node.
@@ -266,7 +265,7 @@
    //! <b>Complexity</b>: Average constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr prev_node(node_ptr p)
+ static node_ptr prev_node(const node_ptr & p)
    { return tree_algorithms::prev_node(p); }
 
    //! <b>Requires</b>: node must not be part of any tree.
@@ -278,7 +277,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
- static void init(node_ptr node)
+ static void init(const node_ptr & node)
    { tree_algorithms::init(node); }
 
    //! <b>Requires</b>: node must not be part of any tree.
@@ -291,7 +290,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
- static void init_header(node_ptr header)
+ static void init_header(const node_ptr & header)
    { tree_algorithms::init_header(header); }
 
    //! <b>Requires</b>: header must be the header of a tree, z a node
@@ -303,7 +302,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    template<class AlphaByMaxSize>
- static node_ptr erase(node_ptr header, node_ptr z, std::size_t tree_size, std::size_t &max_tree_size, AlphaByMaxSize alpha_by_maxsize)
+ static node_ptr erase(const node_ptr & header, const node_ptr & z, std::size_t tree_size, std::size_t &max_tree_size, AlphaByMaxSize alpha_by_maxsize)
    {
       //typename tree_algorithms::data_for_rebalance info;
       tree_algorithms::erase(header, z);
@@ -321,13 +320,13 @@
    //! take a node_ptr and shouldn't throw.
    //!
    //! <b>Effects</b>: First empties target tree calling
- //! <tt>void disposer::operator()(node_ptr)</tt> for every node of the tree
+ //! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
    //! except the header.
    //!
    //! Then, duplicates the entire tree pointed by "source_header" cloning each
- //! source node with <tt>node_ptr Cloner::operator()(node_ptr)</tt> to obtain
+ //! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
    //! the nodes of the target tree. If "cloner" throws, the cloned target nodes
- //! are disposed using <tt>void disposer(node_ptr)</tt>.
+ //! are disposed using <tt>void disposer(const node_ptr &)</tt>.
    //!
    //! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
    //! number of elements of tree target tree when calling this function.
@@ -335,7 +334,7 @@
    //! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
    template <class Cloner, class Disposer>
    static void clone
- (const_node_ptr source_header, node_ptr target_header, Cloner cloner, Disposer disposer)
+ (const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer)
    {
       tree_algorithms::clone(source_header, target_header, cloner, disposer);
    }
@@ -344,7 +343,7 @@
    //! taking a node_ptr parameter and shouldn't throw.
    //!
    //! <b>Effects</b>: Empties the target tree calling
- //! <tt>void disposer::operator()(node_ptr)</tt> for every node of the tree
+ //! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
    //! except the header.
    //!
    //! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
@@ -352,7 +351,7 @@
    //!
    //! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
    template<class Disposer>
- static void clear_and_dispose(node_ptr header, Disposer disposer)
+ static void clear_and_dispose(const node_ptr & header, Disposer disposer)
    { tree_algorithms::clear_and_dispose(header, disposer); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -369,7 +368,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr lower_bound
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    { return tree_algorithms::lower_bound(header, key, comp); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -385,7 +384,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr upper_bound
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    { return tree_algorithms::upper_bound(header, key, comp); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -401,7 +400,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr find
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    { return tree_algorithms::find(header, key, comp); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -419,7 +418,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static std::pair<node_ptr, node_ptr> equal_range
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    { return tree_algorithms::equal_range(header, key, comp); }
 
    //! <b>Requires</b>: "h" must be the header node of a tree.
@@ -436,7 +435,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class NodePtrCompare, class H_Alpha>
    static node_ptr insert_equal_upper_bound
- (node_ptr h, node_ptr new_node, NodePtrCompare comp
+ (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp
       ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
    {
       std::size_t depth;
@@ -459,7 +458,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class NodePtrCompare, class H_Alpha>
    static node_ptr insert_equal_lower_bound
- (node_ptr h, node_ptr new_node, NodePtrCompare comp
+ (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp
       ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
    {
       std::size_t depth;
@@ -484,7 +483,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class NodePtrCompare, class H_Alpha>
    static node_ptr insert_equal
- (node_ptr header, node_ptr hint, node_ptr new_node, NodePtrCompare comp
+ (const node_ptr & header, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp
       ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
    {
       std::size_t depth;
@@ -529,7 +528,7 @@
    //! if no more objects are inserted or erased from the set.
    template<class KeyType, class KeyNodePtrCompare>
    static std::pair<node_ptr, bool> insert_unique_check
- (const_node_ptr header, const KeyType &key
+ (const const_node_ptr & header, const KeyType &key
       ,KeyNodePtrCompare comp, insert_commit_data &commit_data)
    {
       std::size_t depth;
@@ -556,7 +555,7 @@
    //! tree invariants might be broken.
    template<class H_Alpha>
    static node_ptr insert_before
- (node_ptr header, node_ptr pos, node_ptr new_node
+ (const node_ptr & header, const node_ptr & pos, const node_ptr & new_node
       ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
    {
       std::size_t depth;
@@ -579,7 +578,7 @@
    //! tree invariants are broken. This function is slightly faster than
    //! using "insert_before".
    template<class H_Alpha>
- static void push_back(node_ptr header, node_ptr new_node
+ static void push_back(const node_ptr & header, const node_ptr & new_node
          ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
    {
       std::size_t depth;
@@ -601,7 +600,7 @@
    //! tree invariants are broken. This function is slightly faster than
    //! using "insert_before".
    template<class H_Alpha>
- static void push_front(node_ptr header, node_ptr new_node
+ static void push_front(const node_ptr & header, const node_ptr & new_node
          ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
    {
       std::size_t depth;
@@ -650,7 +649,7 @@
    //! if no more objects are inserted or erased from the set.
    template<class KeyType, class KeyNodePtrCompare>
    static std::pair<node_ptr, bool> insert_unique_check
- (const_node_ptr header, node_ptr hint, const KeyType &key
+ (const const_node_ptr & header, const node_ptr &hint, const KeyType &key
       ,KeyNodePtrCompare comp, insert_commit_data &commit_data)
    {
       std::size_t depth;
@@ -680,7 +679,7 @@
    //! erased between the "insert_check" and "insert_commit" calls.
    template<class H_Alpha>
    static void insert_unique_commit
- (node_ptr header, node_ptr new_value, const insert_commit_data &commit_data
+ (const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data
       ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
    {
       tree_algorithms::insert_unique_commit(header, new_value, commit_data);
@@ -694,7 +693,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Linear.
- static void rebalance(node_ptr header)
+ static void rebalance(const node_ptr & header)
    { tree_algorithms::rebalance(header); }
 
    //! <b>Requires</b>: old_root is a node of a tree.
@@ -706,7 +705,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Linear.
- static node_ptr rebalance_subtree(node_ptr old_root)
+ static node_ptr rebalance_subtree(const node_ptr & old_root)
    { return tree_algorithms::rebalance_subtree(old_root); }
 
    //! <b>Requires</b>: "n" must be a node inserted in a tree.
@@ -716,7 +715,7 @@
    //! <b>Complexity</b>: Logarithmic.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr get_header(node_ptr n)
+ static node_ptr get_header(const node_ptr & n)
    { return tree_algorithms::get_header(n); }
 
    /// @cond
@@ -729,12 +728,12 @@
    //! <b>Complexity</b>: Constant.
    //!
    //! <b>Throws</b>: Nothing.
- static bool is_header(const_node_ptr p)
+ static bool is_header(const const_node_ptr & p)
    { return tree_algorithms::is_header(p); }
 
    template<class H_Alpha>
    static void rebalance_after_insertion
- ( node_ptr x, std::size_t depth
+ (const node_ptr &x, std::size_t depth
       , std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
    {
       if(tree_size > max_tree_size)

Modified: trunk/boost/intrusive/slist.hpp
==============================================================================
--- trunk/boost/intrusive/slist.hpp (original)
+++ trunk/boost/intrusive/slist.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -21,7 +21,7 @@
 #include <boost/intrusive/slist_hook.hpp>
 #include <boost/intrusive/circular_slist_algorithms.hpp>
 #include <boost/intrusive/linear_slist_algorithms.hpp>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/detail/clear_on_destructor_base.hpp>
 #include <boost/intrusive/link_mode.hpp>
 #include <boost/intrusive/options.hpp>
@@ -121,10 +121,10 @@
    /// @endcond
    typedef typename real_value_traits::pointer pointer;
    typedef typename real_value_traits::const_pointer const_pointer;
- typedef typename std::iterator_traits<pointer>::value_type value_type;
- typedef typename std::iterator_traits<pointer>::reference reference;
- typedef typename std::iterator_traits<const_pointer>::reference const_reference;
- typedef typename std::iterator_traits<pointer>::difference_type difference_type;
+ typedef typename pointer_traits<pointer>::element_type value_type;
+ typedef typename pointer_traits<pointer>::reference reference;
+ typedef typename pointer_traits<const_pointer>::reference const_reference;
+ typedef typename pointer_traits<pointer>::difference_type difference_type;
    typedef typename Config::size_type size_type;
    typedef slist_iterator<slist_impl, false> iterator;
    typedef slist_iterator<slist_impl, true> const_iterator;
@@ -163,18 +163,18 @@
    BOOST_STATIC_ASSERT(!(cache_last && ((int)real_value_traits::link_mode == (int)auto_unlink)));
 
    node_ptr get_end_node()
- { return node_ptr(linear ? node_ptr(0) : this->get_root_node()); }
+ { return node_ptr(linear ? node_ptr() : this->get_root_node()); }
 
    const_node_ptr get_end_node() const
    {
       return const_node_ptr
- (linear ? const_node_ptr(0) : this->get_root_node()); }
+ (linear ? const_node_ptr() : this->get_root_node()); }
 
    node_ptr get_root_node()
- { return node_ptr(&data_.root_plus_size_.root_); }
+ { return pointer_traits<node_ptr>::pointer_to(data_.root_plus_size_.root_); }
 
    const_node_ptr get_root_node() const
- { return const_node_ptr(&data_.root_plus_size_.root_); }
+ { return pointer_traits<const_node_ptr>::pointer_to(data_.root_plus_size_.root_); }
 
    node_ptr get_last_node()
    { return this->get_last_node(detail::bool_<cache_last>()); }
@@ -182,13 +182,13 @@
    const_node_ptr get_last_node() const
    { return this->get_last_node(detail::bool_<cache_last>()); }
 
- void set_last_node(node_ptr n)
+ void set_last_node(const node_ptr &n)
    { return this->set_last_node(n, detail::bool_<cache_last>()); }
 
    static node_ptr get_last_node(detail::bool_<false>)
- { return node_ptr(0); }
+ { return node_ptr(); }
 
- static void set_last_node(node_ptr, detail::bool_<false>)
+ static void set_last_node(const node_ptr &, detail::bool_<false>)
    {}
 
    node_ptr get_last_node(detail::bool_<true>)
@@ -197,12 +197,11 @@
    const_node_ptr get_last_node(detail::bool_<true>) const
    { return const_node_ptr(data_.root_plus_size_.last_); }
 
- void set_last_node(node_ptr n, detail::bool_<true>)
+ void set_last_node(const node_ptr & n, detail::bool_<true>)
    { data_.root_plus_size_.last_ = n; }
 
- static node_ptr uncast(const_node_ptr ptr)
- { return node_ptr(const_cast<node*>(detail::boost_intrusive_get_pointer(ptr))); }
-//iG pending { return boost::const_pointer_cast<node>(ptr); }
+ static node_ptr uncast(const const_node_ptr & ptr)
+ { return pointer_traits<node_ptr>::const_cast_from(ptr); }
 
    void set_default_constructed_state()
    {
@@ -406,7 +405,7 @@
    //! This function is only available is cache_last<> is true.
    void push_back(reference value)
    {
- BOOST_STATIC_ASSERT((cache_last != 0));
+ BOOST_STATIC_ASSERT((cache_last));
       this->insert_after(const_iterator(this->get_last_node(), this), value);
    }
 
@@ -473,7 +472,7 @@
    //! This function is only available is cache_last<> is true.
    reference back()
    {
- BOOST_STATIC_ASSERT((cache_last != 0));
+ BOOST_STATIC_ASSERT((cache_last));
       return *this->get_real_value_traits().to_value_ptr(this->get_last_node());
    }
 
@@ -487,7 +486,7 @@
    //! This function is only available is cache_last<> is true.
    const_reference back() const
    {
- BOOST_STATIC_ASSERT((cache_last != 0));
+ BOOST_STATIC_ASSERT((cache_last));
       return *this->get_real_value_traits().to_value_ptr(this->get_last_node());
    }
 
@@ -835,7 +834,7 @@
          node_ptr bfp = before_first.pointed_node();
          node_ptr lp = last.pointed_node();
          if(cache_last){
- if((lp == this->get_end_node())){
+ if(lp == this->get_end_node()){
                this->set_last_node(bfp);
             }
          }
@@ -1226,7 +1225,7 @@
       }
    }
 
- //! <b>Requires</b>: it is an iterator to an element in x.
+ //! <b>Requires</b>: it is an iterator to an element in *this.
    //!
    //! <b>Effects</b>: Transfers all the elements of list x to this list, before the
    //! the element pointed by it. No destructors or copy constructors are called.
@@ -1743,7 +1742,7 @@
    //!
    //! <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 incorporate_after(const_iterator prev_from, node_ptr first, node_ptr before_last)
+ void incorporate_after(const_iterator prev_from, const node_ptr & first, const node_ptr & before_last)
    {
       if(constant_time_size)
          this->incorporate_after(prev_from, first, before_last, std::distance(first, before_last)+1);
@@ -1766,7 +1765,7 @@
    //!
    //! <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 incorporate_after(const_iterator prev_pos, node_ptr first, node_ptr before_last, difference_type n)
+ void incorporate_after(const_iterator prev_pos, const node_ptr & first, const node_ptr & before_last, difference_type n)
    {
       if(n){
          BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(iterator(first, this), iterator(before_last, this))+1 == n);
@@ -1778,7 +1777,7 @@
    }
 
    private:
- void priv_splice_after(node_ptr prev_pos_n, slist_impl &x, node_ptr before_first_n, node_ptr before_last_n)
+ void priv_splice_after(const node_ptr & prev_pos_n, slist_impl &x, const node_ptr & before_first_n, const node_ptr & before_last_n)
    {
       if (before_first_n != before_last_n && prev_pos_n != before_first_n && prev_pos_n != before_last_n)
       {
@@ -1794,7 +1793,7 @@
       }
    }
 
- void priv_incorporate_after(node_ptr prev_pos_n, node_ptr first_n, node_ptr before_last_n)
+ void priv_incorporate_after(const node_ptr & prev_pos_n, const node_ptr & first_n, const node_ptr & before_last_n)
    {
       if(cache_last){
          if(node_traits::get_next(prev_pos_n) == this->get_end_node()){
@@ -1894,11 +1893,11 @@
    }
 
    //circular version
- static void priv_swap_lists(node_ptr this_node, node_ptr other_node, detail::bool_<false>)
+ static void priv_swap_lists(const node_ptr & this_node, const node_ptr & other_node, detail::bool_<false>)
    { node_algorithms::swap_nodes(this_node, other_node); }
 
    //linear version
- static void priv_swap_lists(node_ptr this_node, node_ptr other_node, detail::bool_<true>)
+ static void priv_swap_lists(const node_ptr & this_node, const node_ptr & other_node, detail::bool_<true>)
    { node_algorithms::swap_trailing_nodes(this_node, other_node); }
 
    static slist_impl &priv_container_from_end_iterator(const const_iterator &end_iterator)
@@ -1907,7 +1906,7 @@
       //singly linked lists (because "end" is represented by the null pointer)
       BOOST_STATIC_ASSERT(!linear);
       root_plus_size *r = detail::parent_from_member<root_plus_size, node>
- ( detail::boost_intrusive_get_pointer(end_iterator.pointed_node()), (&root_plus_size::root_));
+ ( boost::intrusive::detail::to_raw_pointer(end_iterator.pointed_node()), (&root_plus_size::root_));
       data_t *d = detail::parent_from_member<data_t, root_plus_size>
          ( r, &data_t::root_plus_size_);
       slist_impl *s = detail::parent_from_member<slist_impl, data_t>(d, &slist_impl::data_);

Modified: trunk/boost/intrusive/splaytree.hpp
==============================================================================
--- trunk/boost/intrusive/splaytree.hpp (original)
+++ trunk/boost/intrusive/splaytree.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -21,12 +21,14 @@
 #include <boost/intrusive/detail/assert.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/intrusive/intrusive_fwd.hpp>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/splay_set_hook.hpp>
 #include <boost/intrusive/detail/tree_node.hpp>
 #include <boost/intrusive/detail/ebo_functor_holder.hpp>
 #include <boost/intrusive/detail/clear_on_destructor_base.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
+#include <boost/intrusive/detail/utilities.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/options.hpp>
 #include <boost/intrusive/splaytree_algorithms.hpp>
 #include <boost/intrusive/link_mode.hpp>
@@ -95,24 +97,26 @@
    /// @endcond
    typedef typename real_value_traits::pointer pointer;
    typedef typename real_value_traits::const_pointer const_pointer;
- typedef typename std::iterator_traits<pointer>::value_type value_type;
- typedef value_type key_type;
- typedef typename std::iterator_traits<pointer>::reference reference;
- typedef typename std::iterator_traits<const_pointer>::reference const_reference;
- typedef typename std::iterator_traits<pointer>::difference_type difference_type;
+ typedef typename pointer_traits<pointer>::element_type value_type;
+ typedef typename pointer_traits<pointer>::reference reference;
+ typedef typename pointer_traits<const_pointer>::reference const_reference;
+ typedef typename pointer_traits<pointer>::difference_type difference_type;
    typedef typename Config::size_type size_type;
+ typedef value_type key_type;
    typedef typename Config::compare value_compare;
    typedef value_compare key_compare;
    typedef tree_iterator<splaytree_impl, false> iterator;
    typedef tree_iterator<splaytree_impl, true> const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef boost::intrusive::detail::reverse_iterator<iterator> reverse_iterator;
+ typedef boost::intrusive::detail::reverse_iterator<const_iterator>const_reverse_iterator;
    typedef typename real_value_traits::node_traits node_traits;
    typedef typename node_traits::node node;
- typedef typename boost::pointer_to_other
- <pointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <node_ptr, const node>::type const_node_ptr;
+ typedef typename pointer_traits
+ <pointer>::template rebind_pointer
+ <node>::type node_ptr;
+ typedef typename pointer_traits
+ <pointer>::template rebind_pointer
+ <const node>::type const_node_ptr;
    typedef splaytree_algorithms<node_traits> node_algorithms;
 
    static const bool constant_time_size = Config::constant_time_size;
@@ -164,16 +168,14 @@
    value_traits &priv_value_traits()
    { return data_; }
 
- const node &priv_header() const
- { return data_.node_plus_pred_.header_plus_size_.header_; }
+ node_ptr priv_header_ptr()
+ { return pointer_traits<node_ptr>::pointer_to(data_.node_plus_pred_.header_plus_size_.header_); }
 
- node &priv_header()
- { return data_.node_plus_pred_.header_plus_size_.header_; }
+ const_node_ptr priv_header_ptr() const
+ { return pointer_traits<const_node_ptr>::pointer_to(data_.node_plus_pred_.header_plus_size_.header_); }
 
- static node_ptr uncast(const_node_ptr ptr)
- {
- return node_ptr(const_cast<node*>(detail::boost_intrusive_get_pointer(ptr)));
- }
+ static node_ptr uncast(const const_node_ptr & ptr)
+ { return pointer_traits<node_ptr>::const_cast_from(ptr); }
 
    size_traits &priv_size_traits()
    { return data_.node_plus_pred_.header_plus_size_; }
@@ -216,7 +218,7 @@
                  , const value_traits &v_traits = value_traits())
       : data_(cmp, v_traits)
    {
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(size_type(0));
    }
 
@@ -238,7 +240,7 @@
                   , const value_traits &v_traits = value_traits())
       : data_(cmp, v_traits)
    {
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(size_type(0));
       if(unique)
          this->insert_unique(b, e);
@@ -251,7 +253,7 @@
    splaytree_impl(BOOST_RV_REF(splaytree_impl) x)
       : data_(::boost::move(x.priv_comp()), ::boost::move(x.priv_value_traits()))
    {
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(size_type(0));
       this->swap(x);
    }
@@ -278,7 +280,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    iterator begin()
- { return iterator(node_algorithms::begin_node(&priv_header()), this); }
+ { return iterator(node_algorithms::begin_node(this->priv_header_ptr()), this); }
 
    //! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the tree.
    //!
@@ -294,7 +296,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    const_iterator cbegin() const
- { return const_iterator(node_algorithms::begin_node(&priv_header()), this); }
+ { return const_iterator(node_algorithms::begin_node(this->priv_header_ptr()), this); }
 
    //! <b>Effects</b>: Returns an iterator pointing to the end of the tree.
    //!
@@ -302,7 +304,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    iterator end()
- { return iterator (node_ptr(&priv_header()), this); }
+ { return iterator (this->priv_header_ptr(), this); }
 
    //! <b>Effects</b>: Returns a const_iterator pointing to the end of the tree.
    //!
@@ -318,7 +320,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    const_iterator cend() const
- { return const_iterator (uncast(const_node_ptr(&priv_header())), this); }
+ { return const_iterator (uncast(this->priv_header_ptr()), this); }
 
    //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
    //! reversed tree.
@@ -446,7 +448,7 @@
          return this->priv_size_traits().get_size();
       }
       else{
- return (size_type)node_algorithms::size(const_node_ptr(&priv_header()));
+ return (size_type)node_algorithms::size(this->priv_header_ptr());
       }
    }
 
@@ -461,7 +463,7 @@
       using std::swap;
       swap(priv_comp(), priv_comp());
       //These can't throw
- node_algorithms::swap_tree(node_ptr(&priv_header()), node_ptr(&other.priv_header()));
+ node_algorithms::swap_tree(this->priv_header_ptr(), other.priv_header_ptr());
       if(constant_time_size){
          size_type backup = this->priv_size_traits().get_size();
          this->priv_size_traits().set_size(other.priv_size_traits().get_size());
@@ -488,7 +490,7 @@
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       iterator ret (node_algorithms::insert_equal_lower_bound
- (node_ptr(&priv_header()), to_insert, key_node_comp), this);
+ (this->priv_header_ptr(), to_insert, key_node_comp), this);
       this->priv_size_traits().increment();
       return ret;
    }
@@ -515,7 +517,7 @@
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       iterator ret(node_algorithms::insert_equal
- (node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp), this);
+ (this->priv_header_ptr(), hint.pointed_node(), to_insert, key_node_comp), this);
       this->priv_size_traits().increment();
       return ret;
    }
@@ -645,7 +647,7 @@
          comp(key_value_comp, this);
       std::pair<node_ptr, bool> ret =
          (node_algorithms::insert_unique_check
- (node_ptr(&priv_header()), key, comp, commit_data));
+ (this->priv_header_ptr(), key, comp, commit_data));
       return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
    }
 
@@ -690,7 +692,7 @@
          comp(key_value_comp, this);
       std::pair<node_ptr, bool> ret =
          node_algorithms::insert_unique_check
- (node_ptr(&priv_header()), hint.pointed_node(), key, comp, commit_data);
+ (this->priv_header_ptr(), hint.pointed_node(), key, comp, commit_data);
       return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
    }
 
@@ -717,7 +719,7 @@
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       node_algorithms::insert_unique_commit
- (node_ptr(&priv_header()), to_insert, commit_data);
+ (this->priv_header_ptr(), to_insert, commit_data);
       this->priv_size_traits().increment();
       return iterator(to_insert, this);
    }
@@ -737,7 +739,7 @@
       node_ptr to_erase(i.pointed_node());
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!node_algorithms::unique(to_erase));
- node_algorithms::erase(&priv_header(), to_erase);
+ node_algorithms::erase(this->priv_header_ptr(), to_erase);
       this->priv_size_traits().decrement();
       if(safemode_or_autounlink)
          node_algorithms::init(to_erase);
@@ -899,7 +901,7 @@
          this->clear_and_dispose(detail::null_disposer());
       }
       else{
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
          this->priv_size_traits().set_size(0);
       }
    }
@@ -916,7 +918,7 @@
    template<class Disposer>
    void clear_and_dispose(Disposer disposer)
    {
- node_algorithms::clear_and_dispose(node_ptr(&priv_header())
+ node_algorithms::clear_and_dispose(this->priv_header_ptr()
          , detail::node_disposer<Disposer, splaytree_impl>(disposer, this));
       this->priv_size_traits().set_size(0);
    }
@@ -995,7 +997,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, splaytree_impl>
          key_node_comp(comp, this);
       return iterator(node_algorithms::lower_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Returns a const iterator to the first element whose
@@ -1010,7 +1012,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, splaytree_impl>
          key_node_comp(comp, this);
       return const_iterator(node_algorithms::lower_bound
- (const_node_ptr(&priv_header()), key, key_node_comp, false), this);
+ (this->priv_header_ptr(), key, key_node_comp, false), this);
    }
 
    //! <b>Effects</b>: Returns an iterator to the first element whose
@@ -1035,7 +1037,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, splaytree_impl>
          key_node_comp(comp, this);
       return iterator(node_algorithms::upper_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Returns an iterator to the first element whose
@@ -1060,7 +1062,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, splaytree_impl>
          key_node_comp(comp, this);
       return const_iterator(node_algorithms::upper_bound_dont_splay
- (const_node_ptr(&priv_header()), key, key_node_comp, false), this);
+ (this->priv_header_ptr(), key, key_node_comp, false), this);
    }
 
    //! <b>Effects</b>: Finds an iterator to the first element whose key is
@@ -1084,7 +1086,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, splaytree_impl>
          key_node_comp(comp, this);
       return iterator
- (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (node_algorithms::find(this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
@@ -1108,7 +1110,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, splaytree_impl>
          key_node_comp(comp, this);
       return const_iterator
- (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp, false), this);
+ (node_algorithms::find(this->priv_header_ptr(), key, key_node_comp, false), this);
    }
 
    //! <b>Effects</b>: Finds a range containing all elements whose key is k or
@@ -1134,7 +1136,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, splaytree_impl>
          key_node_comp(comp, this);
       std::pair<node_ptr, node_ptr> ret
- (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp));
+ (node_algorithms::equal_range(this->priv_header_ptr(), key, key_node_comp));
       return std::pair<iterator, iterator>(iterator(ret.first, this), iterator(ret.second, this));
    }
 
@@ -1163,7 +1165,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, splaytree_impl>
          key_node_comp(comp, this);
       std::pair<node_ptr, node_ptr> ret
- (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp, false));
+ (node_algorithms::equal_range(this->priv_header_ptr(), key, key_node_comp, false));
       return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
    }
 
@@ -1189,8 +1191,8 @@
          detail::exception_disposer<splaytree_impl, Disposer>
             rollback(*this, disposer);
          node_algorithms::clone
- (const_node_ptr(&src.priv_header())
- ,node_ptr(&this->priv_header())
+ (src.priv_header_ptr()
+ ,this->priv_header_ptr()
             ,detail::node_cloner<Cloner, splaytree_impl>(cloner, this)
             ,detail::node_disposer<Disposer, splaytree_impl>(disposer, this));
          this->priv_size_traits().set_size(src.priv_size_traits().get_size());
@@ -1212,7 +1214,7 @@
    pointer unlink_leftmost_without_rebalance()
    {
       node_ptr to_be_disposed(node_algorithms::unlink_leftmost_without_rebalance
- (node_ptr(&priv_header())));
+ (this->priv_header_ptr()));
       if(!to_be_disposed)
          return 0;
       this->priv_size_traits().decrement();
@@ -1230,7 +1232,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    void splay_up(iterator i)
- { return node_algorithms::splay_up(i.pointed_node(), &priv_header()); }
+ { return node_algorithms::splay_up(i.pointed_node(), this->priv_header_ptr()); }
 
    //! <b>Effects</b>: Rearranges the splay set so that if *this stores an element
    //! with a key equivalent to value the element is placed as the root of the
@@ -1247,7 +1249,7 @@
    {
       detail::key_nodeptr_comp<KeyValueCompare, splaytree_impl>
          key_node_comp(comp, this);
- node_ptr r = node_algorithms::splay_down(&priv_header(), key, key_node_comp);
+ node_ptr r = node_algorithms::splay_down(this->priv_header_ptr(), key, key_node_comp);
       return iterator(r, this);
    }
 
@@ -1280,7 +1282,7 @@
    void replace_node(iterator replace_this, reference with_this)
    {
       node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this)
- , node_ptr(&priv_header())
+ , this->priv_header_ptr()
                                    , get_real_value_traits().to_node_ptr(with_this));
       if(safemode_or_autounlink)
          node_algorithms::init(replace_this.pointed_node());
@@ -1366,7 +1368,7 @@
    //!
    //! <b>Complexity</b>: Linear.
    void rebalance()
- { node_algorithms::rebalance(node_ptr(&priv_header())); }
+ { node_algorithms::rebalance(this->priv_header_ptr()); }
 
    //! <b>Requires</b>: old_root is a node of a tree.
    //!
@@ -1430,7 +1432,7 @@
    static splaytree_impl &priv_container_from_end_iterator(const const_iterator &end_iterator)
    {
       header_plus_size *r = detail::parent_from_member<header_plus_size, node>
- ( detail::boost_intrusive_get_pointer(end_iterator.pointed_node()), &header_plus_size::header_);
+ ( boost::intrusive::detail::to_raw_pointer(end_iterator.pointed_node()), &header_plus_size::header_);
       node_plus_pred_t *n = detail::parent_from_member
          <node_plus_pred_t, header_plus_size>(r, &node_plus_pred_t::header_plus_size_);
       data_t *d = detail::parent_from_member<data_t, node_plus_pred_t>(n, &data_t::node_plus_pred_);

Modified: trunk/boost/intrusive/splaytree_algorithms.hpp
==============================================================================
--- trunk/boost/intrusive/splaytree_algorithms.hpp (original)
+++ trunk/boost/intrusive/splaytree_algorithms.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -49,6 +49,7 @@
 #include <boost/intrusive/detail/config_begin.hpp>
 #include <boost/intrusive/detail/assert.hpp>
 #include <boost/intrusive/intrusive_fwd.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <cstddef>
 #include <boost/intrusive/detail/utilities.hpp>
 #include <boost/intrusive/detail/tree_algorithms.hpp>
@@ -63,8 +64,8 @@
 struct splaydown_rollback
 {
    typedef typename NodeTraits::node_ptr node_ptr;
- splaydown_rollback( const node_ptr *pcur_subtree, node_ptr header
- , node_ptr leftmost , node_ptr rightmost)
+ splaydown_rollback( const node_ptr *pcur_subtree, const node_ptr & header
+ , const node_ptr & leftmost , const node_ptr & rightmost)
       : pcur_subtree_(pcur_subtree) , header_(header)
       , leftmost_(leftmost) , rightmost_(rightmost)
    {}
@@ -145,17 +146,15 @@
 
    /// @cond
    private:
- static node_ptr uncast(const_node_ptr ptr)
- {
- return node_ptr(const_cast<node*>(::boost::intrusive::detail::boost_intrusive_get_pointer(ptr)));
- }
+ static node_ptr uncast(const const_node_ptr & ptr)
+ { return pointer_traits<node_ptr>::const_cast_from(ptr); }
    /// @endcond
 
    public:
- static node_ptr begin_node(const_node_ptr header)
+ static node_ptr begin_node(const const_node_ptr & header)
    { return tree_algorithms::begin_node(header); }
 
- static node_ptr end_node(const_node_ptr header)
+ static node_ptr end_node(const const_node_ptr & header)
    { return tree_algorithms::end_node(header); }
 
    //! <b>Requires</b>: node is a node of the tree or an node initialized
@@ -166,10 +165,10 @@
    //! <b>Complexity</b>: Constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static bool unique(const_node_ptr node)
+ static bool unique(const const_node_ptr & node)
    { return tree_algorithms::unique(node); }
 
- static void unlink(node_ptr node)
+ static void unlink(const node_ptr & node)
    { tree_algorithms::unlink(node); }
 
    //! <b>Requires</b>: node1 and node2 can't be header nodes
@@ -187,7 +186,7 @@
    //! node1 and node2 are not equivalent according to the ordering rules.
    //!
    //!Experimental function
- static void swap_nodes(node_ptr node1, node_ptr node2)
+ static void swap_nodes(const node_ptr & node1, const node_ptr & node2)
    {
       if(node1 == node2)
          return;
@@ -211,7 +210,7 @@
    //! node1 and node2 are not equivalent according to the ordering rules.
    //!
    //!Experimental function
- static void swap_nodes(node_ptr node1, node_ptr header1, node_ptr node2, node_ptr header2)
+ static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2)
    { tree_algorithms::swap_nodes(node1, header1, node2, header2); }
 
    //! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
@@ -230,7 +229,7 @@
    //! the node, since no rebalancing and comparison is needed.
    //!
    //!Experimental function
- static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node)
+ static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node)
    {
       if(node_to_be_replaced == new_node)
          return;
@@ -253,7 +252,7 @@
    //! the node, since no rebalancing or comparison is needed.
    //!
    //!Experimental function
- static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node)
+ static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node)
    { tree_algorithms::replace_node(node_to_be_replaced, header, new_node); }
 
    //! <b>Requires</b>: p is a node from the tree except the header.
@@ -263,7 +262,7 @@
    //! <b>Complexity</b>: Average constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr next_node(node_ptr p)
+ static node_ptr next_node(const node_ptr & p)
    { return tree_algorithms::next_node(p); }
 
    //! <b>Requires</b>: p is a node from the tree except the leftmost node.
@@ -273,7 +272,7 @@
    //! <b>Complexity</b>: Average constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr prev_node(node_ptr p)
+ static node_ptr prev_node(const node_ptr & p)
    { return tree_algorithms::prev_node(p); }
 
    //! <b>Requires</b>: node must not be part of any tree.
@@ -285,7 +284,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
- static void init(node_ptr node)
+ static void init(const node_ptr & node)
    { tree_algorithms::init(node); }
 
    //! <b>Requires</b>: node must not be part of any tree.
@@ -298,14 +297,14 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
- static void init_header(node_ptr header)
+ static void init_header(const node_ptr & header)
    { tree_algorithms::init_header(header); }
 
    //! <b>Requires</b>: "disposer" must be an object function
    //! taking a node_ptr parameter and shouldn't throw.
    //!
    //! <b>Effects</b>: Empties the target tree calling
- //! <tt>void disposer::operator()(node_ptr)</tt> for every node of the tree
+ //! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
    //! except the header.
    //!
    //! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
@@ -313,7 +312,7 @@
    //!
    //! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
    template<class Disposer>
- static void clear_and_dispose(node_ptr header, Disposer disposer)
+ static void clear_and_dispose(const node_ptr & header, Disposer disposer)
    { tree_algorithms::clear_and_dispose(header, disposer); }
 
    //! <b>Requires</b>: node is a node of the tree but it's not the header.
@@ -323,7 +322,7 @@
    //! <b>Complexity</b>: Linear time.
    //!
    //! <b>Throws</b>: Nothing.
- static std::size_t count(const_node_ptr node)
+ static std::size_t count(const const_node_ptr & node)
    { return tree_algorithms::count(node); }
 
    //! <b>Requires</b>: header is the header node of the tree.
@@ -333,7 +332,7 @@
    //! <b>Complexity</b>: Linear time.
    //!
    //! <b>Throws</b>: Nothing.
- static std::size_t size(const_node_ptr header)
+ static std::size_t size(const const_node_ptr & header)
    { return tree_algorithms::size(header); }
 
    //! <b>Requires</b>: header1 and header2 must be the header nodes
@@ -345,7 +344,7 @@
    //! <b>Complexity</b>: Constant.
    //!
    //! <b>Throws</b>: Nothing.
- static void swap_tree(node_ptr header1, node_ptr header2)
+ static void swap_tree(const node_ptr & header1, const node_ptr & header2)
    { return tree_algorithms::swap_tree(header1, header2); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -366,7 +365,7 @@
    //! previously executed to fill "commit_data". No value should be inserted or
    //! erased between the "insert_check" and "insert_commit" calls.
    static void insert_unique_commit
- (node_ptr header, node_ptr new_value, const insert_commit_data &commit_data)
+ (const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data)
    { tree_algorithms::insert_unique_commit(header, new_value, commit_data); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -405,7 +404,7 @@
    //! if no more objects are inserted or erased from the set.
    template<class KeyType, class KeyNodePtrCompare>
    static std::pair<node_ptr, bool> insert_unique_check
- (node_ptr header, const KeyType &key
+ (const node_ptr & header, const KeyType &key
       ,KeyNodePtrCompare comp, insert_commit_data &commit_data)
    {
       splay_down(header, key, comp);
@@ -414,14 +413,14 @@
 
    template<class KeyType, class KeyNodePtrCompare>
    static std::pair<node_ptr, bool> insert_unique_check
- (node_ptr header, node_ptr hint, const KeyType &key
+ (const node_ptr & header, const node_ptr &hint, const KeyType &key
       ,KeyNodePtrCompare comp, insert_commit_data &commit_data)
    {
       splay_down(header, key, comp);
       return tree_algorithms::insert_unique_check(header, hint, key, comp, commit_data);
    }
 
- static bool is_header(const_node_ptr p)
+ static bool is_header(const const_node_ptr & p)
    { return tree_algorithms::is_header(p); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -437,7 +436,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr find
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp, bool splay = true)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp, bool splay = true)
    {
       if(splay)
          splay_down(uncast(header), key, comp);
@@ -462,7 +461,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static std::pair<node_ptr, node_ptr> equal_range
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp, bool splay = true)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp, bool splay = true)
    {
       //if(splay)
          //splay_down(uncast(header), key, comp);
@@ -488,7 +487,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr lower_bound
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp, bool splay = true)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp, bool splay = true)
    {
       //if(splay)
          //splay_down(uncast(header), key, comp);
@@ -511,7 +510,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr upper_bound
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp, bool splay = true)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp, bool splay = true)
    {
       //if(splay)
          //splay_down(uncast(header), key, comp);
@@ -537,7 +536,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class NodePtrCompare>
    static node_ptr insert_equal
- (node_ptr header, node_ptr hint, node_ptr new_node, NodePtrCompare comp)
+ (const node_ptr & header, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp)
    {
       splay_down(header, new_node, comp);
       return tree_algorithms::insert_equal(header, hint, new_node, comp);
@@ -559,7 +558,7 @@
    //! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
    //! tree invariants might be broken.
    static node_ptr insert_before
- (node_ptr header, node_ptr pos, node_ptr new_node)
+ (const node_ptr & header, const node_ptr & pos, const node_ptr & new_node)
    {
       tree_algorithms::insert_before(header, pos, new_node);
       splay_up(new_node, header);
@@ -579,7 +578,7 @@
    //! <b>Note</b>: If "new_node" is less than the greatest inserted key
    //! tree invariants are broken. This function is slightly faster than
    //! using "insert_before".
- static void push_back(node_ptr header, node_ptr new_node)
+ static void push_back(const node_ptr & header, const node_ptr & new_node)
    {
       tree_algorithms::push_back(header, new_node);
       splay_up(new_node, header);
@@ -598,7 +597,7 @@
    //! <b>Note</b>: If "new_node" is greater than the lowest inserted key
    //! tree invariants are broken. This function is slightly faster than
    //! using "insert_before".
- static void push_front(node_ptr header, node_ptr new_node)
+ static void push_front(const node_ptr & header, const node_ptr & new_node)
    {
       tree_algorithms::push_front(header, new_node);
       splay_up(new_node, header);
@@ -618,7 +617,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class NodePtrCompare>
    static node_ptr insert_equal_upper_bound
- (node_ptr header, node_ptr new_node, NodePtrCompare comp)
+ (const node_ptr & header, const node_ptr & new_node, NodePtrCompare comp)
    {
       splay_down(header, new_node, comp);
       return tree_algorithms::insert_equal_upper_bound(header, new_node, comp);
@@ -638,7 +637,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class NodePtrCompare>
    static node_ptr insert_equal_lower_bound
- (node_ptr header, node_ptr new_node, NodePtrCompare comp)
+ (const node_ptr & header, const node_ptr & new_node, NodePtrCompare comp)
    {
       splay_down(header, new_node, comp);
       return tree_algorithms::insert_equal_lower_bound(header, new_node, comp);
@@ -649,13 +648,13 @@
    //! take a node_ptr and shouldn't throw.
    //!
    //! <b>Effects</b>: First empties target tree calling
- //! <tt>void disposer::operator()(node_ptr)</tt> for every node of the tree
+ //! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
    //! except the header.
    //!
    //! Then, duplicates the entire tree pointed by "source_header" cloning each
- //! source node with <tt>node_ptr Cloner::operator()(node_ptr)</tt> to obtain
+ //! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
    //! the nodes of the target tree. If "cloner" throws, the cloned target nodes
- //! are disposed using <tt>void disposer(node_ptr)</tt>.
+ //! are disposed using <tt>void disposer(const node_ptr &)</tt>.
    //!
    //! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
    //! number of elements of tree target tree when calling this function.
@@ -663,23 +662,23 @@
    //! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
    template <class Cloner, class Disposer>
    static void clone
- (const_node_ptr source_header, node_ptr target_header, Cloner cloner, Disposer disposer)
+ (const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer)
    { tree_algorithms::clone(source_header, target_header, cloner, disposer); }
 
    // delete node | complexity : constant | exception : nothrow
- static void erase(node_ptr header, node_ptr z, bool splay = true)
+ static void erase(const node_ptr & header, const node_ptr & z, bool splay = true)
    {
 // node_base* n = t->right;
-// if( t->left != 0 ){
+// if( t->left != node_ptr() ){
 // node_base* l = t->previous();
 // splay_up( l , t );
 // n = t->left;
 // n->right = t->right;
-// if( n->right != 0 )
+// if( n->right != node_ptr() )
 // n->right->parent = n;
 // }
 //
-// if( n != 0 )
+// if( n != node_ptr() )
 // n->parent = t->parent;
 //
 // if( t->parent->left == t )
@@ -695,11 +694,11 @@
       }
       /*
       //possibility 2
- if(splay && NodeTraits::get_left(z) != 0 ){
+ if(splay && NodeTraits::get_left(z) != node_ptr() ){
          node_ptr l = NodeTraits::get_left(z);
          splay_up(l, header);
       }*//*
- if(splay && NodeTraits::get_left(z) != 0 ){
+ if(splay && NodeTraits::get_left(z) != node_ptr() ){
          node_ptr l = prev_node(z);
          splay_up_impl(l, z);
       }*/
@@ -715,15 +714,13 @@
    }
 
    // bottom-up splay, use data_ as parent for n | complexity : logarithmic | exception : nothrow
- static void splay_up(node_ptr n, node_ptr header)
+ static void splay_up(const node_ptr & node, const node_ptr & header)
    {
- if(n == header){ // do a splay for the right most node instead
- // this is to boost performance of equal_range/count on equivalent containers in the case
- // where there are many equal elements at the end
- n = NodeTraits::get_right(header);
- }
-
- node_ptr t = header;
+ // If (node == header) do a splay for the right most node instead
+ // this is to boost performance of equal_range/count on equivalent containers in the case
+ // where there are many equal elements at the end
+ node_ptr n((node == header) ? NodeTraits::get_right(header) : node);
+ node_ptr t(header);
 
       if( n == t ) return;
       
@@ -753,7 +750,7 @@
 
    // top-down splay | complexity : logarithmic | exception : strong, note A
    template<class KeyType, class KeyNodePtrCompare>
- static node_ptr splay_down(node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ static node_ptr splay_down(const node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    {
       if(!NodeTraits::get_parent(header))
          return header;
@@ -782,19 +779,19 @@
 
          for( ;; ){
             if(comp(key, t)){
- if(NodeTraits::get_left(t) == 0 )
+ if(NodeTraits::get_left(t) == node_ptr() )
                   break;
                if(comp(key, NodeTraits::get_left(t))){
                   t = tree_algorithms::rotate_right(t);
 
- if(NodeTraits::get_left(t) == 0)
+ if(NodeTraits::get_left(t) == node_ptr())
                      break;
                   link_right(t, r);
                }
                else if(comp(NodeTraits::get_left(t), key)){
                   link_right(t, r);
 
- if(NodeTraits::get_right(t) == 0 )
+ if(NodeTraits::get_right(t) == node_ptr() )
                      break;
                   link_left(t, l);
                }
@@ -803,20 +800,20 @@
                }
             }
             else if(comp(t, key)){
- if(NodeTraits::get_right(t) == 0 )
+ if(NodeTraits::get_right(t) == node_ptr() )
                   break;
 
                if(comp(NodeTraits::get_right(t), key)){
                      t = tree_algorithms::rotate_left( t );
 
- if(NodeTraits::get_right(t) == 0 )
+ if(NodeTraits::get_right(t) == node_ptr() )
                         break;
                      link_left(t, l);
                }
                else if(comp(key, NodeTraits::get_right(t))){
                   link_left(t, l);
 
- if(NodeTraits::get_left(t) == 0)
+ if(NodeTraits::get_left(t) == node_ptr())
                      break;
 
                   link_right(t, r);
@@ -850,7 +847,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Linear.
- static void rebalance(node_ptr header)
+ static void rebalance(const node_ptr & header)
    { tree_algorithms::rebalance(header); }
 
    //! <b>Requires</b>: old_root is a node of a tree.
@@ -862,7 +859,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Complexity</b>: Linear.
- static node_ptr rebalance_subtree(node_ptr old_root)
+ static node_ptr rebalance_subtree(const node_ptr & old_root)
    { return tree_algorithms::rebalance_subtree(old_root); }
 
 
@@ -873,7 +870,7 @@
    //! <b>Complexity</b>: Logarithmic.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr get_header(node_ptr n)
+ static node_ptr get_header(const node_ptr & n)
    { return tree_algorithms::get_header(n); }
 
    private:
@@ -881,23 +878,23 @@
    /// @cond
 
    // assemble the three sub-trees into new tree pointed to by t | complexity : constant | exception : nothrow
- static void assemble( node_ptr t, node_ptr l, node_ptr r, const_node_ptr null_node )
+ static void assemble(const node_ptr &t, const node_ptr & l, const node_ptr & r, const const_node_ptr & null_node )
    {
       NodeTraits::set_right(l, NodeTraits::get_left(t));
       NodeTraits::set_left(r, NodeTraits::get_right(t));
 
- if(NodeTraits::get_right(l) != 0){
+ if(NodeTraits::get_right(l) != node_ptr()){
          NodeTraits::set_parent(NodeTraits::get_right(l), l);
       }
 
- if(NodeTraits::get_left(r) != 0){
+ if(NodeTraits::get_left(r) != node_ptr()){
          NodeTraits::set_parent(NodeTraits::get_left(r), r);
       }
 
       NodeTraits::set_left (t, NodeTraits::get_right(null_node));
       NodeTraits::set_right(t, NodeTraits::get_left(null_node));
 
- if( NodeTraits::get_left(t) != 0 ){
+ if( NodeTraits::get_left(t) != node_ptr() ){
          NodeTraits::set_parent(NodeTraits::get_left(t), t);
       }
 
@@ -907,7 +904,7 @@
    }
 
    // break link to left child node and attach it to left tree pointed to by l | complexity : constant | exception : nothrow
- static void link_left(node_ptr& t, node_ptr& l)
+ static void link_left(node_ptr & t, node_ptr & l)
    {
       NodeTraits::set_right(l, t);
       NodeTraits::set_parent(t, l);
@@ -916,7 +913,7 @@
    }
 
    // break link to right child node and attach it to right tree pointed to by r | complexity : constant | exception : nothrow
- static void link_right(node_ptr& t, node_ptr& r)
+ static void link_right(node_ptr & t, node_ptr & r)
    {
       NodeTraits::set_left(r, t);
       NodeTraits::set_parent(t, r);
@@ -925,7 +922,7 @@
    }
 
    // rotate n with its parent | complexity : constant | exception : nothrow
- static void rotate(node_ptr n)
+ static void rotate(const node_ptr & n)
    {
       node_ptr p = NodeTraits::get_parent(n);
       node_ptr g = NodeTraits::get_parent(p);
@@ -935,13 +932,13 @@
       
       if(NodeTraits::get_left(p) == n){
          NodeTraits::set_left(p, NodeTraits::get_right(n));
- if(NodeTraits::get_left(p) != 0)
+ if(NodeTraits::get_left(p) != node_ptr())
             NodeTraits::set_parent(NodeTraits::get_left(p), p);
          NodeTraits::set_right(n, p);
       }
       else{ // must be ( p->right == n )
          NodeTraits::set_right(p, NodeTraits::get_left(n));
- if(NodeTraits::get_right(p) != 0)
+ if(NodeTraits::get_right(p) != node_ptr())
             NodeTraits::set_parent(NodeTraits::get_right(p), p);
          NodeTraits::set_left(n, p);
       }
@@ -953,7 +950,7 @@
          if(NodeTraits::get_parent(g) == p)
             NodeTraits::set_parent(g, n);
          else{//must be ( g->right == p )
- BOOST_INTRUSIVE_INVARIANT_ASSERT(0);
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(false);
             NodeTraits::set_right(g, n);
          }
       }

Modified: trunk/boost/intrusive/treap.hpp
==============================================================================
--- trunk/boost/intrusive/treap.hpp (original)
+++ trunk/boost/intrusive/treap.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -25,8 +25,10 @@
 #include <boost/intrusive/bs_set_hook.hpp>
 #include <boost/intrusive/detail/tree_node.hpp>
 #include <boost/intrusive/detail/ebo_functor_holder.hpp>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/detail/clear_on_destructor_base.hpp>
+#include <boost/intrusive/detail/utilities.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/options.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
 #include <boost/intrusive/treap_algorithms.hpp>
@@ -98,25 +100,27 @@
    /// @endcond
    typedef typename real_value_traits::pointer pointer;
    typedef typename real_value_traits::const_pointer const_pointer;
- typedef typename std::iterator_traits<pointer>::value_type value_type;
+ typedef typename pointer_traits<pointer>::element_type value_type;
+ typedef typename pointer_traits<pointer>::reference reference;
+ typedef typename pointer_traits<const_pointer>::reference const_reference;
+ typedef typename pointer_traits<pointer>::difference_type difference_type;
    typedef value_type key_type;
- typedef typename std::iterator_traits<pointer>::reference reference;
- typedef typename std::iterator_traits<const_pointer>::reference const_reference;
- typedef typename std::iterator_traits<pointer>::difference_type difference_type;
    typedef typename Config::size_type size_type;
    typedef typename Config::compare value_compare;
    typedef typename Config::priority_compare priority_compare;
    typedef value_compare key_compare;
- typedef tree_iterator<treap_impl, false> iterator;
- typedef tree_iterator<treap_impl, true> const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef tree_iterator<treap_impl, false> iterator;
+ typedef tree_iterator<treap_impl, true> const_iterator;
+ typedef boost::intrusive::detail::reverse_iterator<iterator> reverse_iterator;
+ typedef boost::intrusive::detail::reverse_iterator<const_iterator>const_reverse_iterator;
    typedef typename real_value_traits::node_traits node_traits;
    typedef typename node_traits::node node;
- typedef typename boost::pointer_to_other
- <pointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <node_ptr, const node>::type const_node_ptr;
+ typedef typename pointer_traits
+ <pointer>::template rebind_pointer
+ <node>::type node_ptr;
+ typedef typename pointer_traits
+ <pointer>::template rebind_pointer
+ <const node>::type const_node_ptr;
    typedef treap_algorithms<node_traits> node_algorithms;
 
    static const bool constant_time_size = Config::constant_time_size;
@@ -182,16 +186,14 @@
    value_traits &priv_value_traits()
    { return data_; }
 
- const node &priv_header() const
- { return data_.node_plus_pred_.header_plus_priority_size_.header_plus_size_.header_; }
+ node_ptr priv_header_ptr()
+ { return pointer_traits<node_ptr>::pointer_to(data_.node_plus_pred_.header_plus_priority_size_.header_plus_size_.header_); }
 
- node &priv_header()
- { return data_.node_plus_pred_.header_plus_priority_size_.header_plus_size_.header_; }
+ const_node_ptr priv_header_ptr() const
+ { return pointer_traits<const_node_ptr>::pointer_to(data_.node_plus_pred_.header_plus_priority_size_.header_plus_size_.header_); }
 
- static node_ptr uncast(const_node_ptr ptr)
- {
- return node_ptr(const_cast<node*>(detail::boost_intrusive_get_pointer(ptr)));
- }
+ static node_ptr uncast(const const_node_ptr & ptr)
+ { return pointer_traits<node_ptr>::const_cast_from(ptr); }
 
    size_traits &priv_size_traits()
    { return data_.node_plus_pred_.header_plus_priority_size_.header_plus_size_; }
@@ -235,7 +237,7 @@
             , const value_traits &v_traits = value_traits())
       : data_(cmp, pcmp, v_traits)
    {
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(size_type(0));
    }
 
@@ -259,7 +261,7 @@
             , const value_traits &v_traits = value_traits())
       : data_(cmp, pcmp, v_traits)
    {
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(size_type(0));
       if(unique)
          this->insert_unique(b, e);
@@ -274,7 +276,7 @@
              , ::boost::move(x.priv_pcomp())
              , ::boost::move(x.priv_value_traits()))
    {
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(size_type(0));
       this->swap(x);
    }
@@ -301,7 +303,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    iterator begin()
- { return iterator (node_traits::get_left(node_ptr(&priv_header())), this); }
+ { return iterator (node_traits::get_left(this->priv_header_ptr()), this); }
 
    //! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the treap.
    //!
@@ -317,7 +319,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    const_iterator cbegin() const
- { return const_iterator (node_traits::get_left(const_node_ptr(&priv_header())), this); }
+ { return const_iterator (node_traits::get_left(this->priv_header_ptr()), this); }
 
    //! <b>Effects</b>: Returns an iterator pointing to the end of the treap.
    //!
@@ -325,7 +327,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    iterator end()
- { return iterator (node_ptr(&priv_header()), this); }
+ { return iterator (this->priv_header_ptr(), this); }
 
    //! <b>Effects</b>: Returns a const_iterator pointing to the end of the treap.
    //!
@@ -341,7 +343,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    const_iterator cend() const
- { return const_iterator (uncast(const_node_ptr(&priv_header())), this); }
+ { return const_iterator (uncast(this->priv_header_ptr()), this); }
 
 
    //! <b>Effects</b>: Returns an iterator pointing to the highest priority object of the treap.
@@ -350,7 +352,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    iterator top()
- { return this->empty() ? this->end() : iterator (node_traits::get_parent(node_ptr(&priv_header())), this); }
+ { return this->empty() ? this->end() : iterator (node_traits::get_parent(this->priv_header_ptr()), this); }
 
    //! <b>Effects</b>: Returns a const_iterator pointing to the highest priority object of the treap..
    //!
@@ -366,7 +368,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    const_iterator ctop() const
- { return this->empty() ? this->cend() : const_iterator (node_traits::get_parent(const_node_ptr(&priv_header())), this); }
+ { return this->empty() ? this->cend() : const_iterator (node_traits::get_parent(this->priv_header_ptr()), this); }
 
    //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
    //! reversed treap.
@@ -515,7 +517,7 @@
    //!
    //! <b>Throws</b>: Nothing.
    bool empty() const
- { return node_algorithms::unique(const_node_ptr(&priv_header())); }
+ { return node_algorithms::unique(this->priv_header_ptr()); }
 
    //! <b>Effects</b>: Returns the number of elements stored in the treap.
    //!
@@ -528,7 +530,7 @@
       if(constant_time_size)
          return this->priv_size_traits().get_size();
       else{
- return (size_type)node_algorithms::size(const_node_ptr(&priv_header()));
+ return (size_type)node_algorithms::size(this->priv_header_ptr());
       }
    }
 
@@ -544,7 +546,7 @@
       swap(priv_comp(), priv_comp());
       swap(priv_pcomp(), priv_pcomp());
       //These can't throw
- node_algorithms::swap_tree(node_ptr(&priv_header()), node_ptr(&other.priv_header()));
+ node_algorithms::swap_tree(this->priv_header_ptr(), other.priv_header_ptr());
       if(constant_time_size){
          size_type backup = this->priv_size_traits().get_size();
          this->priv_size_traits().set_size(other.priv_size_traits().get_size());
@@ -573,7 +575,7 @@
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       iterator ret(node_algorithms::insert_equal_upper_bound
- (node_ptr(&priv_header()), to_insert, key_node_comp, key_node_pcomp), this);
+ (this->priv_header_ptr(), to_insert, key_node_comp, key_node_pcomp), this);
       this->priv_size_traits().increment();
       return ret;
    }
@@ -602,7 +604,7 @@
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       iterator ret (node_algorithms::insert_equal
- (node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp, key_node_pcomp), this);
+ (this->priv_header_ptr(), hint.pointed_node(), to_insert, key_node_comp, key_node_pcomp), this);
       this->priv_size_traits().increment();
       return ret;
    }
@@ -748,7 +750,7 @@
          pcomp(key_value_pcomp, this);
       std::pair<node_ptr, bool> ret =
          (node_algorithms::insert_unique_check
- (node_ptr(&priv_header()), key, comp, pcomp, commit_data));
+ (this->priv_header_ptr(), key, comp, pcomp, commit_data));
       return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
    }
 
@@ -800,7 +802,7 @@
          pcomp(key_value_pcomp, this);
       std::pair<node_ptr, bool> ret =
          (node_algorithms::insert_unique_check
- (node_ptr(&priv_header()), hint.pointed_node(), key, comp, pcomp, commit_data));
+ (this->priv_header_ptr(), hint.pointed_node(), key, comp, pcomp, commit_data));
       return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
    }
 
@@ -826,7 +828,7 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- node_algorithms::insert_unique_commit(node_ptr(&priv_header()), to_insert, commit_data);
+ node_algorithms::insert_unique_commit(this->priv_header_ptr(), to_insert, commit_data);
       this->priv_size_traits().increment();
       return iterator(to_insert, this);
    }
@@ -853,7 +855,7 @@
       detail::key_nodeptr_comp<priority_compare, treap_impl>
          pcomp(priv_pcomp(), this);
       iterator ret (node_algorithms::insert_before
- (node_ptr(&priv_header()), pos.pointed_node(), to_insert, pcomp), this);
+ (this->priv_header_ptr(), pos.pointed_node(), to_insert, pcomp), this);
       this->priv_size_traits().increment();
       return ret;
    }
@@ -879,7 +881,7 @@
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       detail::key_nodeptr_comp<priority_compare, treap_impl>
          pcomp(priv_pcomp(), this);
- node_algorithms::push_back(node_ptr(&priv_header()), to_insert, pcomp);
+ node_algorithms::push_back(this->priv_header_ptr(), to_insert, pcomp);
       this->priv_size_traits().increment();
    }
 
@@ -904,7 +906,7 @@
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
       detail::key_nodeptr_comp<priority_compare, treap_impl>
          pcomp(priv_pcomp(), this);
- node_algorithms::push_front(node_ptr(&priv_header()), to_insert, pcomp);
+ node_algorithms::push_front(this->priv_header_ptr(), to_insert, pcomp);
       this->priv_size_traits().increment();
    }
 
@@ -925,7 +927,7 @@
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!node_algorithms::unique(to_erase));
       detail::key_nodeptr_comp<priority_compare, treap_impl>
          key_node_pcomp(priv_pcomp(), this);
- node_algorithms::erase(&priv_header(), to_erase, key_node_pcomp);
+ node_algorithms::erase(this->priv_header_ptr(), to_erase, key_node_pcomp);
       this->priv_size_traits().decrement();
       if(safemode_or_autounlink)
          node_algorithms::init(to_erase);
@@ -1090,7 +1092,7 @@
          this->clear_and_dispose(detail::null_disposer());
       }
       else{
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(priv_header_ptr());
          this->priv_size_traits().set_size(0);
       }
    }
@@ -1107,9 +1109,9 @@
    template<class Disposer>
    void clear_and_dispose(Disposer disposer)
    {
- node_algorithms::clear_and_dispose(node_ptr(&priv_header())
+ node_algorithms::clear_and_dispose(this->priv_header_ptr()
          , detail::node_disposer<Disposer, treap_impl>(disposer, this));
- node_algorithms::init_header(&priv_header());
+ node_algorithms::init_header(this->priv_header_ptr());
       this->priv_size_traits().set_size(0);
    }
 
@@ -1165,7 +1167,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, treap_impl>
          key_node_comp(comp, this);
       return iterator(node_algorithms::lower_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Returns a const iterator to the first element whose
@@ -1180,7 +1182,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, treap_impl>
          key_node_comp(comp, this);
       return const_iterator(node_algorithms::lower_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Returns an iterator to the first element whose
@@ -1205,7 +1207,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, treap_impl>
          key_node_comp(comp, this);
       return iterator(node_algorithms::upper_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Returns an iterator to the first element whose
@@ -1230,7 +1232,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, treap_impl>
          key_node_comp(comp, this);
       return const_iterator(node_algorithms::upper_bound
- (const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Finds an iterator to the first element whose key is
@@ -1254,7 +1256,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, treap_impl>
          key_node_comp(comp, this);
       return iterator
- (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (node_algorithms::find(this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
@@ -1278,7 +1280,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, treap_impl>
          key_node_comp(comp, this);
       return const_iterator
- (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp), this);
+ (node_algorithms::find(this->priv_header_ptr(), key, key_node_comp), this);
    }
 
    //! <b>Effects</b>: Finds a range containing all elements whose key is k or
@@ -1304,7 +1306,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, treap_impl>
          key_node_comp(comp, this);
       std::pair<node_ptr, node_ptr> ret
- (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp));
+ (node_algorithms::equal_range(this->priv_header_ptr(), key, key_node_comp));
       return std::pair<iterator, iterator>(iterator(ret.first, this), iterator(ret.second, this));
    }
 
@@ -1333,7 +1335,7 @@
       detail::key_nodeptr_comp<KeyValueCompare, treap_impl>
          key_node_comp(comp, this);
       std::pair<node_ptr, node_ptr> ret
- (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp));
+ (node_algorithms::equal_range(this->priv_header_ptr(), key, key_node_comp));
       return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
    }
 
@@ -1359,8 +1361,8 @@
          detail::exception_disposer<treap_impl, Disposer>
             rollback(*this, disposer);
          node_algorithms::clone
- (const_node_ptr(&src.priv_header())
- ,node_ptr(&this->priv_header())
+ (src.priv_header_ptr()
+ ,this->priv_header_ptr()
             ,detail::node_cloner<Cloner, treap_impl>(cloner, this)
             ,detail::node_disposer<Disposer, treap_impl>(disposer, this));
          this->priv_size_traits().set_size(src.priv_size_traits().get_size());
@@ -1382,7 +1384,7 @@
    pointer unlink_leftmost_without_rebalance()
    {
       node_ptr to_be_disposed(node_algorithms::unlink_leftmost_without_rebalance
- (node_ptr(&priv_header())));
+ (this->priv_header_ptr()));
       if(!to_be_disposed)
          return 0;
       this->priv_size_traits().decrement();
@@ -1408,7 +1410,7 @@
    void replace_node(iterator replace_this, reference with_this)
    {
       node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this)
- , node_ptr(&priv_header())
+ , this->priv_header_ptr()
                                    , get_real_value_traits().to_node_ptr(with_this));
       if(safemode_or_autounlink)
          node_algorithms::init(replace_this.pointed_node());
@@ -1510,7 +1512,7 @@
    static treap_impl &priv_container_from_end_iterator(const const_iterator &end_iterator)
    {
       header_plus_size *r = detail::parent_from_member<header_plus_size, node>
- ( detail::boost_intrusive_get_pointer(end_iterator.pointed_node()), &header_plus_size::header_);
+ ( boost::intrusive::detail::to_raw_pointer(end_iterator.pointed_node()), &header_plus_size::header_);
       typename node_plus_pred_t::header_plus_priority_size *n =
          detail::parent_from_member
          < typename node_plus_pred_t::header_plus_priority_size

Modified: trunk/boost/intrusive/treap_algorithms.hpp
==============================================================================
--- trunk/boost/intrusive/treap_algorithms.hpp (original)
+++ trunk/boost/intrusive/treap_algorithms.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -19,6 +19,7 @@
 #include <boost/intrusive/intrusive_fwd.hpp>
 
 #include <boost/intrusive/detail/assert.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/detail/utilities.hpp>
 #include <boost/intrusive/detail/tree_algorithms.hpp>
 #include <algorithm>
@@ -82,7 +83,7 @@
       remove_on_destroy(const remove_on_destroy&);
       remove_on_destroy& operator=(const remove_on_destroy&);
       public:
- remove_on_destroy(node_ptr header, node_ptr z)
+ remove_on_destroy(const node_ptr & header, const node_ptr & z)
          : header_(header), z_(z), remove_it_(true)
       {}
       ~remove_on_destroy()
@@ -106,7 +107,7 @@
       rerotate_on_destroy& operator=(const rerotate_on_destroy&);
 
       public:
- rerotate_on_destroy(node_ptr header, node_ptr p, std::size_t &n)
+ rerotate_on_destroy(const node_ptr & header, const node_ptr & p, std::size_t &n)
          : header_(header), p_(p), n_(n), remove_it_(true)
       {}
 
@@ -143,17 +144,16 @@
 
    typedef detail::tree_algorithms<NodeTraits> tree_algorithms;
 
- static node_ptr uncast(const_node_ptr ptr)
- {
- return node_ptr(const_cast<node*>(::boost::intrusive::detail::boost_intrusive_get_pointer(ptr)));
- }
+ static node_ptr uncast(const const_node_ptr & ptr)
+ { return pointer_traits<node_ptr>::const_cast_from(ptr); }
+
    /// @endcond
 
    public:
- static node_ptr begin_node(const_node_ptr header)
+ static node_ptr begin_node(const const_node_ptr & header)
    { return tree_algorithms::begin_node(header); }
 
- static node_ptr end_node(const_node_ptr header)
+ static node_ptr end_node(const const_node_ptr & header)
    { return tree_algorithms::end_node(header); }
 
    //! This type is the information that will be
@@ -177,7 +177,7 @@
    //! <b>Complexity</b>: Constant.
    //!
    //! <b>Throws</b>: Nothing.
- static void swap_tree(node_ptr header1, node_ptr header2)
+ static void swap_tree(const node_ptr & header1, const node_ptr & header2)
    { return tree_algorithms::swap_tree(header1, header2); }
 
    //! <b>Requires</b>: node1 and node2 can't be header nodes
@@ -195,7 +195,7 @@
    //! node1 and node2 are not equivalent according to the ordering rules.
    //!
    //!Experimental function
- static void swap_nodes(node_ptr node1, node_ptr node2)
+ static void swap_nodes(const node_ptr & node1, const node_ptr & node2)
    {
       if(node1 == node2)
          return;
@@ -219,7 +219,7 @@
    //! node1 and node2 are not equivalent according to the ordering rules.
    //!
    //!Experimental function
- static void swap_nodes(node_ptr node1, node_ptr header1, node_ptr node2, node_ptr header2)
+ static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2)
    { tree_algorithms::swap_nodes(node1, header1, node2, header2); }
 
    //! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
@@ -238,7 +238,7 @@
    //! the node, since no rebalancing and comparison is needed.
    //!
    //!Experimental function
- static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node)
+ static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node)
    {
       if(node_to_be_replaced == new_node)
          return;
@@ -261,7 +261,7 @@
    //! the node, since no rebalancing or comparison is needed.
    //!
    //!Experimental function
- static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node)
+ static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node)
    { tree_algorithms::replace_node(node_to_be_replaced, header, new_node); }
 
    //! <b>Requires</b>: node is a tree node but not the header.
@@ -272,7 +272,7 @@
    //!
    //! <b>Throws</b>: If "pcomp" throws, strong guarantee
    template<class NodePtrPriorityCompare>
- static void unlink(node_ptr node, NodePtrPriorityCompare pcomp)
+ static void unlink(const node_ptr & node, NodePtrPriorityCompare pcomp)
    {
       node_ptr x = NodeTraits::get_parent(node);
       if(x){
@@ -295,7 +295,7 @@
    //! only be used for more unlink_leftmost_without_rebalance calls.
    //! This function is normally used to achieve a step by step
    //! controlled destruction of the tree.
- static node_ptr unlink_leftmost_without_rebalance(node_ptr header)
+ static node_ptr unlink_leftmost_without_rebalance(const node_ptr & header)
    { return tree_algorithms::unlink_leftmost_without_rebalance(header); }
 
    //! <b>Requires</b>: node is a node of the tree or an node initialized
@@ -306,7 +306,7 @@
    //! <b>Complexity</b>: Constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static bool unique(const_node_ptr node)
+ static bool unique(const const_node_ptr & node)
    { return tree_algorithms::unique(node); }
 
    //! <b>Requires</b>: node is a node of the tree but it's not the header.
@@ -316,7 +316,7 @@
    //! <b>Complexity</b>: Linear time.
    //!
    //! <b>Throws</b>: Nothing.
- static std::size_t count(const_node_ptr node)
+ static std::size_t count(const const_node_ptr & node)
    { return tree_algorithms::count(node); }
 
    //! <b>Requires</b>: header is the header node of the tree.
@@ -326,7 +326,7 @@
    //! <b>Complexity</b>: Linear time.
    //!
    //! <b>Throws</b>: Nothing.
- static std::size_t size(const_node_ptr header)
+ static std::size_t size(const const_node_ptr & header)
    { return tree_algorithms::size(header); }
 
    //! <b>Requires</b>: p is a node from the tree except the header.
@@ -336,7 +336,7 @@
    //! <b>Complexity</b>: Average constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr next_node(node_ptr p)
+ static node_ptr next_node(const node_ptr & p)
    { return tree_algorithms::next_node(p); }
 
    //! <b>Requires</b>: p is a node from the tree except the leftmost node.
@@ -346,7 +346,7 @@
    //! <b>Complexity</b>: Average constant time.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr prev_node(node_ptr p)
+ static node_ptr prev_node(const node_ptr & p)
    { return tree_algorithms::prev_node(p); }
 
    //! <b>Requires</b>: node must not be part of any tree.
@@ -358,7 +358,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
- static void init(node_ptr node)
+ static void init(const node_ptr & node)
    { tree_algorithms::init(node); }
 
    //! <b>Requires</b>: node must not be part of any tree.
@@ -371,7 +371,7 @@
    //! <b>Throws</b>: Nothing.
    //!
    //! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
- static void init_header(node_ptr header)
+ static void init_header(const node_ptr & header)
    {
       tree_algorithms::init_header(header);
    }
@@ -385,7 +385,7 @@
    //!
    //! <b>Throws</b>: If "pcomp" throws, strong guarantee.
    template<class NodePtrPriorityCompare>
- static node_ptr erase(node_ptr header, node_ptr z, NodePtrPriorityCompare pcomp)
+ static node_ptr erase(const node_ptr & header, const node_ptr & z, NodePtrPriorityCompare pcomp)
    {
       rebalance_for_erasure(header, z, pcomp);
       tree_algorithms::erase(header, z);
@@ -398,13 +398,13 @@
    //! take a node_ptr and shouldn't throw.
    //!
    //! <b>Effects</b>: First empties target tree calling
- //! <tt>void disposer::operator()(node_ptr)</tt> for every node of the tree
+ //! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
    //! except the header.
    //!
    //! Then, duplicates the entire tree pointed by "source_header" cloning each
- //! source node with <tt>node_ptr Cloner::operator()(node_ptr)</tt> to obtain
+ //! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
    //! the nodes of the target tree. If "cloner" throws, the cloned target nodes
- //! are disposed using <tt>void disposer(node_ptr)</tt>.
+ //! are disposed using <tt>void disposer(const node_ptr &)</tt>.
    //!
    //! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
    //! number of elements of tree target tree when calling this function.
@@ -412,7 +412,7 @@
    //! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
    template <class Cloner, class Disposer>
    static void clone
- (const_node_ptr source_header, node_ptr target_header, Cloner cloner, Disposer disposer)
+ (const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer)
    {
       tree_algorithms::clone(source_header, target_header, cloner, disposer);
    }
@@ -421,7 +421,7 @@
    //! taking a node_ptr parameter and shouldn't throw.
    //!
    //! <b>Effects</b>: Empties the target tree calling
- //! <tt>void disposer::operator()(node_ptr)</tt> for every node of the tree
+ //! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
    //! except the header.
    //!
    //! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
@@ -429,7 +429,7 @@
    //!
    //! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
    template<class Disposer>
- static void clear_and_dispose(node_ptr header, Disposer disposer)
+ static void clear_and_dispose(const node_ptr & header, Disposer disposer)
    { tree_algorithms::clear_and_dispose(header, disposer); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -446,7 +446,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr lower_bound
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    { return tree_algorithms::lower_bound(header, key, comp); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -462,7 +462,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr upper_bound
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    { return tree_algorithms::upper_bound(header, key, comp); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -478,7 +478,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static node_ptr find
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    { return tree_algorithms::find(header, key, comp); }
 
    //! <b>Requires</b>: "header" must be the header node of a tree.
@@ -496,7 +496,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class KeyType, class KeyNodePtrCompare>
    static std::pair<node_ptr, node_ptr> equal_range
- (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp)
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
    { return tree_algorithms::equal_range(header, key, comp); }
 
    //! <b>Requires</b>: "h" must be the header node of a tree.
@@ -516,7 +516,7 @@
    //! <b>Throws</b>: If "comp" throw or "pcomp" throw.
    template<class NodePtrCompare, class NodePtrPriorityCompare>
    static node_ptr insert_equal_upper_bound
- (node_ptr h, node_ptr new_node, NodePtrCompare comp, NodePtrPriorityCompare pcomp)
+ (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp, NodePtrPriorityCompare pcomp)
    {
       insert_commit_data commit_data;
       tree_algorithms::insert_equal_upper_bound_check(h, new_node, comp, commit_data);
@@ -541,7 +541,7 @@
    //! <b>Throws</b>: If "comp" throws.
    template<class NodePtrCompare, class NodePtrPriorityCompare>
    static node_ptr insert_equal_lower_bound
- (node_ptr h, node_ptr new_node, NodePtrCompare comp, NodePtrPriorityCompare pcomp)
+ (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp, NodePtrPriorityCompare pcomp)
    {
       insert_commit_data commit_data;
       tree_algorithms::insert_equal_lower_bound_check(h, new_node, comp, commit_data);
@@ -569,7 +569,7 @@
    //! <b>Throws</b>: If "comp" throw or "pcomp" throw.
    template<class NodePtrCompare, class NodePtrPriorityCompare>
    static node_ptr insert_equal
- (node_ptr h, node_ptr hint, node_ptr new_node, NodePtrCompare comp, NodePtrPriorityCompare pcomp)
+ (const node_ptr & h, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp, NodePtrPriorityCompare pcomp)
    {
       insert_commit_data commit_data;
       tree_algorithms::insert_equal_check(h, hint, new_node, comp, commit_data);
@@ -597,7 +597,7 @@
    //! tree invariants might be broken.
    template<class NodePtrPriorityCompare>
    static node_ptr insert_before
- (node_ptr header, node_ptr pos, node_ptr new_node, NodePtrPriorityCompare pcomp)
+ (const node_ptr & header, const node_ptr & pos, const node_ptr & new_node, NodePtrPriorityCompare pcomp)
    {
       insert_commit_data commit_data;
       tree_algorithms::insert_before_check(header, pos, commit_data);
@@ -623,7 +623,7 @@
    //! tree invariants are broken. This function is slightly faster than
    //! using "insert_before".
    template<class NodePtrPriorityCompare>
- static void push_back(node_ptr header, node_ptr new_node, NodePtrPriorityCompare pcomp)
+ static void push_back(const node_ptr & header, const node_ptr & new_node, NodePtrPriorityCompare pcomp)
    {
       insert_commit_data commit_data;
       tree_algorithms::push_back_check(header, commit_data);
@@ -648,7 +648,7 @@
    //! tree invariants are broken. This function is slightly faster than
    //! using "insert_before".
    template<class NodePtrPriorityCompare>
- static void push_front(node_ptr header, node_ptr new_node, NodePtrPriorityCompare pcomp)
+ static void push_front(const node_ptr & header, const node_ptr & new_node, NodePtrPriorityCompare pcomp)
    {
       insert_commit_data commit_data;
       tree_algorithms::push_front_check(header, commit_data);
@@ -691,7 +691,7 @@
    //! if no more objects are inserted or erased from the set.
    template<class KeyType, class KeyNodePtrCompare, class KeyNodePtrPrioCompare>
    static std::pair<node_ptr, bool> insert_unique_check
- (const_node_ptr header, const KeyType &key
+ (const const_node_ptr & header, const KeyType &key
       ,KeyNodePtrCompare comp, KeyNodePtrPrioCompare pcomp
       ,insert_commit_data &commit_data)
    {
@@ -743,7 +743,7 @@
    //! if no more objects are inserted or erased from the set.
    template<class KeyType, class KeyNodePtrCompare, class KeyNodePtrPrioCompare>
    static std::pair<node_ptr, bool> insert_unique_check
- (const_node_ptr header, node_ptr hint, const KeyType &key
+ (const const_node_ptr & header, const node_ptr & hint, const KeyType &key
       ,KeyNodePtrCompare comp, KeyNodePtrPrioCompare pcomp, insert_commit_data &commit_data)
    {
       std::pair<node_ptr, bool> ret =
@@ -771,7 +771,7 @@
    //! previously executed to fill "commit_data". No value should be inserted or
    //! erased between the "insert_check" and "insert_commit" calls.
    static void insert_unique_commit
- (node_ptr header, node_ptr new_node, const insert_commit_data &commit_data)
+ (const node_ptr & header, const node_ptr & new_node, const insert_commit_data &commit_data)
    {
       tree_algorithms::insert_unique_commit(header, new_node, commit_data);
       rebalance_after_insertion_commit(header, new_node, commit_data.rotations);
@@ -784,7 +784,7 @@
    //! <b>Complexity</b>: Logarithmic.
    //!
    //! <b>Throws</b>: Nothing.
- static node_ptr get_header(node_ptr n)
+ static node_ptr get_header(const node_ptr & n)
    { return tree_algorithms::get_header(n); }
 
    /// @cond
@@ -797,13 +797,13 @@
    //! <b>Complexity</b>: Constant.
    //!
    //! <b>Throws</b>: Nothing.
- static bool is_header(const_node_ptr p)
+ static bool is_header(const const_node_ptr & p)
    {
       return tree_algorithms::is_header(p);
    }
 
    template<class NodePtrPriorityCompare>
- static void rebalance_for_erasure(node_ptr header, node_ptr z, NodePtrPriorityCompare pcomp)
+ static void rebalance_for_erasure(const node_ptr & header, const node_ptr & z, NodePtrPriorityCompare pcomp)
    {
       std::size_t n = 0;
       rerotate_on_destroy rb(header, z, n);
@@ -826,7 +826,7 @@
 
    template<class NodePtrPriorityCompare>
    static void rebalance_check_and_commit
- (node_ptr h, node_ptr new_node, NodePtrPriorityCompare pcomp, insert_commit_data &commit_data)
+ (const node_ptr & h, const node_ptr & new_node, NodePtrPriorityCompare pcomp, insert_commit_data &commit_data)
    {
       rebalance_after_insertion_check(h, commit_data.node, new_node, pcomp, commit_data.rotations);
       //No-throw
@@ -837,9 +837,10 @@
 
    template<class Key, class KeyNodePriorityCompare>
    static void rebalance_after_insertion_check
- ( const_node_ptr header, const_node_ptr upnode, const Key &k
+ (const const_node_ptr &header, const const_node_ptr & up, const Key &k
       , KeyNodePriorityCompare pcomp, std::size_t &num_rotations)
    {
+ const_node_ptr upnode(up);
       //First check rotations since pcomp can throw
       num_rotations = 0;
       std::size_t n = 0;
@@ -850,7 +851,7 @@
       num_rotations = n;
    }
 
- static void rebalance_after_insertion_commit(node_ptr header, node_ptr p, std::size_t n)
+ static void rebalance_after_insertion_commit(const node_ptr & header, const node_ptr & p, std::size_t n)
    {
       // Now execute n rotations
       for( node_ptr p_parent = NodeTraits::get_parent(p)
@@ -867,7 +868,7 @@
    }
 
    template<class NodePtrPriorityCompare>
- static bool check_invariant(const_node_ptr header, NodePtrPriorityCompare pcomp)
+ static bool check_invariant(const const_node_ptr & header, NodePtrPriorityCompare pcomp)
    {
       node_ptr beg = begin_node(header);
       node_ptr end = end_node(header);

Modified: trunk/boost/intrusive/trivial_value_traits.hpp
==============================================================================
--- trunk/boost/intrusive/trivial_value_traits.hpp (original)
+++ trunk/boost/intrusive/trivial_value_traits.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -14,6 +14,7 @@
 #define BOOST_INTRUSIVE_TRIVIAL_VALUE_TRAITS_HPP
 
 #include <boost/intrusive/link_mode.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 
 namespace boost {
 namespace intrusive {
@@ -31,10 +32,12 @@
    typedef node_ptr pointer;
    typedef const_node_ptr const_pointer;
    static const link_mode_type link_mode = LinkMode;
- static node_ptr to_node_ptr (value_type &value) { return node_ptr(&value); }
- static const_node_ptr to_node_ptr (const value_type &value) { return const_node_ptr(&value); }
- static pointer to_value_ptr(node_ptr n) { return pointer(n); }
- static const_pointer to_value_ptr(const_node_ptr n) { return const_pointer(n); }
+ static node_ptr to_node_ptr (value_type &value)
+ { return pointer_traits<node_ptr>::pointer_to(value); }
+ static const_node_ptr to_node_ptr (const value_type &value)
+ { return pointer_traits<const_node_ptr>::pointer_to(value); }
+ static const pointer & to_value_ptr(const node_ptr &n) { return n; }
+ static const const_pointer &to_value_ptr(const const_node_ptr &n) { return n; }
 };
 
 } //namespace intrusive

Modified: trunk/boost/intrusive/unordered_set_hook.hpp
==============================================================================
--- trunk/boost/intrusive/unordered_set_hook.hpp (original)
+++ trunk/boost/intrusive/unordered_set_hook.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -18,9 +18,10 @@
 #include <boost/intrusive/intrusive_fwd.hpp>
 #include <boost/pointer_cast.hpp>
 #include <boost/intrusive/detail/utilities.hpp>
-#include <boost/intrusive/detail/pointer_to_other.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/slist_hook.hpp>
 #include <boost/intrusive/options.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
 #include <boost/intrusive/detail/generic_hook.hpp>
 
 namespace boost {
@@ -32,10 +33,10 @@
 struct unordered_node
    : public slist_node<VoidPointer>
 {
- typedef typename boost::pointer_to_other
- < VoidPointer
- , unordered_node<VoidPointer, StoreHash, OptimizeMultiKey>
- >::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer
+ < unordered_node<VoidPointer, StoreHash, OptimizeMultiKey> >::type
+ node_ptr;
    node_ptr prev_in_group_;
    std::size_t hash_;
 };
@@ -44,10 +45,10 @@
 struct unordered_node<VoidPointer, false, true>
    : public slist_node<VoidPointer>
 {
- typedef typename boost::pointer_to_other
- < VoidPointer
- , unordered_node<VoidPointer, false, true>
- >::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer
+ < unordered_node<VoidPointer, false, true> >::type
+ node_ptr;
    node_ptr prev_in_group_;
 };
 
@@ -55,10 +56,10 @@
 struct unordered_node<VoidPointer, true, false>
    : public slist_node<VoidPointer>
 {
- typedef typename boost::pointer_to_other
- < VoidPointer
- , unordered_node<VoidPointer, true, false>
- >::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer
+ < unordered_node<VoidPointer, true, false> >::type
+ node_ptr;
    std::size_t hash_;
 };
 
@@ -68,35 +69,35 @@
 {
    typedef slist_node_traits<VoidPointer> reduced_slist_node_traits;
    typedef unordered_node<VoidPointer, StoreHash, OptimizeMultiKey> node;
- typedef typename boost::pointer_to_other
- <VoidPointer, node>::type node_ptr;
- typedef typename boost::pointer_to_other
- <VoidPointer, const node>::type const_node_ptr;
+
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer
+ < node >::type node_ptr;
+ typedef typename pointer_traits
+ <VoidPointer>::template rebind_pointer
+ < const node >::type const_node_ptr;
 
    static const bool store_hash = StoreHash;
    static const bool optimize_multikey = OptimizeMultiKey;
 
- static node_ptr get_next(const_node_ptr n)
+ static node_ptr get_next(const const_node_ptr & n)
    {
-// This still fails in gcc < 4.4 so forget about it
-// using ::boost::static_pointer_cast;
-// return static_pointer_cast<node>(n->next_);
- return node_ptr(&static_cast<node&>(*n->next_));
+ return pointer_traits<node_ptr>::pointer_to(static_cast<node&>(*n->next_));
    }
 
- static void set_next(node_ptr n, node_ptr next)
+ static void set_next(const node_ptr & n, const node_ptr & next)
    { n->next_ = next; }
 
- static node_ptr get_prev_in_group(const_node_ptr n)
+ static node_ptr get_prev_in_group(const const_node_ptr & n)
    { return n->prev_in_group_; }
 
- static void set_prev_in_group(node_ptr n, node_ptr prev)
+ static void set_prev_in_group(const node_ptr & n, const node_ptr & prev)
    { n->prev_in_group_ = prev; }
 
- static std::size_t get_hash(const_node_ptr n)
+ static std::size_t get_hash(const const_node_ptr & n)
    { return n->hash_; }
 
- static void set_hash(node_ptr n, std::size_t h)
+ static void set_hash(const node_ptr & n, std::size_t h)
    { n->hash_ = h; }
 };
 
@@ -107,10 +108,10 @@
    typedef typename NodeTraits::node_ptr node_ptr;
    typedef typename NodeTraits::const_node_ptr const_node_ptr;
 
- static node_ptr get_next(const_node_ptr n)
+ static node_ptr get_next(const const_node_ptr & n)
    { return NodeTraits::get_prev_in_group(n); }
 
- static void set_next(node_ptr n, node_ptr next)
+ static void set_next(const node_ptr & n, const node_ptr & next)
    { NodeTraits::set_prev_in_group(n, next); }
 };
 

Modified: trunk/boost/move/move.hpp
==============================================================================
--- trunk/boost/move/move.hpp (original)
+++ trunk/boost/move/move.hpp 2011-12-22 15:08:24 EST (Thu, 22 Dec 2011)
@@ -23,9 +23,12 @@
 
 #ifdef BOOST_MSVC
    #ifndef _CRT_SECURE_NO_DEPRECATE
- #define BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE
- #define _CRT_SECURE_NO_DEPRECATE
- #define _SCL_SECURE_NO_WARNINGS
+ #define BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE
+ #define _CRT_SECURE_NO_DEPRECATE
+ #endif
+ #ifndef _SCL_SECURE_NO_WARNINGS
+ #define BOOST_INTERPROCESS_SCL_SECURE_NO_WARNINGS
+ #define _SCL_SECURE_NO_WARNINGS
    #endif
    #pragma warning (push)
    #pragma warning(disable:4996)
@@ -1080,14 +1083,112 @@
    : BOOST_MOVE_BOOST_NS::has_trivial_destructor<T>
 {};
 
+
+
+namespace move_detail {
+
+// Code from Jeffrey Lee Hellrung, many thanks
+
+#ifndef BOOST_NO_RVALUE_REFERENCES
+ template< class T> struct forward_type { typedef T type; };
+#else // #ifndef BOOST_NO_RVALUE_REFERENCES
+ template< class T>
+ struct forward_type
+ { typedef const T &type; };
+
+ template< class T>
+ struct forward_type< boost::rv<T> >
+ { typedef T type; };
+#endif // #ifndef BOOST_NO_RVALUE_REFERENCES
+
+
+
+// Code from Jeffrey Lee Hellrung, many thanks
+
+template< class T > struct is_rvalue_reference : BOOST_MOVE_BOOST_NS::integral_constant<bool, false> { };
+#ifndef BOOST_NO_RVALUE_REFERENCES
+ template< class T > struct is_rvalue_reference< T&& > : BOOST_MOVE_BOOST_NS::integral_constant<bool, true> { };
+#else // #ifndef BOOST_NO_RVALUE_REFERENCES
+ template< class T > struct is_rvalue_reference< boost::rv<T>& >
+ : BOOST_MOVE_BOOST_NS::integral_constant<bool, true>
+ {};
+
+ template< class T > struct is_rvalue_reference< const boost::rv<T>& >
+ : BOOST_MOVE_BOOST_NS::integral_constant<bool, true>
+ {};
+#endif // #ifndef BOOST_NO_RVALUE_REFERENCES
+
+#ifndef BOOST_NO_RVALUE_REFERENCES
+ template< class T > struct add_rvalue_reference { typedef T&& type; };
+#else // #ifndef BOOST_NO_RVALUE_REFERENCES
+ namespace detail_add_rvalue_reference
+ {
+ template< class T
+ , bool emulation = ::boost::has_move_emulation_enabled<T>::value
+ , bool rv = ::boost::move_detail::is_rv<T>::value >
+ struct add_rvalue_reference_impl { typedef T type; };
+
+ template< class T, bool emulation>
+ struct add_rvalue_reference_impl< T, emulation, true > { typedef T & type; };
+
+ template< class T, bool rv >
+ struct add_rvalue_reference_impl< T, true, rv > { typedef ::boost::rv<T>& type; };
+ } // namespace detail_add_rvalue_reference
+
+ template< class T >
+ struct add_rvalue_reference
+ : detail_add_rvalue_reference::add_rvalue_reference_impl<T>
+ { };
+
+ template< class T >
+ struct add_rvalue_reference<T &>
+ { typedef T & type; };
+
+#endif // #ifndef BOOST_NO_RVALUE_REFERENCES
+
+template< class T > struct remove_rvalue_reference { typedef T type; };
+
+#ifndef BOOST_NO_RVALUE_REFERENCES
+ template< class T > struct remove_rvalue_reference< T&& > { typedef T type; };
+#else // #ifndef BOOST_NO_RVALUE_REFERENCES
+ template< class T > struct remove_rvalue_reference< rv<T> > { typedef T type; };
+ template< class T > struct remove_rvalue_reference< const rv<T> > { typedef T type; };
+ template< class T > struct remove_rvalue_reference< volatile rv<T> > { typedef T type; };
+ template< class T > struct remove_rvalue_reference< const volatile rv<T> > { typedef T type; };
+ template< class T > struct remove_rvalue_reference< rv<T>& > { typedef T type; };
+ template< class T > struct remove_rvalue_reference< const rv<T>& > { typedef T type; };
+ template< class T > struct remove_rvalue_reference< volatile rv<T>& > { typedef T type; };
+ template< class T > struct remove_rvalue_reference< const volatile rv<T>& >{ typedef T type; };
+#endif // #ifndef BOOST_NO_RVALUE_REFERENCES
+
+template <typename T>
+typename boost::move_detail::add_rvalue_reference<T>::type declval();
+
+}
+// Ideas from Boost.Move review, Jeffrey Lee Hellrung:
+//
+//- TypeTraits metafunctions is_lvalue_reference, add_lvalue_reference, and remove_lvalue_reference ?
+// Perhaps add_reference and remove_reference can be modified so that they behave wrt emulated rvalue
+// references the same as wrt real rvalue references, i.e., add_reference< rv<T>& > -> T& rather than
+// rv<T>& (since T&& & -> T&).
+//
+//- Add'l TypeTraits has_[trivial_]move_{constructor,assign}...?
+//
+//- An as_lvalue(T& x) function, which amounts to an identity operation in C++0x, but strips emulated
+// rvalue references in C++03. This may be necessary to prevent "accidental moves".
+
 } //namespace boost {
 
 #if defined BOOST_MSVC
    #pragma warning (pop)
    #ifdef BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE
- #undef BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE
- #undef _CRT_SECURE_NO_DEPRECATE
- #undef _SCL_SECURE_NO_WARNINGS
+ #undef BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE
+ #undef _CRT_SECURE_NO_DEPRECATE
+ #endif
+
+ #ifdef BOOST_INTERPROCESS_SCL_SECURE_NO_WARNINGS
+ #undef BOOST_INTERPROCESS_SCL_SECURE_NO_WARNINGS
+ #undef _SCL_SECURE_NO_WARNINGS
    #endif
 #endif
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk