Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73279 - in branches/release/boost: interprocess interprocess/allocators interprocess/allocators/detail interprocess/containers interprocess/containers/container interprocess/containers/container/detail interprocess/containers/detail interprocess/detail interprocess/indexes interprocess/ipc interprocess/mem_algo interprocess/mem_algo/detail interprocess/smart_ptr interprocess/sync interprocess/sync/emulation interprocess/sync/posix interprocess/sync/xsi intrusive intrusive/detail
From: igaztanaga_at_[hidden]
Date: 2011-07-21 13:43:13


Author: igaztanaga
Date: 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
New Revision: 73279
URL: http://svn.boost.org/trac/boost/changeset/73279

Log:
Merged missed changes for 1.47 release
Added:
   branches/release/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp
      - copied unchanged from r73277, /trunk/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp
   branches/release/boost/interprocess/xsi_key.hpp
      - copied unchanged from r73277, /trunk/boost/interprocess/xsi_key.hpp
   branches/release/boost/interprocess/xsi_shared_memory.hpp
      - copied unchanged from r73277, /trunk/boost/interprocess/xsi_shared_memory.hpp
   branches/release/boost/intrusive/parent_from_member.hpp
      - copied unchanged from r73277, /trunk/boost/intrusive/parent_from_member.hpp
Removed:
   branches/release/boost/interprocess/containers/detail/
Properties modified:
   branches/release/boost/interprocess/ (props changed)
   branches/release/boost/intrusive/ (props changed)
Text files modified:
   branches/release/boost/interprocess/allocators/adaptive_pool.hpp | 12
   branches/release/boost/interprocess/allocators/allocator.hpp | 8
   branches/release/boost/interprocess/allocators/cached_adaptive_pool.hpp | 16
   branches/release/boost/interprocess/allocators/cached_node_allocator.hpp | 19
   branches/release/boost/interprocess/allocators/detail/adaptive_node_pool.hpp | 7
   branches/release/boost/interprocess/allocators/detail/allocator_common.hpp | 53
   branches/release/boost/interprocess/allocators/detail/node_pool.hpp | 7
   branches/release/boost/interprocess/allocators/node_allocator.hpp | 12
   branches/release/boost/interprocess/allocators/private_adaptive_pool.hpp | 12
   branches/release/boost/interprocess/allocators/private_node_allocator.hpp | 12
   branches/release/boost/interprocess/containers/container/container_fwd.hpp | 11
   branches/release/boost/interprocess/containers/container/deque.hpp | 267 +++++----
   branches/release/boost/interprocess/containers/container/detail/adaptive_node_pool_impl.hpp | 171 +++--
   branches/release/boost/interprocess/containers/container/detail/advanced_insert_int.hpp | 28
   branches/release/boost/interprocess/containers/container/detail/algorithms.hpp | 4
   branches/release/boost/interprocess/containers/container/detail/config_begin.hpp | 13
   branches/release/boost/interprocess/containers/container/detail/destroyers.hpp | 2
   branches/release/boost/interprocess/containers/container/detail/flat_tree.hpp | 76 +-
   branches/release/boost/interprocess/containers/container/detail/iterators.hpp | 29
   branches/release/boost/interprocess/containers/container/detail/math_functions.hpp | 3
   branches/release/boost/interprocess/containers/container/detail/mpl.hpp | 3
   branches/release/boost/interprocess/containers/container/detail/multiallocation_chain.hpp | 43
   branches/release/boost/interprocess/containers/container/detail/node_alloc_holder.hpp | 36
   branches/release/boost/interprocess/containers/container/detail/node_pool_impl.hpp | 45
   branches/release/boost/interprocess/containers/container/detail/pair.hpp | 204 +++++-
   branches/release/boost/interprocess/containers/container/detail/preprocessor.hpp | 6
   branches/release/boost/interprocess/containers/container/detail/stored_ref.hpp | 4
   branches/release/boost/interprocess/containers/container/detail/tree.hpp | 99 ++-
   branches/release/boost/interprocess/containers/container/detail/type_traits.hpp | 41 +
   branches/release/boost/interprocess/containers/container/detail/utilities.hpp | 12
   branches/release/boost/interprocess/containers/container/detail/version_type.hpp | 3
   branches/release/boost/interprocess/containers/container/detail/workaround.hpp | 4
   branches/release/boost/interprocess/containers/container/flat_map.hpp | 70 +-
   branches/release/boost/interprocess/containers/container/flat_set.hpp | 58 +-
   branches/release/boost/interprocess/containers/container/list.hpp | 126 ++--
   branches/release/boost/interprocess/containers/container/map.hpp | 95 +-
   branches/release/boost/interprocess/containers/container/set.hpp | 60 +-
   branches/release/boost/interprocess/containers/container/slist.hpp | 46
   branches/release/boost/interprocess/containers/container/stable_vector.hpp | 213 ++++---
   branches/release/boost/interprocess/containers/container/string.hpp | 113 +--
   branches/release/boost/interprocess/containers/container/vector.hpp | 172 +++--
   branches/release/boost/interprocess/containers/pair.hpp | 1
   branches/release/boost/interprocess/detail/atomic.hpp | 12
   branches/release/boost/interprocess/detail/file_wrapper.hpp | 6
   branches/release/boost/interprocess/detail/in_place_interface.hpp | 3
   branches/release/boost/interprocess/detail/intermodule_singleton.hpp | 7
   branches/release/boost/interprocess/detail/intersegment_ptr.hpp | 9
   branches/release/boost/interprocess/detail/managed_memory_impl.hpp | 60 +-
   branches/release/boost/interprocess/detail/managed_multi_shared_memory.hpp | 38
   branches/release/boost/interprocess/detail/managed_open_or_create_impl.hpp | 31
   branches/release/boost/interprocess/detail/move.hpp | 1147 ---------------------------------------
   branches/release/boost/interprocess/detail/segment_manager_helper.hpp | 111 ++-
   branches/release/boost/interprocess/detail/tmp_dir_helpers.hpp | 27
   branches/release/boost/interprocess/detail/type_traits.hpp | 44 -
   branches/release/boost/interprocess/detail/utilities.hpp | 12
   branches/release/boost/interprocess/detail/win32_api.hpp | 393 +++++++++----
   branches/release/boost/interprocess/detail/xsi_shared_memory_device.hpp | 6
   branches/release/boost/interprocess/errors.hpp | 3
   branches/release/boost/interprocess/file_mapping.hpp | 6
   branches/release/boost/interprocess/indexes/flat_map_index.hpp | 2
   branches/release/boost/interprocess/indexes/iset_index.hpp | 2
   branches/release/boost/interprocess/indexes/iunordered_set_index.hpp | 31
   branches/release/boost/interprocess/indexes/map_index.hpp | 2
   branches/release/boost/interprocess/indexes/unordered_map_index.hpp | 2
   branches/release/boost/interprocess/interprocess_fwd.hpp | 20
   branches/release/boost/interprocess/ipc/message_queue.hpp | 255 +++++---
   branches/release/boost/interprocess/managed_external_buffer.hpp | 17
   branches/release/boost/interprocess/managed_heap_memory.hpp | 13
   branches/release/boost/interprocess/managed_mapped_file.hpp | 15
   branches/release/boost/interprocess/managed_shared_memory.hpp | 22
   branches/release/boost/interprocess/managed_windows_shared_memory.hpp | 13
   branches/release/boost/interprocess/managed_xsi_shared_memory.hpp | 7
   branches/release/boost/interprocess/mapped_region.hpp | 8
   branches/release/boost/interprocess/mem_algo/detail/mem_algo_common.hpp | 131 ++--
   branches/release/boost/interprocess/mem_algo/detail/multi_simple_seq_fit.hpp | 4
   branches/release/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp | 185 +++---
   branches/release/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp | 255 ++++----
   branches/release/boost/interprocess/mem_algo/rbtree_best_fit.hpp | 616 ++++++++++++---------
   branches/release/boost/interprocess/mem_algo/simple_seq_fit.hpp | 4
   branches/release/boost/interprocess/offset_ptr.hpp | 245 ++++---
   branches/release/boost/interprocess/segment_manager.hpp | 144 ++--
   branches/release/boost/interprocess/shared_memory_object.hpp | 6
   branches/release/boost/interprocess/smart_ptr/enable_shared_from_this.hpp | 2
   branches/release/boost/interprocess/smart_ptr/shared_ptr.hpp | 29
   branches/release/boost/interprocess/smart_ptr/unique_ptr.hpp | 10
   branches/release/boost/interprocess/sync/emulation/mutex.hpp | 2
   branches/release/boost/interprocess/sync/file_lock.hpp | 6
   branches/release/boost/interprocess/sync/posix/semaphore_wrapper.hpp | 2
   branches/release/boost/interprocess/sync/scoped_lock.hpp | 14
   branches/release/boost/interprocess/sync/sharable_lock.hpp | 10
   branches/release/boost/interprocess/sync/upgradable_lock.hpp | 10
   branches/release/boost/interprocess/sync/xsi/simple_xsi_semaphore.hpp | 11
   branches/release/boost/interprocess/sync/xsi/xsi_named_mutex.hpp | 8
   branches/release/boost/interprocess/windows_shared_memory.hpp | 6
   branches/release/boost/intrusive/avl_set.hpp | 52 +
   branches/release/boost/intrusive/avltree.hpp | 38 +
   branches/release/boost/intrusive/detail/hashtable_node.hpp | 22
   branches/release/boost/intrusive/detail/mpl.hpp | 57 -
   branches/release/boost/intrusive/detail/utilities.hpp | 39
   branches/release/boost/intrusive/hashtable.hpp | 117 +++
   branches/release/boost/intrusive/list.hpp | 39 +
   branches/release/boost/intrusive/options.hpp | 2
   branches/release/boost/intrusive/rbtree.hpp | 36 +
   branches/release/boost/intrusive/set.hpp | 52 +
   branches/release/boost/intrusive/sg_set.hpp | 50 +
   branches/release/boost/intrusive/sgtree.hpp | 36 +
   branches/release/boost/intrusive/slist.hpp | 43 +
   branches/release/boost/intrusive/splay_set.hpp | 52 +
   branches/release/boost/intrusive/splaytree.hpp | 35 +
   branches/release/boost/intrusive/treap.hpp | 39 +
   branches/release/boost/intrusive/treap_set.hpp | 52 +
   branches/release/boost/intrusive/unordered_set.hpp | 61 +
   112 files changed, 3540 insertions(+), 3522 deletions(-)

Modified: branches/release/boost/interprocess/allocators/adaptive_pool.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/adaptive_pool.hpp (original)
+++ branches/release/boost/interprocess/allocators/adaptive_pool.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -92,8 +92,8 @@
                      <value_type>::type reference;
    typedef typename detail::add_reference
                      <const value_type>::type const_reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ typedef typename segment_manager::size_type size_type;
+ 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
@@ -294,8 +294,8 @@
                      <value_type>::type reference;
    typedef typename detail::add_reference
                      <const value_type>::type const_reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ typedef typename segment_manager::size_type size_type;
+ typedef typename segment_manager::difference_type difference_type;
 
    //!Obtains adaptive_pool from
    //!adaptive_pool
@@ -398,7 +398,7 @@
    //!preferred_elements. The number of actually allocated elements is
    //!will be assigned to received_size. The elements must be deallocated
    //!with deallocate(...)
- multiallocation_chain allocate_many(size_type elem_size, std::size_t num_elements);
+ multiallocation_chain allocate_many(size_type elem_size, size_type num_elements);
 
    //!Allocates n_elements elements, each one of size elem_sizes[i]in a
    //!contiguous block
@@ -424,7 +424,7 @@
    //!preferred_elements. The number of actually allocated elements is
    //!will be assigned to received_size. Memory allocated with this function
    //!must be deallocated only with deallocate_one().
- multiallocation_chain allocate_individual(std::size_t num_elements);
+ multiallocation_chain allocate_individual(size_type num_elements);
 
    //!Deallocates memory previously allocated with allocate_one().
    //!You should never use deallocate_one to deallocate memory allocated

Modified: branches/release/boost/interprocess/allocators/allocator.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/allocator.hpp (original)
+++ branches/release/boost/interprocess/allocators/allocator.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -95,8 +95,8 @@
                      <value_type>::type reference;
    typedef typename detail::add_reference
                      <const value_type>::type const_reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ typedef typename segment_manager::size_type size_type;
+ typedef typename segment_manager::difference_type difference_type;
 
    typedef boost::interprocess::version_type<allocator, 2> version;
 
@@ -186,7 +186,7 @@
    //!will be assigned to received_size. The elements must be deallocated
    //!with deallocate(...)
    multiallocation_chain allocate_many
- (size_type elem_size, std::size_t num_elements)
+ (size_type elem_size, size_type num_elements)
    {
       return multiallocation_chain(mp_mngr->allocate_many(sizeof(T)*elem_size, num_elements));
    }
@@ -224,7 +224,7 @@
    //!will be assigned to received_size. Memory allocated with this function
    //!must be deallocated only with deallocate_one().
    multiallocation_chain allocate_individual
- (std::size_t num_elements)
+ (size_type num_elements)
    { return this->allocate_many(1, num_elements); }
 
    //!Deallocates memory previously allocated with allocate_one().

Modified: branches/release/boost/interprocess/allocators/cached_adaptive_pool.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/cached_adaptive_pool.hpp (original)
+++ branches/release/boost/interprocess/allocators/cached_adaptive_pool.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -74,8 +74,10 @@
          <T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> other;
    };
 
+ typedef typename base_t::size_type size_type;
+
    cached_adaptive_pool_v1(SegmentManager *segment_mngr,
- std::size_t max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES)
+ size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES)
       : base_t(segment_mngr, max_cached_nodes)
    {}
 
@@ -174,8 +176,8 @@
                      <value_type>::type reference;
    typedef typename detail::add_reference
                      <const value_type>::type const_reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ typedef typename segment_manager::size_type size_type;
+ typedef typename segment_manager::difference_type difference_type;
 
    //!Obtains cached_adaptive_pool from
    //!cached_adaptive_pool
@@ -278,7 +280,7 @@
    //!preferred_elements. The number of actually allocated elements is
    //!will be assigned to received_size. The elements must be deallocated
    //!with deallocate(...)
- multiallocation_chain allocate_many(size_type elem_size, std::size_t num_elements);
+ multiallocation_chain allocate_many(size_type elem_size, size_type num_elements);
 
    //!Allocates n_elements elements, each one of size elem_sizes[i]in a
    //!contiguous block
@@ -304,7 +306,7 @@
    //!preferred_elements. The number of actually allocated elements is
    //!will be assigned to received_size. Memory allocated with this function
    //!must be deallocated only with deallocate_one().
- multiallocation_chain allocate_individual(std::size_t num_elements);
+ multiallocation_chain allocate_individual(size_type num_elements);
 
    //!Deallocates memory previously allocated with allocate_one().
    //!You should never use deallocate_one to deallocate memory allocated
@@ -320,11 +322,11 @@
    void deallocate_individual(multiallocation_chain chain);
    //!Sets the new max cached nodes value. This can provoke deallocations
    //!if "newmax" is less than current cached nodes. Never throws
- void set_max_cached_nodes(std::size_t newmax);
+ void set_max_cached_nodes(size_type newmax);
 
    //!Returns the max cached nodes parameter.
    //!Never throws
- std::size_t get_max_cached_nodes() const;
+ size_type get_max_cached_nodes() const;
    #endif
 };
 

Modified: branches/release/boost/interprocess/allocators/cached_node_allocator.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/cached_node_allocator.hpp (original)
+++ branches/release/boost/interprocess/allocators/cached_node_allocator.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -69,8 +69,10 @@
          <T2, SegmentManager, NodesPerBlock> other;
    };
 
+ typedef typename base_t::size_type size_type;
+
    cached_node_allocator_v1(SegmentManager *segment_mngr,
- std::size_t max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES)
+ size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES)
       : base_t(segment_mngr, max_cached_nodes)
    {}
 
@@ -116,6 +118,7 @@
 
    public:
    typedef boost::interprocess::version_type<cached_node_allocator, 2> version;
+ typedef typename base_t::size_type size_type;
 
    template<class T2>
    struct rebind
@@ -124,7 +127,7 @@
    };
 
    cached_node_allocator(SegmentManager *segment_mngr,
- std::size_t max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES)
+ size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES)
       : base_t(segment_mngr, max_cached_nodes)
    {}
 
@@ -145,8 +148,8 @@
                      <value_type>::type reference;
    typedef typename detail::add_reference
                      <const value_type>::type const_reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ typedef typename SegmentManager::size_type size_type;
+ typedef typename SegmentManager::difference_type difference_type;
 
    //!Obtains cached_node_allocator from
    //!cached_node_allocator
@@ -249,7 +252,7 @@
    //!preferred_elements. The number of actually allocated elements is
    //!will be assigned to received_size. The elements must be deallocated
    //!with deallocate(...)
- multiallocation_chain allocate_many(size_type elem_size, std::size_t num_elements);
+ multiallocation_chain allocate_many(size_type elem_size, size_type num_elements);
 
    //!Allocates n_elements elements, each one of size elem_sizes[i]in a
    //!contiguous block
@@ -275,7 +278,7 @@
    //!preferred_elements. The number of actually allocated elements is
    //!will be assigned to received_size. Memory allocated with this function
    //!must be deallocated only with deallocate_one().
- multiallocation_chain allocate_individual(std::size_t num_elements);
+ multiallocation_chain allocate_individual(size_type num_elements);
 
    //!Deallocates memory previously allocated with allocate_one().
    //!You should never use deallocate_one to deallocate memory allocated
@@ -291,11 +294,11 @@
    void deallocate_individual(multiallocation_chain it);
    //!Sets the new max cached nodes value. This can provoke deallocations
    //!if "newmax" is less than current cached nodes. Never throws
- void set_max_cached_nodes(std::size_t newmax);
+ void set_max_cached_nodes(size_type newmax);
 
    //!Returns the max cached nodes parameter.
    //!Never throws
- std::size_t get_max_cached_nodes() const;
+ size_type get_max_cached_nodes() const;
    #endif
 };
 

Modified: branches/release/boost/interprocess/allocators/detail/adaptive_node_pool.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/detail/adaptive_node_pool.hpp (original)
+++ branches/release/boost/interprocess/allocators/detail/adaptive_node_pool.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -56,12 +56,13 @@
    private_adaptive_node_pool &operator=(const private_adaptive_node_pool &);
 
    public:
- typedef SegmentManager segment_manager;
+ typedef SegmentManager segment_manager;
+ typedef typename base_t::size_type size_type;
 
- static const std::size_t nodes_per_block = NodesPerBlock;
+ static const size_type nodes_per_block = NodesPerBlock;
 
    //Deprecated, use node_per_block
- static const std::size_t nodes_per_chunk = NodesPerBlock;
+ static const size_type nodes_per_chunk = NodesPerBlock;
 
    //!Constructor from a segment manager. Never throws
    private_adaptive_node_pool(segment_manager *segment_mngr)

Modified: branches/release/boost/interprocess/allocators/detail/allocator_common.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/detail/allocator_common.hpp (original)
+++ branches/release/boost/interprocess/allocators/detail/allocator_common.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -149,15 +149,16 @@
       void_pointer void_pointer;
    typedef typename pointer_to_other
       <void_pointer, NodePool>::type node_pool_ptr;
- typedef typename NodePool::multiallocation_chain multiallocation_chain;
+ typedef typename NodePool::multiallocation_chain multiallocation_chain;
+ typedef typename NodePool::segment_manager::size_type size_type;
    node_pool_ptr mp_node_pool;
    multiallocation_chain m_cached_nodes;
- std::size_t m_max_cached_nodes;
+ size_type m_max_cached_nodes;
 
    public:
    typedef typename NodePool::segment_manager segment_manager;
 
- cache_impl(segment_manager *segment_mngr, std::size_t max_cached_nodes)
+ cache_impl(segment_manager *segment_mngr, size_type max_cached_nodes)
       : mp_node_pool(get_or_create_node_pool<NodePool>(segment_mngr))
       , m_max_cached_nodes(max_cached_nodes)
    {}
@@ -181,7 +182,7 @@
    segment_manager *get_segment_manager() const
    { return mp_node_pool->get_segment_manager(); }
 
- std::size_t get_max_cached_nodes() const
+ size_type get_max_cached_nodes() const
    { return m_max_cached_nodes; }
 
    void *cached_allocation()
@@ -195,10 +196,10 @@
       return ret;
    }
 
- multiallocation_chain cached_allocation(std::size_t n)
+ multiallocation_chain cached_allocation(size_type n)
    {
       multiallocation_chain chain;
- std::size_t count = n, allocated(0);
+ size_type count = n, allocated(0);
       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--){
@@ -250,7 +251,7 @@
 
    //!Sets the new max cached nodes value. This can provoke deallocations
    //!if "newmax" is less than current cached nodes. Never throws
- void set_max_cached_nodes(std::size_t newmax)
+ void set_max_cached_nodes(size_type newmax)
    {
       m_max_cached_nodes = newmax;
       this->priv_deallocate_remaining_nodes();
@@ -275,13 +276,13 @@
    }
 
    //!Frees n cached nodes at once. Never throws
- void priv_deallocate_n_nodes(std::size_t n)
+ void priv_deallocate_n_nodes(size_type n)
    {
       //This only occurs if this allocator deallocate memory allocated
       //with other equal allocator. Since the cache is full, and more
       //deallocations are probably coming, we'll make some room in cache
       //in a single, efficient multi node deallocation.
- std::size_t count(n);
+ size_type count(n);
       typename multiallocation_chain::iterator it(m_cached_nodes.before_begin());
       while(count--){
          ++it;
@@ -321,8 +322,8 @@
                      <value_type>::type reference;
    typedef typename detail::add_reference
                      <const value_type>::type const_reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ typedef typename SegmentManager::size_type size_type;
+ typedef typename SegmentManager::difference_type difference_type;
    typedef boost::container::containers_detail::transform_multiallocation_chain
       <typename SegmentManager::multiallocation_chain, T>multiallocation_chain;
 
@@ -352,7 +353,7 @@
    //!preferred_elements. The number of actually allocated elements is
    //!will be assigned to received_size. The elements must be deallocated
    //!with deallocate(...)
- multiallocation_chain allocate_many(size_type elem_size, std::size_t num_elements)
+ multiallocation_chain allocate_many(size_type elem_size, size_type num_elements)
    {
       return this->derived()->get_segment_manager()->allocate_many(sizeof(T)*elem_size, num_elements);
    }
@@ -432,8 +433,8 @@
                      <value_type>::type reference;
    typedef typename detail::add_reference
                      <const value_type>::type const_reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ typedef typename SegmentManager::size_type size_type;
+ typedef typename SegmentManager::difference_type difference_type;
    typedef boost::container::containers_detail::transform_multiallocation_chain
       <typename SegmentManager::multiallocation_chain, T>multiallocation_chain;
 
@@ -492,7 +493,7 @@
    //!preferred_elements. The number of actually allocated elements is
    //!will be assigned to received_size. Memory allocated with this function
    //!must be deallocated only with deallocate_one().
- multiallocation_chain allocate_individual(std::size_t num_elements)
+ multiallocation_chain allocate_individual(size_type num_elements)
    {
       typedef typename node_pool<0>::type node_pool_t;
       node_pool_t *pool = node_pool<0>::get(this->derived()->get_node_pool());
@@ -557,7 +558,7 @@
    public:
    enum { DEFAULT_MAX_CACHED_NODES = 64 };
 
- cached_allocator_impl(segment_manager *segment_mngr, std::size_t max_cached_nodes)
+ cached_allocator_impl(segment_manager *segment_mngr, size_type max_cached_nodes)
       : m_cache(segment_mngr, max_cached_nodes)
    {}
 
@@ -587,12 +588,12 @@
 
    //!Sets the new max cached nodes value. This can provoke deallocations
    //!if "newmax" is less than current cached nodes. Never throws
- void set_max_cached_nodes(std::size_t newmax)
+ void set_max_cached_nodes(size_type newmax)
    { m_cache.set_max_cached_nodes(newmax); }
 
    //!Returns the max cached nodes parameter.
    //!Never throws
- std::size_t get_max_cached_nodes() const
+ size_type get_max_cached_nodes() const
    { return m_cache.get_max_cached_nodes(); }
 
    //!Allocate memory for an array of count elements.
@@ -636,7 +637,7 @@
    //!preferred_elements. The number of actually allocated elements is
    //!will be assigned to received_size. Memory allocated with this function
    //!must be deallocated only with deallocate_one().
- multiallocation_chain allocate_individual(std::size_t num_elements)
+ multiallocation_chain allocate_individual(size_type num_elements)
    { return multiallocation_chain(this->m_cache.cached_allocation(num_elements)); }
 
    //!Deallocates memory previously allocated with allocate_one().
@@ -708,6 +709,8 @@
       segment_manager segment_manager;
    typedef typename private_node_allocator_t::
       multiallocation_chain multiallocation_chain;
+ typedef typename private_node_allocator_t::
+ size_type size_type;
 
  private:
    typedef typename segment_manager::mutex_family::mutex_type mutex_type;
@@ -742,7 +745,7 @@
 /*
    //!Allocates a singly linked list of n nodes ending in null pointer.
    //!can throw boost::interprocess::bad_alloc
- void allocate_nodes(multiallocation_chain &nodes, std::size_t n)
+ void allocate_nodes(multiallocation_chain &nodes, size_type n)
    {
       //-----------------------
       boost::interprocess::scoped_lock<mutex_type> guard(m_header);
@@ -752,7 +755,7 @@
 */
    //!Allocates n nodes.
    //!Can throw boost::interprocess::bad_alloc
- multiallocation_chain allocate_nodes(const std::size_t n)
+ multiallocation_chain allocate_nodes(const size_type n)
    {
       //-----------------------
       boost::interprocess::scoped_lock<mutex_type> guard(m_header);
@@ -761,7 +764,7 @@
    }
 
    //!Deallocates a linked list of nodes ending in null pointer. Never throws
- void deallocate_nodes(multiallocation_chain &nodes, std::size_t num)
+ void deallocate_nodes(multiallocation_chain &nodes, size_type num)
    {
       //-----------------------
       boost::interprocess::scoped_lock<mutex_type> guard(m_header);
@@ -799,7 +802,7 @@
    }
 
    //!Increments internal reference count and returns new count. Never throws
- std::size_t inc_ref_count()
+ size_type inc_ref_count()
    {
       //-----------------------
       boost::interprocess::scoped_lock<mutex_type> guard(m_header);
@@ -808,7 +811,7 @@
    }
 
    //!Decrements internal reference count and returns new count. Never throws
- std::size_t dec_ref_count()
+ size_type dec_ref_count()
    {
       //-----------------------
       boost::interprocess::scoped_lock<mutex_type> guard(m_header);
@@ -840,7 +843,7 @@
    //!the mutex type to allow EBO when using null_mutex
    struct header_t : mutex_type
    {
- std::size_t m_usecount; //Number of attached allocators
+ size_type m_usecount; //Number of attached allocators
 
       header_t()
       : m_usecount(0) {}

Modified: branches/release/boost/interprocess/allocators/detail/node_pool.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/detail/node_pool.hpp (original)
+++ branches/release/boost/interprocess/allocators/detail/node_pool.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -55,11 +55,12 @@
    private_node_pool &operator=(const private_node_pool &);
 
    public:
- typedef SegmentManager segment_manager;
+ typedef SegmentManager segment_manager;
+ typedef typename base_t::size_type size_type;
 
- static const std::size_t nodes_per_block = NodesPerBlock;
+ static const size_type nodes_per_block = NodesPerBlock;
    //Deprecated, use nodes_per_block
- static const std::size_t nodes_per_chunk = NodesPerBlock;
+ static const size_type nodes_per_chunk = NodesPerBlock;
 
    //!Constructor from a segment manager. Never throws
    private_node_pool(segment_manager *segment_mngr)

Modified: branches/release/boost/interprocess/allocators/node_allocator.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/node_allocator.hpp (original)
+++ branches/release/boost/interprocess/allocators/node_allocator.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -89,8 +89,8 @@
                      <value_type>::type reference;
    typedef typename detail::add_reference
                      <const value_type>::type const_reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ typedef typename segment_manager::size_type size_type;
+ 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
@@ -279,8 +279,8 @@
                      <value_type>::type reference;
    typedef typename detail::add_reference
                      <const value_type>::type const_reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ typedef typename segment_manager::size_type size_type;
+ typedef typename segment_manager::difference_type difference_type;
 
    //!Obtains node_allocator from
    //!node_allocator
@@ -383,7 +383,7 @@
    //!preferred_elements. The number of actually allocated elements is
    //!will be assigned to received_size. The elements must be deallocated
    //!with deallocate(...)
- multiallocation_chain allocate_many(size_type elem_size, std::size_t num_elements);
+ multiallocation_chain allocate_many(size_type elem_size, size_type num_elements);
 
    //!Allocates n_elements elements, each one of size elem_sizes[i]in a
    //!contiguous block
@@ -409,7 +409,7 @@
    //!preferred_elements. The number of actually allocated elements is
    //!will be assigned to received_size. Memory allocated with this function
    //!must be deallocated only with deallocate_one().
- multiallocation_chain allocate_individual(std::size_t num_elements);
+ multiallocation_chain allocate_individual(size_type num_elements);
 
    //!Deallocates memory previously allocated with allocate_one().
    //!You should never use deallocate_one to deallocate memory allocated

Modified: branches/release/boost/interprocess/allocators/private_adaptive_pool.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/private_adaptive_pool.hpp (original)
+++ branches/release/boost/interprocess/allocators/private_adaptive_pool.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -90,8 +90,8 @@
                      <value_type>::type reference;
    typedef typename detail::add_reference
                      <const value_type>::type const_reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ typedef typename segment_manager::size_type size_type;
+ 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
@@ -293,8 +293,8 @@
                      <value_type>::type reference;
    typedef typename detail::add_reference
                      <const value_type>::type const_reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ typedef typename segment_manager::size_type size_type;
+ typedef typename segment_manager::difference_type difference_type;
 
    //!Obtains private_adaptive_pool from
    //!private_adaptive_pool
@@ -398,7 +398,7 @@
    //!preferred_elements. The number of actually allocated elements is
    //!will be assigned to received_size. The elements must be deallocated
    //!with deallocate(...)
- multiallocation_chain allocate_many(size_type elem_size, std::size_t num_elements);
+ multiallocation_chain allocate_many(size_type elem_size, size_type num_elements);
 
    //!Allocates n_elements elements, each one of size elem_sizes[i]in a
    //!contiguous block
@@ -424,7 +424,7 @@
    //!preferred_elements. The number of actually allocated elements is
    //!will be assigned to received_size. Memory allocated with this function
    //!must be deallocated only with deallocate_one().
- multiallocation_chain allocate_individual(std::size_t num_elements);
+ multiallocation_chain allocate_individual(size_type num_elements);
 
    //!Deallocates memory previously allocated with allocate_one().
    //!You should never use deallocate_one to deallocate memory allocated

Modified: branches/release/boost/interprocess/allocators/private_node_allocator.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/private_node_allocator.hpp (original)
+++ branches/release/boost/interprocess/allocators/private_node_allocator.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -84,8 +84,8 @@
                      <value_type>::type reference;
    typedef typename detail::add_reference
                      <const value_type>::type const_reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ typedef typename segment_manager::size_type size_type;
+ 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
@@ -269,8 +269,8 @@
                      <value_type>::type reference;
    typedef typename detail::add_reference
                      <const value_type>::type const_reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ typedef typename segment_manager::size_type size_type;
+ typedef typename segment_manage::difference_type difference_type;
 
    //!Obtains private_node_allocator from
    //!private_node_allocator
@@ -374,7 +374,7 @@
    //!preferred_elements. The number of actually allocated elements is
    //!will be assigned to received_size. The elements must be deallocated
    //!with deallocate(...)
- multiallocation_chain allocate_many(size_type elem_size, std::size_t num_elements);
+ multiallocation_chain allocate_many(size_type elem_size, size_type num_elements);
 
    //!Allocates n_elements elements, each one of size elem_sizes[i]in a
    //!contiguous block
@@ -400,7 +400,7 @@
    //!preferred_elements. The number of actually allocated elements is
    //!will be assigned to received_size. Memory allocated with this function
    //!must be deallocated only with deallocate_one().
- multiallocation_chain allocate_individual(std::size_t num_elements);
+ multiallocation_chain allocate_individual(size_type num_elements);
 
    //!Deallocates memory previously allocated with allocate_one().
    //!You should never use deallocate_one to deallocate memory allocated

Modified: branches/release/boost/interprocess/containers/container/container_fwd.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/container_fwd.hpp (original)
+++ branches/release/boost/interprocess/containers/container/container_fwd.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -32,6 +32,8 @@
 
 }}}
 
+#ifndef _LIBCPP_VERSION
+
 namespace std {
 
 template <class T>
@@ -48,6 +50,15 @@
 
 } //namespace std {
 
+#else
+
+#include <utility>
+#include <memory>
+#include <functional>
+#include <iosfwd>
+
+#endif
+
 /// @endcond
 
 //////////////////////////////////////////////////////////////////////////////

Modified: branches/release/boost/interprocess/containers/container/deque.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/deque.hpp (original)
+++ branches/release/boost/interprocess/containers/container/deque.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -35,7 +35,8 @@
 #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 INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
+#include <boost/move/move_helpers.hpp>
 #include INCLUDE_BOOST_CONTAINER_DETAIL_ADVANCED_INSERT_INT_HPP
 
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -82,7 +83,8 @@
    typedef typename Alloc::const_pointer val_alloc_cptr;
    typedef typename Alloc::reference val_alloc_ref;
    typedef typename Alloc::const_reference val_alloc_cref;
- typedef typename Alloc::value_type val_alloc_diff;
+ typedef typename Alloc::difference_type val_alloc_diff;
+ typedef typename Alloc::size_type val_alloc_size;
    typedef typename Alloc::template rebind
       <typename Alloc::pointer>::other ptr_alloc_t;
    typedef typename ptr_alloc_t::value_type ptr_alloc_val;
@@ -93,6 +95,7 @@
    typedef typename Alloc::template
       rebind<T>::other allocator_type;
    typedef allocator_type stored_allocator_type;
+ typedef val_alloc_size size_type;
 
    protected:
 
@@ -100,7 +103,7 @@
    typedef typename Alloc::template
       rebind<typename Alloc::pointer>::other map_allocator_type;
 
- static std::size_t s_buffer_size() { return deque_buf_size(sizeof(T)); }
+ static size_type s_buffer_size() { return deque_buf_size(sizeof(T)); }
 
    val_alloc_ptr priv_allocate_node()
       { return this->alloc().allocate(s_buffer_size()); }
@@ -108,10 +111,10 @@
    void priv_deallocate_node(val_alloc_ptr p)
       { this->alloc().deallocate(p, s_buffer_size()); }
 
- ptr_alloc_ptr priv_allocate_map(std::size_t n)
+ ptr_alloc_ptr priv_allocate_map(size_type n)
       { return this->ptr_alloc().allocate(n); }
 
- void priv_deallocate_map(ptr_alloc_ptr p, std::size_t n)
+ void priv_deallocate_map(ptr_alloc_ptr p, size_type n)
       { this->ptr_alloc().deallocate(p, n); }
 
  public:
@@ -145,14 +148,13 @@
                               val_alloc_cptr, val_alloc_cref>
    {
       public:
- static std::size_t s_buffer_size() { return deque_base<T, Alloc>::s_buffer_size(); }
+ static size_type s_buffer_size() { return deque_base<T, Alloc>::s_buffer_size(); }
 
       typedef std::random_access_iterator_tag iterator_category;
       typedef val_alloc_val value_type;
       typedef val_alloc_cptr pointer;
       typedef val_alloc_cref reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ typedef val_alloc_diff difference_type;
 
       typedef ptr_alloc_ptr index_pointer;
       typedef const_iterator self_t;
@@ -282,7 +284,7 @@
          this->m_last = this->m_first + difference_type(this->s_buffer_size());
       }
 
- friend const_iterator operator+(std::ptrdiff_t n, const const_iterator& x)
+ friend const_iterator operator+(difference_type n, const const_iterator& x)
          { return x + n; }
    };
 
@@ -294,8 +296,7 @@
       typedef val_alloc_val value_type;
       typedef val_alloc_ptr pointer;
       typedef val_alloc_ref reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ typedef val_alloc_diff difference_type;
       typedef ptr_alloc_ptr index_pointer;
       typedef const_iterator self_t;
 
@@ -351,7 +352,7 @@
          { return static_cast<const const_iterator&>(*this) - right; }
    };
 
- deque_base(const allocator_type& a, std::size_t num_elements)
+ deque_base(const allocator_type& a, size_type num_elements)
       : members_(a)
    { this->priv_initialize_map(num_elements); }
 
@@ -372,12 +373,12 @@
   
    protected:
 
- void priv_initialize_map(std::size_t num_elements)
+ void priv_initialize_map(size_type num_elements)
    {
 // if(num_elements){
- std::size_t num_nodes = num_elements / s_buffer_size() + 1;
+ size_type num_nodes = num_elements / s_buffer_size() + 1;
 
- this->members_.m_map_size = containers_detail::max_value((std::size_t) InitialMapSize, num_nodes + 2);
+ this->members_.m_map_size = containers_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;
@@ -436,7 +437,7 @@
       {}
 
       ptr_alloc_ptr m_map;
- std::size_t m_map_size;
+ typename allocator_type::size_type m_map_size;
       iterator m_start;
       iterator m_finish;
    } members_;
@@ -461,8 +462,6 @@
 class deque : protected deque_base<T, Alloc>
 {
    /// @cond
- typedef typename containers_detail::
- move_const_ref_type<T>::type insert_const_ref_type;
   typedef deque_base<T, Alloc> Base;
 
    public: // Basic types
@@ -471,6 +470,9 @@
    typedef typename Alloc::const_pointer val_alloc_cptr;
    typedef typename Alloc::reference val_alloc_ref;
    typedef typename Alloc::const_reference val_alloc_cref;
+ typedef typename Alloc::size_type val_alloc_size;
+ typedef typename Alloc::difference_type val_alloc_diff;
+
    typedef typename Alloc::template
       rebind<val_alloc_ptr>::other ptr_alloc_t;
    typedef typename ptr_alloc_t::value_type ptr_alloc_val;
@@ -485,9 +487,8 @@
    typedef val_alloc_cptr const_pointer;
    typedef val_alloc_ref reference;
    typedef val_alloc_cref const_reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
-
+ typedef val_alloc_size size_type;
+ typedef val_alloc_diff difference_type;
    typedef typename Base::allocator_type allocator_type;
 
    public: // Iterators
@@ -499,13 +500,13 @@
 
    /// @cond
    private: // Internal typedefs
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(deque)
+ BOOST_COPYABLE_AND_MOVABLE(deque)
    typedef ptr_alloc_ptr index_pointer;
- static std::size_t s_buffer_size()
+ 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 repeat_iterator<T, difference_type> r_iterator;
- typedef BOOST_CONTAINER_MOVE_NAMESPACE::move_iterator<r_iterator> move_it;
+ typedef boost::move_iterator<r_iterator> move_it;
 
    /// @endcond
 
@@ -595,7 +596,7 @@
       }
    }
 
- deque(BOOST_MOVE_MACRO_RV_REF(deque) mx)
+ deque(BOOST_RV_REF(deque) mx)
       : Base(mx.alloc())
    { this->swap(mx); }
 
@@ -612,7 +613,7 @@
       : Base(a)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InpIt, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
       typedef containers_detail::bool_<aux_boolean> Result;
       this->priv_initialize_dispatch(first, last, Result());
    }
@@ -622,7 +623,7 @@
       priv_destroy_range(this->members_.m_start, this->members_.m_finish);
    }
 
- deque& operator= (BOOST_MOVE_MACRO_COPY_ASSIGN_REF(deque) x)
+ deque& operator= (BOOST_COPY_ASSIGN_REF(deque) x)
    {
       const size_type len = size();
       if (&x != this) {
@@ -637,7 +638,7 @@
       return *this;
    }
 
- deque& operator= (BOOST_MOVE_MACRO_RV_REF(deque) x)
+ deque& operator= (BOOST_RV_REF(deque) x)
    {
       this->clear();
       this->swap(x);
@@ -659,55 +660,51 @@
    void assign(InpIt first, InpIt last)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InpIt, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
       typedef containers_detail::bool_<aux_boolean> Result;
       this->priv_assign_dispatch(first, last, Result());
    }
 
- #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- void push_back(T &x) { push_back(const_cast<const T &>(x)); }
+ #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
+ //! <b>Effects</b>: Inserts a copy of x at the end of the deque.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or
+ //! T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time.
+ void push_back(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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
- { return priv_push_back(u); }
+ //! <b>Effects</b>: Constructs a new element in the end of the deque
+ //! 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(T &&x);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
    #endif
 
- void push_back(insert_const_ref_type t)
- { return priv_push_back(t); }
-
- void push_back(BOOST_MOVE_MACRO_RV_REF(value_type) t)
- {
- if(this->priv_push_back_simple_available()){
- new(this->priv_push_back_simple_pos())value_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(t));
- this->priv_push_back_simple_commit();
- }
- else{
- this->priv_insert_aux(cend(), move_it(r_iterator(t, 1)), move_it(r_iterator()));
- }
- }
-
- #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- void push_front(T &x) { push_front(const_cast<const T &>(x)); }
+ #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
+ //! <b>Effects</b>: Inserts a copy of x at the end of the deque.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or
+ //! T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time.
+ void push_front(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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
- { return priv_push_front(u); }
+ //! <b>Effects</b>: Constructs a new element in the end of the deque
+ //! 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_front(T &&x);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front)
    #endif
 
- void push_front(insert_const_ref_type t)
- { return priv_push_front(t); }
-
- void push_front(BOOST_MOVE_MACRO_RV_REF(value_type) t)
- {
- if(this->priv_push_front_simple_available()){
- new(this->priv_push_front_simple_pos())value_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(t));
- this->priv_push_front_simple_commit();
- }
- else{
- this->priv_insert_aux(cbegin(), move_it(r_iterator(t, 1)), move_it(r_iterator()));
- }
- }
-
    void pop_back()
    {
       if (this->members_.m_finish.m_cur != this->members_.m_finish.m_first) {
@@ -728,35 +725,30 @@
          this->priv_pop_front_aux();
    }
 
- #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- 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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
- { return this->priv_insert(position, u); }
- #endif
+ #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
 
- iterator insert(const_iterator position, insert_const_ref_type x)
- { return this->priv_insert(position, x); }
+ //! <b>Requires</b>: position must be a valid iterator of *this.
+ //!
+ //! <b>Effects</b>: Insert a copy of x before position.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or x's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: If position is end(), amortized constant time
+ //! Linear time otherwise.
+ iterator insert(const_iterator position, const T &x);
 
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) mx)
- {
- if (position == cbegin()) {
- this->push_front(BOOST_CONTAINER_MOVE_NAMESPACE::move(mx));
- return begin();
- }
- else if (position == cend()) {
- this->push_back(BOOST_CONTAINER_MOVE_NAMESPACE::move(mx));
- return(end()-1);
- }
- else {
- //Just call more general insert(pos, size, value) and return iterator
- size_type n = position - begin();
- this->priv_insert_aux(position, move_it(r_iterator(mx, 1)), move_it(r_iterator()));
- return iterator(this->begin() + n);
- }
- }
+ //! <b>Requires</b>: position must be a valid iterator of *this.
+ //!
+ //! <b>Effects</b>: Insert a new element before position with mx's resources.
+ //!
+ //! <b>Throws</b>: If memory allocation throws.
+ //!
+ //! <b>Complexity</b>: If position is end(), amortized constant time
+ //! Linear time otherwise.
+ iterator insert(const_iterator position, T &&x);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
+ #endif
 
    void insert(const_iterator pos, size_type n, const value_type& x)
    { this->priv_fill_insert(pos, n, x); }
@@ -766,7 +758,7 @@
    void insert(const_iterator pos, InpIt first, InpIt last)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InpIt, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
       typedef containers_detail::bool_<aux_boolean> Result;
       this->priv_insert_dispatch(pos, first, last, Result());
    }
@@ -777,12 +769,12 @@
    void emplace_back(Args&&... args)
    {
       if(this->priv_push_back_simple_available()){
- new(this->priv_push_back_simple_pos())value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ new(this->priv_push_back_simple_pos())value_type(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_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ type &&proxy = type(boost::forward<Args>(args)...);
          this->priv_insert_aux_impl(this->cend(), 1, proxy);
       }
    }
@@ -791,12 +783,12 @@
    void emplace_front(Args&&... args)
    {
       if(this->priv_push_front_simple_available()){
- new(this->priv_push_front_simple_pos())value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ new(this->priv_push_front_simple_pos())value_type(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_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ type &&proxy = type(boost::forward<Args>(args)...);
          this->priv_insert_aux_impl(this->cbegin(), 1, proxy);
       }
    }
@@ -805,17 +797,17 @@
    iterator emplace(const_iterator p, Args&&... args)
    {
       if(p == this->cbegin()){
- this->emplace_front(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ this->emplace_front(boost::forward<Args>(args)...);
          return this->begin();
       }
       else if(p == this->cend()){
- this->emplace_back(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ this->emplace_back(boost::forward<Args>(args)...);
          return (this->end()-1);
       }
       else{
          size_type n = p - this->cbegin();
          typedef containers_detail::advanced_insert_aux_emplace<T, iterator, Args...> type;
- type &&proxy = type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ type &&proxy = type(boost::forward<Args>(args)...);
          this->priv_insert_aux_impl(p, 1, proxy);
          return iterator(this->begin() + n);
       }
@@ -953,11 +945,11 @@
       ++next;
       difference_type index = pos - this->members_.m_start;
       if (size_type(index) < (this->size() >> 1)) {
- BOOST_CONTAINER_MOVE_NAMESPACE::move_backward(begin(), iterator(pos), iterator(next));
+ boost::move_backward(begin(), iterator(pos), iterator(next));
          pop_front();
       }
       else {
- BOOST_CONTAINER_MOVE_NAMESPACE::move(iterator(next), end(), iterator(pos));
+ boost::move(iterator(next), end(), iterator(pos));
          pop_back();
       }
       return this->members_.m_start + index;
@@ -973,7 +965,7 @@
          difference_type n = last - first;
          difference_type elems_before = first - this->members_.m_start;
          if (elems_before < static_cast<difference_type>(this->size() - n) - elems_before) {
- BOOST_CONTAINER_MOVE_NAMESPACE::move_backward(begin(), iterator(first), iterator(last));
+ boost::move_backward(begin(), iterator(first), iterator(last));
             iterator new_start = this->members_.m_start + n;
             if(!Base::traits_t::trivial_dctr_after_move)
                this->priv_destroy_range(this->members_.m_start, new_start);
@@ -981,7 +973,7 @@
             this->members_.m_start = new_start;
          }
          else {
- BOOST_CONTAINER_MOVE_NAMESPACE::move(iterator(last), end(), iterator(first));
+ boost::move(iterator(last), end(), iterator(first));
             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);
@@ -1032,6 +1024,24 @@
       }
    }
 
+ iterator priv_insert(const_iterator position, BOOST_RV_REF(value_type) mx)
+ {
+ if (position == cbegin()) {
+ this->push_front(boost::move(mx));
+ return begin();
+ }
+ else if (position == cend()) {
+ this->push_back(boost::move(mx));
+ return(end()-1);
+ }
+ else {
+ //Just call more general insert(pos, size, value) and return iterator
+ size_type n = position - begin();
+ this->priv_insert_aux(position, move_it(r_iterator(mx, 1)), move_it(r_iterator()));
+ return iterator(this->begin() + n);
+ }
+ }
+
    void priv_push_front(const value_type &t)
    {
       if(this->priv_push_front_simple_available()){
@@ -1043,6 +1053,17 @@
       }
    }
 
+ 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));
+ this->priv_push_front_simple_commit();
+ }
+ else{
+ this->priv_insert_aux(cbegin(), move_it(r_iterator(t, 1)), move_it(r_iterator()));
+ }
+ }
+
    void priv_push_back(const value_type &t)
    {
       if(this->priv_push_back_simple_available()){
@@ -1054,6 +1075,16 @@
       }
    }
 
+ 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));
+ this->priv_push_back_simple_commit();
+ }
+ else{
+ this->priv_insert_aux(cend(), move_it(r_iterator(t, 1)), move_it(r_iterator()));
+ }
+ }
 
    bool priv_push_back_simple_available() const
    {
@@ -1087,7 +1118,7 @@
    void priv_insert_aux(const_iterator pos, InpIt first, InpIt last, std::input_iterator_tag)
    {
       for(;first != last; ++first){
- this->insert(pos, BOOST_CONTAINER_MOVE_NAMESPACE::move(value_type(*first)));
+ this->insert(pos, boost::move(value_type(*first)));
       }
    }
 
@@ -1215,9 +1246,9 @@
          pos = this->members_.m_start + elemsbefore;
          if (elemsbefore >= difference_type(n)) {
             iterator start_n = this->members_.m_start + difference_type(n);
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(this->members_.m_start, start_n, new_start);
+ ::boost::uninitialized_move(this->members_.m_start, start_n, new_start);
             this->members_.m_start = new_start;
- BOOST_CONTAINER_MOVE_NAMESPACE::move(start_n, pos, old_start);
+ boost::move(start_n, pos, old_start);
             interf.copy_all_to(pos - difference_type(n));
          }
          else {
@@ -1225,7 +1256,7 @@
             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_CONTAINER_MOVE_NAMESPACE::uninitialized_move(old_start, pos, new_start);
+ ::boost::uninitialized_move(old_start, pos, new_start);
             this->members_.m_start = new_start;
             interf.copy_all_to(old_start);
          }
@@ -1238,15 +1269,15 @@
          pos = this->members_.m_finish - elemsafter;
          if (elemsafter >= difference_type(n)) {
             iterator finish_n = this->members_.m_finish - difference_type(n);
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(finish_n, this->members_.m_finish, this->members_.m_finish);
+ ::boost::uninitialized_move(finish_n, this->members_.m_finish, this->members_.m_finish);
             this->members_.m_finish = new_finish;
- BOOST_CONTAINER_MOVE_NAMESPACE::move_backward(pos, finish_n, old_finish);
+ boost::move_backward(pos, finish_n, old_finish);
             interf.copy_all_to(pos);
          }
          else {
             interf.uninitialized_copy_some_and_update(old_finish, elemsafter, false);
             this->members_.m_finish += n-elemsafter;
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(pos, old_finish, this->members_.m_finish);
+ ::boost::uninitialized_move(pos, old_finish, this->members_.m_finish);
             this->members_.m_finish = new_finish;
             interf.copy_all_to(pos);
          }
@@ -1306,10 +1337,10 @@
                ++cur_node) {
             FwdIt mid = first;
             std::advance(mid, this->s_buffer_size());
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first, mid, *cur_node);
+ ::boost::uninitialized_copy_or_move(first, mid, *cur_node);
             first = mid;
          }
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first, last, this->members_.m_finish.m_first);
+ ::boost::uninitialized_copy_or_move(first, last, this->members_.m_finish.m_first);
       }
       BOOST_CATCH(...){
          this->priv_destroy_range(this->members_.m_start, iterator(*cur_node, cur_node));
@@ -1400,9 +1431,9 @@
          new_nstart = this->members_.m_map + (this->members_.m_map_size - new_num_nodes) / 2
                            + (add_at_front ? nodes_to_add : 0);
          if (new_nstart < this->members_.m_start.m_node)
- BOOST_CONTAINER_MOVE_NAMESPACE::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart);
+ boost::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart);
          else
- BOOST_CONTAINER_MOVE_NAMESPACE::move_backward
+ boost::move_backward
                (this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart + old_num_nodes);
       }
       else {
@@ -1412,7 +1443,7 @@
          index_pointer new_map = this->priv_allocate_map(new_map_size);
          new_nstart = new_map + (new_map_size - new_num_nodes) / 2
                               + (add_at_front ? nodes_to_add : 0);
- BOOST_CONTAINER_MOVE_NAMESPACE::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart);
+ boost::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart);
          this->priv_deallocate_map(this->members_.m_map, this->members_.m_map_size);
 
          this->members_.m_map = new_map;

Modified: branches/release/boost/interprocess/containers/container/detail/adaptive_node_pool_impl.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/adaptive_node_pool_impl.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/adaptive_node_pool_impl.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -33,15 +33,16 @@
 namespace container {
 namespace containers_detail {
 
-struct hdr_offset_holder
+template<class size_type>
+struct hdr_offset_holder_t
 {
- hdr_offset_holder(std::size_t offset = 0)
+ hdr_offset_holder_t(size_type offset = 0)
       : hdr_offset(offset)
    {}
- std::size_t hdr_offset;
+ size_type hdr_offset;
 };
 
-template<class VoidPointer>
+template<class VoidPointer, class SizeType>
 struct adaptive_pool_types
 {
    typedef VoidPointer void_pointer;
@@ -50,6 +51,8 @@
       , bi::optimize_size<true>
       , bi::constant_time_size<false>
       , bi::link_mode<bi::normal_link> >::type multiset_hook_t;
+
+ typedef hdr_offset_holder_t<SizeType> hdr_offset_holder;
 
    struct block_info_t
       :
@@ -77,23 +80,23 @@
       <block_info_t, bi::base_hook<multiset_hook_t> >::type block_multiset_t;
 };
 
-
-inline std::size_t calculate_alignment
- ( std::size_t overhead_percent, std::size_t real_node_size
- , std::size_t hdr_size, std::size_t hdr_offset_size, std::size_t payload_per_allocation)
+template<class size_type>
+inline size_type calculate_alignment
+ ( size_type overhead_percent, size_type real_node_size
+ , size_type hdr_size, size_type hdr_offset_size, size_type payload_per_allocation)
 {
    //to-do: handle real_node_size != node_size
- const std::size_t divisor = overhead_percent*real_node_size;
- const std::size_t dividend = hdr_offset_size*100;
- std::size_t elements_per_subblock = (dividend - 1)/divisor + 1;
- std::size_t candidate_power_of_2 =
+ const size_type divisor = overhead_percent*real_node_size;
+ const size_type dividend = hdr_offset_size*100;
+ size_type elements_per_subblock = (dividend - 1)/divisor + 1;
+ size_type candidate_power_of_2 =
       upper_power_of_2(elements_per_subblock*real_node_size + hdr_offset_size);
    bool overhead_satisfied = false;
    //Now calculate the wors-case overhead for a subblock
- const std::size_t max_subblock_overhead = hdr_size + payload_per_allocation;
+ const size_type max_subblock_overhead = hdr_size + payload_per_allocation;
    while(!overhead_satisfied){
       elements_per_subblock = (candidate_power_of_2 - max_subblock_overhead)/real_node_size;
- const std::size_t overhead_size = candidate_power_of_2 - elements_per_subblock*real_node_size;
+ const size_type overhead_size = candidate_power_of_2 - elements_per_subblock*real_node_size;
       if(overhead_size*100/candidate_power_of_2 < overhead_percent){
          overhead_satisfied = true;
       }
@@ -104,22 +107,23 @@
    return candidate_power_of_2;
 }
 
+template<class size_type>
 inline void calculate_num_subblocks
- (std::size_t alignment, std::size_t real_node_size, std::size_t elements_per_block
- , std::size_t &num_subblocks, std::size_t &real_num_node, std::size_t overhead_percent
- , std::size_t hdr_size, std::size_t hdr_offset_size, std::size_t payload_per_allocation)
+ (size_type alignment, size_type real_node_size, size_type elements_per_block
+ , size_type &num_subblocks, size_type &real_num_node, size_type overhead_percent
+ , size_type hdr_size, size_type hdr_offset_size, size_type payload_per_allocation)
 {
- std::size_t elements_per_subblock = (alignment - hdr_offset_size)/real_node_size;
- std::size_t possible_num_subblock = (elements_per_block - 1)/elements_per_subblock + 1;
- std::size_t hdr_subblock_elements = (alignment - hdr_size - payload_per_allocation)/real_node_size;
+ size_type elements_per_subblock = (alignment - hdr_offset_size)/real_node_size;
+ size_type possible_num_subblock = (elements_per_block - 1)/elements_per_subblock + 1;
+ size_type hdr_subblock_elements = (alignment - hdr_size - payload_per_allocation)/real_node_size;
    while(((possible_num_subblock-1)*elements_per_subblock + hdr_subblock_elements) < elements_per_block){
       ++possible_num_subblock;
    }
    elements_per_subblock = (alignment - hdr_offset_size)/real_node_size;
    bool overhead_satisfied = false;
    while(!overhead_satisfied){
- const std::size_t total_data = (elements_per_subblock*(possible_num_subblock-1) + hdr_subblock_elements)*real_node_size;
- const std::size_t total_size = alignment*possible_num_subblock;
+ const size_type total_data = (elements_per_subblock*(possible_num_subblock-1) + hdr_subblock_elements)*real_node_size;
+ const size_type total_size = alignment*possible_num_subblock;
       if((total_size - total_data)*100/total_size < overhead_percent){
          overhead_satisfied = true;
       }
@@ -141,7 +145,8 @@
    typedef private_adaptive_node_pool_impl this_type;
 
    typedef typename SegmentManagerBase::void_pointer void_pointer;
- static const std::size_t PayloadPerAllocation = SegmentManagerBase::PayloadPerAllocation;
+ static const typename SegmentManagerBase::
+ size_type PayloadPerAllocation = SegmentManagerBase::PayloadPerAllocation;
    typedef bool_<AlignOnly> IsAlignOnly;
    typedef true_ AlignOnlyTrue;
    typedef false_ AlignOnlyFalse;
@@ -150,15 +155,17 @@
    typedef typename node_slist<void_pointer>::node_t node_t;
    typedef typename node_slist<void_pointer>::node_slist_t free_nodes_t;
    typedef typename SegmentManagerBase::multiallocation_chain multiallocation_chain;
+ typedef typename SegmentManagerBase::size_type size_type;
 
    private:
- typedef typename adaptive_pool_types<void_pointer>::block_info_t block_info_t;
- typedef typename adaptive_pool_types<void_pointer>::block_multiset_t block_multiset_t;
- typedef typename block_multiset_t::iterator block_iterator;
-
- static const std::size_t MaxAlign = alignment_of<node_t>::value;
- static const std::size_t HdrSize = ((sizeof(block_info_t)-1)/MaxAlign+1)*MaxAlign;
- static const std::size_t HdrOffsetSize = ((sizeof(hdr_offset_holder)-1)/MaxAlign+1)*MaxAlign;
+ typedef typename adaptive_pool_types<void_pointer, size_type>::block_info_t block_info_t;
+ typedef typename adaptive_pool_types<void_pointer, size_type>::block_multiset_t block_multiset_t;
+ typedef typename block_multiset_t::iterator block_iterator;
+ typedef typename adaptive_pool_types<void_pointer, size_type>::hdr_offset_holder hdr_offset_holder;
+
+ static const size_type MaxAlign = alignment_of<node_t>::value;
+ static const size_type HdrSize = ((sizeof(block_info_t)-1)/MaxAlign+1)*MaxAlign;
+ static const size_type HdrOffsetSize = ((sizeof(hdr_offset_holder)-1)/MaxAlign+1)*MaxAlign;
 
 
    public:
@@ -168,20 +175,20 @@
    //!Constructor from a segment manager. Never throws
    private_adaptive_node_pool_impl
       ( segment_manager_base_type *segment_mngr_base
- , std::size_t node_size
- , std::size_t nodes_per_block
- , std::size_t max_free_blocks
+ , size_type node_size
+ , size_type nodes_per_block
+ , size_type max_free_blocks
       , unsigned char overhead_percent
       )
    : m_max_free_blocks(max_free_blocks)
- , m_real_node_size(lcm(node_size, std::size_t(alignment_of<node_t>::value)))
+ , m_real_node_size(lcm(node_size, size_type(alignment_of<node_t>::value)))
       //Round the size to a power of two value.
       //This is the total memory size (including payload) that we want to
       //allocate from the general-purpose allocator
    , m_real_block_alignment
          (AlignOnly ?
             upper_power_of_2(HdrSize + m_real_node_size*nodes_per_block) :
- calculate_alignment( overhead_percent, m_real_node_size
+ calculate_alignment( (size_type)overhead_percent, m_real_node_size
                                , HdrSize, HdrOffsetSize, PayloadPerAllocation))
       //This is the real number of nodes per block
    , m_num_subblocks(0)
@@ -198,7 +205,7 @@
             , nodes_per_block
             , m_num_subblocks
             , m_real_num_node
- , overhead_percent
+ , (size_type)overhead_percent
             , HdrSize
             , HdrOffsetSize
             , PayloadPerAllocation);
@@ -209,7 +216,7 @@
    ~private_adaptive_node_pool_impl()
    { priv_clear(); }
 
- std::size_t get_real_num_node() const
+ size_type get_real_num_node() const
    { return m_real_num_node; }
 
    //!Returns the segment manager. Never throws
@@ -243,10 +250,10 @@
 
    //!Allocates n nodes.
    //!Can throw
- multiallocation_chain allocate_nodes(const std::size_t n)
+ multiallocation_chain allocate_nodes(const size_type n)
    {
       multiallocation_chain chain;
- std::size_t i = 0;
+ size_type i = 0;
       try{
          priv_invariants();
          while(i != n){
@@ -255,12 +262,12 @@
                priv_alloc_block(((n - i) - 1)/m_real_num_node + 1);
             }
             free_nodes_t &free_nodes = m_block_multiset.begin()->free_nodes;
- const std::size_t free_nodes_count_before = free_nodes.size();
+ const size_type free_nodes_count_before = free_nodes.size();
             if(free_nodes_count_before == m_real_num_node){
                --m_totally_free_blocks;
             }
- const std::size_t num_elems = ((n-i) < free_nodes_count_before) ? (n-i) : free_nodes_count_before;
- for(std::size_t j = 0; j != num_elems; ++j){
+ const size_type num_elems = ((n-i) < free_nodes_count_before) ? (n-i) : free_nodes_count_before;
+ for(size_type j = 0; j != num_elems; ++j){
                void *new_node = &free_nodes.front();
                free_nodes.pop_front();
                chain.push_back(new_node);
@@ -273,11 +280,11 @@
          }
       }
       catch(...){
- this->deallocate_nodes(BOOST_CONTAINER_MOVE_NAMESPACE::move(chain));
+ this->deallocate_nodes(boost::move(chain));
          throw;
       }
       priv_invariants();
- return BOOST_CONTAINER_MOVE_NAMESPACE::move(chain);
+ return boost::move(chain);
    }
 
    //!Deallocates a linked list of nodes. Never throws
@@ -292,10 +299,10 @@
    void deallocate_free_blocks()
    { this->priv_deallocate_free_blocks(0); }
 
- std::size_t num_free_nodes()
+ size_type num_free_nodes()
    {
       typedef typename block_multiset_t::const_iterator citerator;
- std::size_t count = 0;
+ size_type count = 0;
       citerator it (m_block_multiset.begin()), itend(m_block_multiset.end());
       for(; it != itend; ++it){
          count += it->free_nodes.size();
@@ -319,7 +326,7 @@
    { this->priv_deallocate_free_blocks(0); }
 
    private:
- void priv_deallocate_free_blocks(std::size_t max_free_blocks)
+ void priv_deallocate_free_blocks(size_type max_free_blocks)
    {
       priv_invariants();
       //Now check if we've reached the free nodes limit
@@ -337,7 +344,7 @@
       }
    }
 
- void priv_reinsert_nodes_in_block(multiallocation_chain &chain, std::size_t n)
+ void priv_reinsert_nodes_in_block(multiallocation_chain &chain, size_type n)
    {
       block_iterator block_it(m_block_multiset.end());
       while(n--){
@@ -355,7 +362,7 @@
          ++next_block;
 
          //Cache the free nodes from the block
- std::size_t this_block_free_nodes = this_block->free_nodes.size();
+ size_type this_block_free_nodes = this_block->free_nodes.size();
 
          if(this_block_free_nodes == 1){
             m_block_multiset.insert(m_block_multiset.begin(), *block_info);
@@ -364,7 +371,7 @@
             block_iterator next_block(this_block);
             ++next_block;
             if(next_block != block_it){
- std::size_t next_free_nodes = next_block->free_nodes.size();
+ size_type next_free_nodes = next_block->free_nodes.size();
                if(this_block_free_nodes > next_free_nodes){
                   //Now move the block to the new position
                   m_block_multiset.erase(this_block);
@@ -386,7 +393,7 @@
       //We take the first free node the multiset can't be empty
       free_nodes_t &free_nodes = m_block_multiset.begin()->free_nodes;
       node_t *first_node = &free_nodes.front();
- const std::size_t free_nodes_count = free_nodes.size();
+ const size_type free_nodes_count = free_nodes.size();
       BOOST_ASSERT(0 != free_nodes_count);
       free_nodes.pop_front();
       if(free_nodes_count == 1){
@@ -415,7 +422,7 @@
       private:
       void do_destroy(typename block_multiset_t::pointer to_deallocate, AlignOnlyTrue)
       {
- std::size_t free_nodes = to_deallocate->free_nodes.size();
+ size_type free_nodes = to_deallocate->free_nodes.size();
          (void)free_nodes;
          BOOST_ASSERT(free_nodes == mp_impl->m_real_num_node);
          mp_impl->mp_segment_mngr_base->deallocate(to_deallocate);
@@ -423,7 +430,7 @@
 
       void do_destroy(typename block_multiset_t::pointer to_deallocate, AlignOnlyFalse)
       {
- std::size_t free_nodes = to_deallocate->free_nodes.size();
+ size_type free_nodes = to_deallocate->free_nodes.size();
          (void)free_nodes;
          BOOST_ASSERT(free_nodes == mp_impl->m_real_num_node);
          BOOST_ASSERT(0 == to_deallocate->hdr_offset);
@@ -447,7 +454,7 @@
          for(++it; it != itend; ++it){
             block_iterator prev(it);
             --prev;
- std::size_t sp = prev->free_nodes.size(),
+ size_type sp = prev->free_nodes.size(),
                         si = it->free_nodes.size();
             BOOST_ASSERT(sp <= si);
             (void)sp; (void)si;
@@ -456,7 +463,7 @@
       //Check that the total free nodes are correct
       it = m_block_multiset.begin();
       itend = m_block_multiset.end();
- std::size_t total_free_nodes = 0;
+ size_type total_free_nodes = 0;
       for(; it != itend; ++it){
          total_free_nodes += it->free_nodes.size();
       }
@@ -476,9 +483,9 @@
          it = m_block_multiset.begin();
          for(; it != itend; ++it){
             hdr_offset_holder *hdr_off_holder = priv_first_subblock_from_block(&*it);
- for(std::size_t i = 0, max = m_num_subblocks; i < max; ++i){
- BOOST_ASSERT(hdr_off_holder->hdr_offset == std::size_t(reinterpret_cast<char*>(&*it)- reinterpret_cast<char*>(hdr_off_holder)));
- BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
+ for(size_type i = 0, max = m_num_subblocks; i < max; ++i){
+ BOOST_ASSERT(hdr_off_holder->hdr_offset == size_type(reinterpret_cast<char*>(&*it)- reinterpret_cast<char*>(hdr_off_holder)));
+ BOOST_ASSERT(0 == ((size_type)hdr_off_holder & (m_real_block_alignment - 1)));
                BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
                hdr_off_holder = reinterpret_cast<hdr_offset_holder *>(reinterpret_cast<char*>(hdr_off_holder) + m_real_block_alignment);
             }
@@ -495,7 +502,7 @@
       #ifndef NDEBUG
       block_iterator it = m_block_multiset.begin();
       block_iterator itend = m_block_multiset.end();
- std::size_t num_free_nodes = 0;
+ size_type num_free_nodes = 0;
       for(; it != itend; ++it){
          //Check for memory leak
          BOOST_ASSERT(it->free_nodes.size() == m_real_num_node);
@@ -512,7 +519,7 @@
    block_info_t *priv_block_from_node(void *node, AlignOnlyFalse) const
    {
       hdr_offset_holder *hdr_off_holder =
- reinterpret_cast<hdr_offset_holder*>((std::size_t)node & std::size_t(~(m_real_block_alignment - 1)));
+ reinterpret_cast<hdr_offset_holder*>((std::size_t)node & size_type(~(m_real_block_alignment - 1)));
       BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
       BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
       block_info_t *block = reinterpret_cast<block_info_t *>
@@ -533,17 +540,17 @@
    {
       hdr_offset_holder *hdr_off_holder = reinterpret_cast<hdr_offset_holder*>
             (reinterpret_cast<char*>(block) - (m_num_subblocks-1)*m_real_block_alignment);
- BOOST_ASSERT(hdr_off_holder->hdr_offset == std::size_t(reinterpret_cast<char*>(block) - reinterpret_cast<char*>(hdr_off_holder)));
- BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
+ BOOST_ASSERT(hdr_off_holder->hdr_offset == size_type(reinterpret_cast<char*>(block) - reinterpret_cast<char*>(hdr_off_holder)));
+ BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
       BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
       return hdr_off_holder;
    }
 
    //!Allocates a several blocks of nodes. Can throw
- void priv_alloc_block(std::size_t n, AlignOnlyTrue)
+ void priv_alloc_block(size_type n, AlignOnlyTrue)
    {
- std::size_t real_block_size = m_real_block_alignment - PayloadPerAllocation;
- for(std::size_t i = 0; i != n; ++i){
+ size_type real_block_size = m_real_block_alignment - PayloadPerAllocation;
+ for(size_type i = 0; i != n; ++i){
          //We allocate a new NodeBlock and put it the last
          //element of the tree
          char *mem_address = static_cast<char*>
@@ -557,20 +564,20 @@
          //We initialize all Nodes in Node Block to insert
          //them in the free Node list
          typename free_nodes_t::iterator prev_insert_pos = c_info->free_nodes.before_begin();
- for(std::size_t i = 0; i < m_real_num_node; ++i){
+ for(size_type i = 0; i < m_real_num_node; ++i){
             prev_insert_pos = c_info->free_nodes.insert_after(prev_insert_pos, *(node_t*)mem_address);
             mem_address += m_real_node_size;
          }
       }
    }
 
- void priv_alloc_block(std::size_t n, AlignOnlyFalse)
+ void priv_alloc_block(size_type n, AlignOnlyFalse)
    {
- std::size_t real_block_size = m_real_block_alignment*m_num_subblocks - PayloadPerAllocation;
- std::size_t elements_per_subblock = (m_real_block_alignment - HdrOffsetSize)/m_real_node_size;
- std::size_t hdr_subblock_elements = (m_real_block_alignment - HdrSize - PayloadPerAllocation)/m_real_node_size;
+ size_type real_block_size = m_real_block_alignment*m_num_subblocks - PayloadPerAllocation;
+ size_type elements_per_subblock = (m_real_block_alignment - HdrOffsetSize)/m_real_node_size;
+ size_type hdr_subblock_elements = (m_real_block_alignment - HdrSize - PayloadPerAllocation)/m_real_node_size;
 
- for(std::size_t i = 0; i != n; ++i){
+ for(size_type i = 0; i != n; ++i){
          //We allocate a new NodeBlock and put it the last
          //element of the tree
          char *mem_address = static_cast<char*>
@@ -585,13 +592,13 @@
          BOOST_ASSERT(static_cast<void*>(&static_cast<hdr_offset_holder*>(c_info)->hdr_offset) ==
                 static_cast<void*>(c_info));
          typename free_nodes_t::iterator prev_insert_pos = c_info->free_nodes.before_begin();
- for( std::size_t subblock = 0, maxsubblock = m_num_subblocks - 1
+ for( size_type subblock = 0, maxsubblock = m_num_subblocks - 1
             ; subblock < maxsubblock
             ; ++subblock, mem_address += m_real_block_alignment){
             //Initialize header offset mark
- new(mem_address) hdr_offset_holder(std::size_t(hdr_addr - mem_address));
+ new(mem_address) hdr_offset_holder(size_type(hdr_addr - mem_address));
             char *pNode = mem_address + HdrOffsetSize;
- for(std::size_t i = 0; i < elements_per_subblock; ++i){
+ for(size_type i = 0; i < elements_per_subblock; ++i){
                prev_insert_pos = c_info->free_nodes.insert_after(prev_insert_pos, *new (pNode) node_t);
                pNode += m_real_node_size;
             }
@@ -600,7 +607,7 @@
             char *pNode = hdr_addr + HdrSize;
             //We initialize all Nodes in Node Block to insert
             //them in the free Node list
- for(std::size_t i = 0; i < hdr_subblock_elements; ++i){
+ for(size_type i = 0; i < hdr_subblock_elements; ++i){
                prev_insert_pos = c_info->free_nodes.insert_after(prev_insert_pos, *new (pNode) node_t);
                pNode += m_real_node_size;
             }
@@ -611,25 +618,25 @@
    }
 
    //!Allocates a block of nodes. Can throw std::bad_alloc
- void priv_alloc_block(std::size_t n)
+ void priv_alloc_block(size_type n)
    { 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;
- const std::size_t m_max_free_blocks;
- const std::size_t m_real_node_size;
+ const size_type m_max_free_blocks;
+ const size_type m_real_node_size;
    //Round the size to a power of two value.
    //This is the total memory size (including payload) that we want to
    //allocate from the general-purpose allocator
- const std::size_t m_real_block_alignment;
- std::size_t m_num_subblocks;
+ const size_type m_real_block_alignment;
+ size_type m_num_subblocks;
    //This is the real number of nodes per block
    //const
- std::size_t m_real_num_node;
+ size_type m_real_num_node;
    segment_mngr_base_ptr_t mp_segment_mngr_base; //Segment manager
    block_multiset_t m_block_multiset; //Intrusive block list
- std::size_t m_totally_free_blocks; //Free blocks
+ size_type m_totally_free_blocks; //Free blocks
 };
 
 } //namespace containers_detail {

Modified: branches/release/boost/interprocess/containers/container/detail/advanced_insert_int.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/advanced_insert_int.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/advanced_insert_int.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -17,7 +17,7 @@
 
 #include "config_begin.hpp"
 #include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
 #include <iterator> //std::iterator_traits
 #include <new> //placement new
 #include <boost/assert.hpp>
@@ -50,21 +50,21 @@
    {}
 
    virtual void copy_all_to(Iterator p)
- { ::BOOST_CONTAINER_MOVE_NAMESPACE::copy_or_move(first_, last_, p); }
+ { ::boost::copy_or_move(first_, last_, p); }
 
    virtual void uninitialized_copy_all_to(Iterator p)
- { ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first_, last_, p); }
+ { ::boost::uninitialized_copy_or_move(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_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first_, mid, pos);
+ ::boost::uninitialized_copy_or_move(first_, mid, pos);
          first_ = mid;
       }
       else{
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(mid, last_, pos);
+ ::boost::uninitialized_copy_or_move(mid, last_, pos);
          last_ = mid;
       }
    }
@@ -74,11 +74,11 @@
       FwdIt mid = first_;
       std::advance(mid, division_count);
       if(first_n){
- ::BOOST_CONTAINER_MOVE_NAMESPACE::copy_or_move(first_, mid, pos);
+ ::boost::copy_or_move(first_, mid, pos);
          first_ = mid;
       }
       else{
- ::BOOST_CONTAINER_MOVE_NAMESPACE::copy_or_move(mid, last_, pos);
+ ::boost::copy_or_move(mid, last_, pos);
          last_ = mid;
       }
    }
@@ -164,7 +164,7 @@
 
 #include INCLUDE_BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_STORED_REF_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
 #include <typeinfo>
 //#include <iostream> //For debugging purposes
 
@@ -205,7 +205,7 @@
    void priv_copy_all_to(const index_tuple<IdxPack...>&, Iterator p)
    {
       if(!used_){
- *p = BOOST_CONTAINER_MOVE_NAMESPACE::move(T (::boost::container::containers_detail::stored_ref<Args>::forward(get<IdxPack>(args_))...));
+ *p = boost::move(T (::boost::container::containers_detail::stored_ref<Args>::forward(get<IdxPack>(args_))...));
          used_ = true;
       }
    }
@@ -237,7 +237,7 @@
       BOOST_ASSERT(division_count <=1);
       if((first_n && division_count == 1) || (!first_n && division_count == 0)){
          if(!used_){
- *p = BOOST_CONTAINER_MOVE_NAMESPACE::move(T(::boost::container::containers_detail::stored_ref<Args>::forward(get<IdxPack>(args_))...));
+ *p = boost::move(T(::boost::container::containers_detail::stored_ref<Args>::forward(get<IdxPack>(args_))...));
             used_ = true;
          }
       }
@@ -274,7 +274,7 @@
    {
       if(!used_){
          value_init<T>v;
- *p = BOOST_CONTAINER_MOVE_NAMESPACE::move(v.m_t);
+ *p = boost::move(v.m_t);
          used_ = true;
       }
    }
@@ -304,7 +304,7 @@
       if((first_n && division_count == 1) || (!first_n && division_count == 0)){
          if(!used_){
             value_init<T>v;
- *p = BOOST_CONTAINER_MOVE_NAMESPACE::move(v.m_t);
+ *p = boost::move(v.m_t);
             used_ = true;
          }
       }
@@ -328,7 +328,7 @@
       { \
          if(!used_){ \
             T v(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_MEMBER_FORWARD, _)); \
- *p = BOOST_CONTAINER_MOVE_NAMESPACE::move(v); \
+ *p = boost::move(v); \
             used_ = true; \
          } \
       } \
@@ -362,7 +362,7 @@
          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_CONTAINER_MOVE_NAMESPACE::move(v); \
+ *p = boost::move(v); \
                used_ = true; \
             } \
          } \

Modified: branches/release/boost/interprocess/containers/container/detail/algorithms.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/algorithms.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/algorithms.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -77,8 +77,8 @@
    ::new((void*)dest)T();
 }
 
-template<class T, class U, class E>
-inline void construct_in_place(T *dest, emplace_iterator<U, E> ei)
+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);
 }

Modified: branches/release/boost/interprocess/containers/container/detail/config_begin.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/config_begin.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/config_begin.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -12,19 +12,6 @@
 #include <boost/config.hpp>
 
 #define BOOST_CONTAINER_IN_INTERPROCESS
-#define BOOST_MOVE_IN_INTERPROCESS
-
-#ifdef BOOST_MOVE_IN_INTERPROCESS
-
-#define INCLUDE_BOOST_CONTAINER_MOVE_HPP <boost/interprocess/detail/move.hpp>
-#define BOOST_CONTAINER_MOVE_NAMESPACE boost::interprocess
-
-#else
-
-#define INCLUDE_BOOST_CONTAINER_MOVE_HPP <boost/move/move.hpp>
-#define BOOST_CONTAINER_MOVE_NAMESPACE boost
-
-#endif
 
 #ifdef BOOST_CONTAINER_IN_INTERPROCESS
 

Modified: branches/release/boost/interprocess/containers/container/detail/destroyers.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/destroyers.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/destroyers.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -89,7 +89,7 @@
    {
       if(!m_p) return;
       value_type *raw_ptr = containers_detail::get_pointer(m_p);
- for(std::size_t i = 0; i < m_n; ++i, ++raw_ptr)
+ for(size_type i = 0; i < m_n; ++i, ++raw_ptr)
          raw_ptr->~value_type();
    }
 };

Modified: branches/release/boost/interprocess/containers/container/detail/flat_tree.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/flat_tree.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/flat_tree.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -42,7 +42,7 @@
 #include <utility>
 
 #include <boost/type_traits/has_trivial_destructor.hpp>
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
 
 #include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_PAIR_HPP
@@ -108,7 +108,7 @@
       : public value_compare
    {
       private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(Data)
+ BOOST_COPYABLE_AND_MOVABLE(Data)
       public:
       Data(const Data &d)
          : value_compare(d), m_vect(d.m_vect)
@@ -125,17 +125,17 @@
            const allocator_t &alloc)
          : value_compare(comp), m_vect(alloc){}
 
- Data& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(Data) d)
+ Data& operator=(BOOST_COPY_ASSIGN_REF(Data) d)
       {
          this->value_compare::operator=(d);
          m_vect = d.m_vect;
          return *this;
       }
 
- Data& operator=(BOOST_MOVE_MACRO_RV_REF(Data) d)
+ Data& operator=(BOOST_RV_REF(Data) d)
       {
- this->value_compare::operator=(BOOST_CONTAINER_MOVE_NAMESPACE::move(static_cast<value_compare &>(d)));
- m_vect = BOOST_CONTAINER_MOVE_NAMESPACE::move(d.m_vect);
+ this->value_compare::operator=(boost::move(static_cast<value_compare &>(d)));
+ m_vect = boost::move(d.m_vect);
          return *this;
       }
 
@@ -143,7 +143,7 @@
    };
 
    Data m_data;
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(flat_tree)
+ BOOST_COPYABLE_AND_MOVABLE(flat_tree)
 
    public:
 
@@ -174,8 +174,8 @@
       : m_data(x.m_data, x.m_data.m_vect)
    { }
 
- flat_tree(BOOST_MOVE_MACRO_RV_REF(flat_tree) x)
- : m_data(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_data))
+ flat_tree(BOOST_RV_REF(flat_tree) x)
+ : m_data(boost::move(x.m_data))
    { }
 
    template <class InputIterator>
@@ -188,11 +188,11 @@
    ~flat_tree()
    { }
 
- flat_tree& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(flat_tree) x)
+ flat_tree& operator=(BOOST_COPY_ASSIGN_REF(flat_tree) x)
    { m_data = x.m_data; return *this; }
 
- flat_tree& operator=(BOOST_MOVE_MACRO_RV_REF(flat_tree) mx)
- { m_data = BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_data); return *this; }
+ flat_tree& operator=(BOOST_RV_REF(flat_tree) mx)
+ { m_data = boost::move(mx.m_data); return *this; }
 
    public:
    // accessors:
@@ -275,12 +275,12 @@
       return ret;
    }
 
- std::pair<iterator,bool> insert_unique(BOOST_MOVE_MACRO_RV_REF(value_type) val)
+ std::pair<iterator,bool> insert_unique(BOOST_RV_REF(value_type) val)
    {
       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_CONTAINER_MOVE_NAMESPACE::move(val));
+ ret.first = priv_insert_commit(data, boost::move(val));
       }
       return ret;
    }
@@ -293,10 +293,10 @@
       return i;
    }
 
- iterator insert_equal(BOOST_MOVE_MACRO_RV_REF(value_type) mval)
+ iterator insert_equal(BOOST_RV_REF(value_type) mval)
    {
       iterator i = this->upper_bound(KeyOfValue()(mval));
- i = this->m_data.m_vect.insert(i, BOOST_CONTAINER_MOVE_NAMESPACE::move(mval));
+ i = this->m_data.m_vect.insert(i, boost::move(mval));
       return i;
    }
 
@@ -310,12 +310,12 @@
       return ret.first;
    }
 
- iterator insert_unique(const_iterator pos, BOOST_MOVE_MACRO_RV_REF(value_type) mval)
+ iterator insert_unique(const_iterator pos, BOOST_RV_REF(value_type) mval)
    {
       insert_commit_data data;
       std::pair<iterator,bool> ret = priv_insert_unique_prepare(pos, mval, data);
       if(ret.second){
- ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(mval));
+ ret.first = priv_insert_commit(data, boost::move(mval));
       }
       return ret.first;
    }
@@ -327,11 +327,11 @@
       return priv_insert_commit(data, val);
    }
 
- iterator insert_equal(const_iterator pos, BOOST_MOVE_MACRO_RV_REF(value_type) mval)
+ iterator insert_equal(const_iterator pos, BOOST_RV_REF(value_type) mval)
    {
       insert_commit_data data;
       priv_insert_equal_prepare(pos, mval, data);
- return priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(mval));
+ return priv_insert_commit(data, boost::move(mval));
    }
 
    template <class InIt>
@@ -354,12 +354,12 @@
    template <class... Args>
    iterator emplace_unique(Args&&... args)
    {
- value_type && val = value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ value_type && val = value_type(boost::forward<Args>(args)...);
       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_CONTAINER_MOVE_NAMESPACE::move(val));
+ ret.first = priv_insert_commit(data, boost::move(val));
       }
       return ret.first;
    }
@@ -367,11 +367,11 @@
    template <class... Args>
    iterator emplace_hint_unique(const_iterator hint, Args&&... args)
    {
- value_type && val = value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ value_type && val = value_type(boost::forward<Args>(args)...);
       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_CONTAINER_MOVE_NAMESPACE::move(val));
+ ret.first = priv_insert_commit(data, boost::move(val));
       }
       return ret.first;
    }
@@ -379,19 +379,19 @@
    template <class... Args>
    iterator emplace_equal(Args&&... args)
    {
- value_type &&val = value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ value_type &&val = value_type(boost::forward<Args>(args)...);
       iterator i = this->upper_bound(KeyOfValue()(val));
- i = this->m_data.m_vect.insert(i, BOOST_CONTAINER_MOVE_NAMESPACE::move(val));
+ i = this->m_data.m_vect.insert(i, boost::move(val));
       return i;
    }
 
    template <class... Args>
    iterator emplace_hint_equal(const_iterator hint, Args&&... args)
    {
- value_type &&val = value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ value_type &&val = value_type(boost::forward<Args>(args)...);
       insert_commit_data data;
       priv_insert_equal_prepare(hint, val, data);
- return priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(val));
+ return priv_insert_commit(data, boost::move(val));
    }
 
    #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
@@ -404,7 +404,7 @@
       std::pair<iterator,bool> ret =
          priv_insert_unique_prepare(val, data);
       if(ret.second){
- ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(val));
+ ret.first = priv_insert_commit(data, boost::move(val));
       }
       return ret.first;
    }
@@ -416,7 +416,7 @@
       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_CONTAINER_MOVE_NAMESPACE::move(val));
+ ret.first = priv_insert_commit(data, boost::move(val));
       }
       return ret.first;
    }
@@ -426,7 +426,7 @@
       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_CONTAINER_MOVE_NAMESPACE::move(val));
+ i = this->m_data.m_vect.insert(i, boost::move(val));
       return i;
    }
 
@@ -436,7 +436,7 @@
       value_type &val = vval.m_t;
       insert_commit_data data;
       priv_insert_equal_prepare(hint, val, data);
- return priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(val));
+ return priv_insert_commit(data, boost::move(val));
    }
 
    #define BOOST_PP_LOCAL_MACRO(n) \
@@ -447,7 +447,7 @@
       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_CONTAINER_MOVE_NAMESPACE::move(val)); \
+ ret.first = priv_insert_commit(data, boost::move(val)); \
       } \
       return ret.first; \
    } \
@@ -460,7 +460,7 @@
       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_CONTAINER_MOVE_NAMESPACE::move(val)); \
+ ret.first = priv_insert_commit(data, boost::move(val)); \
       } \
       return ret.first; \
    } \
@@ -470,7 +470,7 @@
    { \
       value_type val(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
       iterator i = this->upper_bound(KeyOfValue()(val)); \
- i = this->m_data.m_vect.insert(i, BOOST_CONTAINER_MOVE_NAMESPACE::move(val)); \
+ i = this->m_data.m_vect.insert(i, boost::move(val)); \
       return i; \
    } \
                                                                                           \
@@ -481,7 +481,7 @@
       value_type val(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
       insert_commit_data data; \
       priv_insert_equal_prepare(hint, val, data); \
- return priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(val)); \
+ return priv_insert_commit(data, boost::move(val)); \
    } \
    //!
    #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
@@ -677,11 +677,11 @@
 
    template<class Convertible>
    iterator priv_insert_commit
- (insert_commit_data &commit_data, BOOST_MOVE_MACRO_FWD_REF(Convertible) convertible)
+ (insert_commit_data &commit_data, BOOST_FWD_REF(Convertible) convertible)
    {
       return this->m_data.m_vect.insert
          ( commit_data.position
- , BOOST_CONTAINER_MOVE_NAMESPACE::forward<Convertible>(convertible));
+ , boost::forward<Convertible>(convertible));
    }
 
    template <class RanIt>

Modified: branches/release/boost/interprocess/containers/container/detail/iterators.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/iterators.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/iterators.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -20,7 +20,7 @@
 
 #include "config_begin.hpp"
 #include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
 
 #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
 #include INCLUDE_BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
@@ -368,14 +368,15 @@
    { return m_num - other.m_num; }
 };
 
-template <class T, class E>
+template <class T, class E, class Difference /*= std::ptrdiff_t*/>
 class emplace_iterator
   : public std::iterator
- <std::random_access_iterator_tag, T, std::ptrdiff_t, const T*, const T &>
+ <std::random_access_iterator_tag, T, Difference, const T*, const T &>
 {
    typedef emplace_iterator this_type;
 
    public:
+ typedef Difference difference_type;
    explicit emplace_iterator(E&e)
       : m_num(1), m_pe(&e){}
 
@@ -420,33 +421,33 @@
    friend bool operator>= (const this_type& i, const this_type& i2)
    { return !(i < i2); }
 
- friend std::ptrdiff_t operator- (const this_type& i, const this_type& i2)
+ friend difference_type operator- (const this_type& i, const this_type& i2)
    { return i2.distance_to(i); }
 
    //Arithmetic
- this_type& operator+=(std::ptrdiff_t off)
+ this_type& operator+=(difference_type off)
    { this->advance(off); return *this; }
 
- this_type operator+(std::ptrdiff_t off) const
+ this_type operator+(difference_type off) const
    {
       this_type other(*this);
       other.advance(off);
       return other;
    }
 
- friend this_type operator+(std::ptrdiff_t off, const this_type& right)
+ friend this_type operator+(difference_type off, const this_type& right)
    { return right + off; }
 
- this_type& operator-=(std::ptrdiff_t off)
+ this_type& operator-=(difference_type off)
    { this->advance(-off); return *this; }
 
- this_type operator-(std::ptrdiff_t off) const
+ this_type operator-(difference_type off) const
    { return *this + (-off); }
 
    const T& operator*() const
    { return dereference(); }
 
- const T& operator[](std::ptrdiff_t) const
+ const T& operator[](difference_type) const
    { return dereference(); }
 
    const T* operator->() const
@@ -456,7 +457,7 @@
    { (*m_pe)(ptr); }
 
    private:
- std::ptrdiff_t m_num;
+ difference_type m_num;
    E * m_pe;
 
    void increment()
@@ -477,11 +478,11 @@
       return dummy;
    }
 
- void advance(std::ptrdiff_t n)
+ void advance(difference_type n)
    { m_num -= n; }
 
- std::ptrdiff_t distance_to(const this_type &other)const
- { return m_num - other.m_num; }
+ difference_type distance_to(const this_type &other)const
+ { return difference_type(m_num - other.m_num); }
 };
 
 #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING

Modified: branches/release/boost/interprocess/containers/container/detail/math_functions.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/math_functions.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/math_functions.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -16,6 +16,7 @@
 #ifndef BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP
 #define BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP
 
+#include "config_begin.hpp"
 #include <climits>
 #include <boost/static_assert.hpp>
 
@@ -107,4 +108,6 @@
 } // namespace container
 } // namespace boost
 
+#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP
+
 #endif

Modified: branches/release/boost/interprocess/containers/container/detail/mpl.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/mpl.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/mpl.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -62,6 +62,9 @@
 template <class Cond, class T = void>
 struct disable_if : public enable_if_c<!Cond::value, T> {};
 
+template <bool B, class T = void>
+struct disable_if_c : public enable_if_c<!B, T> {};
+
 template <class T, class U>
 class is_convertible
 {

Modified: branches/release/boost/interprocess/containers/container/detail/multiallocation_chain.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/multiallocation_chain.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/multiallocation_chain.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -18,7 +18,8 @@
 #include INCLUDE_BOOST_CONTAINER_DETAIL_TRANSFORM_ITERATOR_HPP
 #include <boost/intrusive/slist.hpp>
 #include <boost/pointer_to_other.hpp>
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/type_traits/make_unsigned.hpp>
+#include <boost/move/move.hpp>
 
 namespace boost {
 namespace container {
@@ -32,34 +33,39 @@
                         ,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 bi::slist< node
                     , bi::linear<true>
                     , bi::cache_last<true>
+ , bi::size_type<typename boost::make_unsigned<difference_type>::type>
> slist_impl_t;
    slist_impl_t slist_impl_;
 
    static node & to_node(VoidPointer p)
    { return *static_cast<node*>(static_cast<void*>(containers_detail::get_pointer(p))); }
 
- BOOST_MOVE_MACRO_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain)
 
    public:
 
 
    typedef VoidPointer void_pointer;
    typedef typename slist_impl_t::iterator iterator;
+ typedef typename slist_impl_t::size_type size_type;
 
    basic_multiallocation_chain()
       : slist_impl_()
    {}
 
- basic_multiallocation_chain(BOOST_MOVE_MACRO_RV_REF(basic_multiallocation_chain) other)
+ basic_multiallocation_chain(BOOST_RV_REF(basic_multiallocation_chain) other)
       : slist_impl_()
    { slist_impl_.swap(other.slist_impl_); }
 
- basic_multiallocation_chain& operator=(BOOST_MOVE_MACRO_RV_REF(basic_multiallocation_chain) other)
+ basic_multiallocation_chain& operator=(BOOST_RV_REF(basic_multiallocation_chain) other)
    {
- basic_multiallocation_chain tmp(BOOST_CONTAINER_MOVE_NAMESPACE::move(other));
+ basic_multiallocation_chain tmp(boost::move(other));
       this->swap(tmp);
       return *this;
    }
@@ -67,7 +73,7 @@
    bool empty() const
    { return slist_impl_.empty(); }
 
- std::size_t size() const
+ size_type size() const
    { return slist_impl_.size(); }
 
    iterator before_begin()
@@ -103,7 +109,7 @@
    void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_begin, iterator before_end)
    { slist_impl_.splice_after(after_this, x.slist_impl_, before_begin, before_end); }
 
- void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_begin, iterator before_end, std::size_t n)
+ void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_begin, iterator before_end, size_type n)
    { slist_impl_.splice_after(after_this, x.slist_impl_, before_begin, before_end, n); }
 
    void splice_after(iterator after_this, basic_multiallocation_chain &x)
@@ -112,7 +118,7 @@
    void incorporate_after(iterator after_this, void_pointer begin , iterator before_end)
    { slist_impl_.incorporate_after(after_this, &to_node(begin), &to_node(before_end)); }
 
- void incorporate_after(iterator after_this, void_pointer begin, void_pointer before_end, std::size_t n)
+ void incorporate_after(iterator after_this, void_pointer begin, void_pointer before_end, size_type n)
    { slist_impl_.incorporate_after(after_this, &to_node(begin), &to_node(before_end), n); }
 
    void swap(basic_multiallocation_chain &x)
@@ -144,7 +150,7 @@
 class transform_multiallocation_chain
 {
    private:
- BOOST_MOVE_MACRO_MOVABLE_BUT_NOT_COPYABLE(transform_multiallocation_chain)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(transform_multiallocation_chain)
 
    MultiallocationChain holder_;
    typedef typename MultiallocationChain::void_pointer void_pointer;
@@ -160,22 +166,23 @@
    typedef transform_iterator
       < typename MultiallocationChain::iterator
       , containers_detail::cast_functor <T> > iterator;
+ typedef typename MultiallocationChain::size_type size_type;
 
    transform_multiallocation_chain()
       : holder_()
    {}
 
- transform_multiallocation_chain(BOOST_MOVE_MACRO_RV_REF(transform_multiallocation_chain) other)
+ transform_multiallocation_chain(BOOST_RV_REF(transform_multiallocation_chain) other)
       : holder_()
    { this->swap(other); }
 
- transform_multiallocation_chain(BOOST_MOVE_MACRO_RV_REF(MultiallocationChain) other)
- : holder_(BOOST_CONTAINER_MOVE_NAMESPACE::move(other))
+ transform_multiallocation_chain(BOOST_RV_REF(MultiallocationChain) other)
+ : holder_(boost::move(other))
    {}
 
- transform_multiallocation_chain& operator=(BOOST_MOVE_MACRO_RV_REF(transform_multiallocation_chain) other)
+ transform_multiallocation_chain& operator=(BOOST_RV_REF(transform_multiallocation_chain) other)
    {
- transform_multiallocation_chain tmp(BOOST_CONTAINER_MOVE_NAMESPACE::move(other));
+ transform_multiallocation_chain tmp(boost::move(other));
       this->swap(tmp);
       return *this;
    }
@@ -186,10 +193,10 @@
    void swap(transform_multiallocation_chain &other_chain)
    { holder_.swap(other_chain.holder_); }
 
- void splice_after(iterator after_this, transform_multiallocation_chain &x, iterator before_begin, iterator before_end, std::size_t n)
+ void splice_after(iterator after_this, transform_multiallocation_chain &x, iterator before_begin, iterator before_end, size_type n)
    { holder_.splice_after(after_this.base(), x.holder_, before_begin.base(), before_end.base(), n); }
 
- void incorporate_after(iterator after_this, void_pointer begin, void_pointer before_end, std::size_t n)
+ void incorporate_after(iterator after_this, void_pointer begin, void_pointer before_end, size_type n)
    { holder_.incorporate_after(after_this.base(), begin, before_end, n); }
 
    void pop_front()
@@ -213,7 +220,7 @@
    iterator last()
    { return iterator(holder_.last()); }
 
- std::size_t size() const
+ size_type size() const
    { return holder_.size(); }
 
    void clear()
@@ -230,7 +237,7 @@
 
    MultiallocationChain extract_multiallocation_chain()
    {
- return MultiallocationChain(BOOST_CONTAINER_MOVE_NAMESPACE::move(holder_));
+ return MultiallocationChain(boost::move(holder_));
    }
 };
 

Modified: branches/release/boost/interprocess/containers/container/detail/node_alloc_holder.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/node_alloc_holder.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/node_alloc_holder.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -21,7 +21,7 @@
 #include <utility>
 #include <functional>
 
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
 #include <boost/intrusive/options.hpp>
 
 #include INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
@@ -60,7 +60,7 @@
    void priv_deallocate(allocator_v2)
    { m_alloc.deallocate_one(m_ptr); }
 
- BOOST_MOVE_MACRO_MOVABLE_BUT_NOT_COPYABLE(scoped_deallocator)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(scoped_deallocator)
 
    public:
 
@@ -74,7 +74,7 @@
    ~scoped_deallocator()
    { if (m_ptr)priv_deallocate(alloc_version()); }
 
- scoped_deallocator(BOOST_MOVE_MACRO_RV_REF(scoped_deallocator) o)
+ scoped_deallocator(BOOST_RV_REF(scoped_deallocator) o)
       : m_ptr(o.m_ptr), m_alloc(o.m_alloc)
    { o.release(); }
 
@@ -128,7 +128,7 @@
    ~allocator_multialloc_chain_node_deallocator()
    {
       if(!c_.empty())
- a_.deallocate_individual(BOOST_CONTAINER_MOVE_NAMESPACE::move(c_));
+ a_.deallocate_individual(boost::move(c_));
    }
 };
 
@@ -177,7 +177,7 @@
    typedef allocator_destroyer<NodeAlloc> Destroyer;
 
    private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(node_alloc_holder)
+ BOOST_COPYABLE_AND_MOVABLE(node_alloc_holder)
 
    public:
 
@@ -189,14 +189,14 @@
       : members_(other.node_alloc())
    {}
 
- node_alloc_holder(BOOST_MOVE_MACRO_RV_REF(node_alloc_holder) other)
- : members_(BOOST_CONTAINER_MOVE_NAMESPACE::move(other.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_MOVE_MACRO_COPY_ASSIGN_REF(node_alloc_holder) other)
+ node_alloc_holder & operator=(BOOST_COPY_ASSIGN_REF(node_alloc_holder) other)
    { members_.assign(other.node_alloc()); }
 
- node_alloc_holder & operator=(BOOST_MOVE_MACRO_RV_REF(node_alloc_holder) other)
+ node_alloc_holder & operator=(BOOST_RV_REF(node_alloc_holder) other)
    { members_.assign(other.node_alloc()); }
 
    template<class Pred>
@@ -205,7 +205,7 @@
    {}
 
    template<class Pred>
- node_alloc_holder(BOOST_MOVE_MACRO_RV_REF(ValAlloc) a, const Pred &c)
+ node_alloc_holder(BOOST_RV_REF(ValAlloc) a, const Pred &c)
       : members_(a, typename ICont::value_compare(c))
    {}
 
@@ -240,7 +240,7 @@
 
    template<class Convertible1, class Convertible2>
    static void construct(const NodePtr &ptr,
- BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(std::pair, Convertible1, Convertible2) value)
+ 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;
@@ -251,9 +251,9 @@
       new(static_cast<hook_type*>(nodeptr))hook_type();
       //Now construct pair members_holder
       value_type *valueptr = &nodeptr->get_data();
- new((void*)&valueptr->first) first_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(value.first));
+ new((void*)&valueptr->first) first_type(boost::move(value.first));
       BOOST_TRY{
- new((void*)&valueptr->second) second_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(value.second));
+ new((void*)&valueptr->second) second_type(boost::move(value.second));
       }
       BOOST_CATCH(...){
          valueptr->first.~first_type();
@@ -275,14 +275,14 @@
 
    template<class ...Args>
    static void construct(const NodePtr &ptr, Args &&...args)
- { new((void*)containers_detail::get_pointer(ptr)) Node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<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_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ self_t::construct(p, boost::forward<Args>(args)...);
       node_deallocator.release();
       return (p);
    }
@@ -383,7 +383,7 @@
             if(constructed){
                this->destroy(p);
             }
- this->node_alloc().deallocate_individual(BOOST_CONTAINER_MOVE_NAMESPACE::move(mem));
+ this->node_alloc().deallocate_individual(boost::move(mem));
             BOOST_RETHROW
          }
          BOOST_CATCH_END
@@ -399,9 +399,9 @@
       typename NodeAlloc::multiallocation_chain chain;
       allocator_destroyer_and_chain_builder<NodeAlloc> builder(this->node_alloc(), chain);
       this->icont().clear_and_dispose(builder);
- BOOST_STATIC_ASSERT((::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<typename NodeAlloc::multiallocation_chain>::value == true));
+ //BOOST_STATIC_ASSERT((::boost::has_move_emulation_enabled<typename NodeAlloc::multiallocation_chain>::value == true));
       if(!chain.empty())
- this->node_alloc().deallocate_individual(BOOST_CONTAINER_MOVE_NAMESPACE::move(chain));
+ this->node_alloc().deallocate_individual(boost::move(chain));
    }
 
    icont_iterator erase_range(icont_iterator first, icont_iterator last, allocator_v1)

Modified: branches/release/boost/interprocess/containers/container/detail/node_pool_impl.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/node_pool_impl.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/node_pool_impl.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -49,6 +49,7 @@
    typedef typename node_slist<void_pointer>::node_t node_t;
    typedef typename node_slist<void_pointer>::node_slist_t free_nodes_t;
    typedef typename SegmentManagerBase::multiallocation_chain multiallocation_chain;
+ typedef typename SegmentManagerBase::size_type size_type;
 
    private:
    typedef typename bi::make_slist
@@ -61,9 +62,9 @@
    typedef SegmentManagerBase segment_manager_base_type;
 
    //!Constructor from a segment manager. Never throws
- private_node_pool_impl(segment_manager_base_type *segment_mngr_base, std::size_t node_size, std::size_t nodes_per_block)
+ private_node_pool_impl(segment_manager_base_type *segment_mngr_base, size_type node_size, size_type nodes_per_block)
    : m_nodes_per_block(nodes_per_block)
- , m_real_node_size(lcm(node_size, std::size_t(alignment_of<node_t>::value)))
+ , m_real_node_size(lcm(node_size, size_type(alignment_of<node_t>::value)))
       //General purpose allocator
    , mp_segment_mngr_base(segment_mngr_base)
    , m_blocklist()
@@ -76,7 +77,7 @@
    ~private_node_pool_impl()
    { this->purge_blocks(); }
 
- std::size_t get_real_num_node() const
+ size_type get_real_num_node() const
    { return m_nodes_per_block; }
 
    //!Returns the segment manager. Never throws
@@ -91,10 +92,10 @@
    { priv_dealloc_node(ptr); }
 
    //!Allocates a singly linked list of n nodes ending in null pointer.
- multiallocation_chain allocate_nodes(const std::size_t n)
+ multiallocation_chain allocate_nodes(const size_type n)
    {
       //Preallocate all needed blocks to fulfill the request
- std::size_t cur_nodes = m_freelist.size();
+ size_type cur_nodes = m_freelist.size();
       if(cur_nodes < n){
          priv_alloc_block(((n - cur_nodes) - 1)/m_nodes_per_block + 1);
       }
@@ -102,7 +103,7 @@
       //We just iterate the needed nodes to get the last we'll erase
       typedef typename free_nodes_t::iterator free_iterator;
       free_iterator before_last_new_it = m_freelist.before_begin();
- for(std::size_t j = 0; j != n; ++j){
+ for(size_type j = 0; j != n; ++j){
          ++before_last_new_it;
       }
 
@@ -120,7 +121,7 @@
       multiallocation_chain chain;
       chain.incorporate_after(chain.before_begin(), &*first_node, &*last_node, n);
       m_allocated += n;
- return BOOST_CONTAINER_MOVE_NAMESPACE::move(chain);
+ return boost::move(chain);
    }
 
    void deallocate_nodes(multiallocation_chain chain)
@@ -145,8 +146,8 @@
       nodelist_iterator backup_list_last = backup_list.before_begin();
 
       //Execute the algorithm and get an iterator to the last value
- std::size_t blocksize = get_rounded_size
- (m_real_node_size*m_nodes_per_block, alignment_of<node_t>::value);
+ size_type blocksize = get_rounded_size
+ (m_real_node_size*m_nodes_per_block, (size_type) alignment_of<node_t>::value);
 
       while(it != itend){
          //Collect all the nodes from the block pointed by it
@@ -196,7 +197,7 @@
          , backup_list.size());
    }
 
- std::size_t num_free_nodes()
+ size_type num_free_nodes()
    { return m_freelist.size(); }
 
    //!Deallocates all used memory. Precondition: all nodes allocated from this pool should
@@ -205,8 +206,8 @@
    {
       //check for memory leaks
       BOOST_ASSERT(m_allocated==0);
- std::size_t blocksize = get_rounded_size
- (m_real_node_size*m_nodes_per_block, alignment_of<node_t>::value);
+ size_type blocksize = get_rounded_size
+ (m_real_node_size*m_nodes_per_block, (size_type)alignment_of<node_t>::value);
       typename blockslist_t::iterator
          it(m_blocklist.begin()), itend(m_blocklist.end()), aux;
 
@@ -294,15 +295,15 @@
    }
 
    //!Allocates several blocks of nodes. Can throw
- void priv_alloc_block(std::size_t num_blocks = 1)
+ void priv_alloc_block(size_type num_blocks = 1)
    {
       if(!num_blocks)
          return;
- std::size_t blocksize =
- get_rounded_size(m_real_node_size*m_nodes_per_block, alignment_of<node_t>::value);
+ size_type blocksize =
+ get_rounded_size(m_real_node_size*m_nodes_per_block, (size_type)alignment_of<node_t>::value);
 
       try{
- for(std::size_t i = 0; i != num_blocks; ++i){
+ for(size_type i = 0; i != num_blocks; ++i){
             //We allocate a new NodeBlock and put it as first
             //element in the free Node list
             char *pNode = reinterpret_cast<char*>
@@ -312,7 +313,7 @@
 
             //We initialize all Nodes in Node Block to insert
             //them in the free Node list
- for(std::size_t i = 0; i < m_nodes_per_block; ++i, pNode += m_real_node_size){
+ for(size_type i = 0; i < m_nodes_per_block; ++i, pNode += m_real_node_size){
                m_freelist.push_front(*new (pNode) node_t);
             }
          }
@@ -333,13 +334,13 @@
 
    private:
    //!Returns a reference to the block hook placed in the end of the block
- static node_t & get_block_hook (void *block, std::size_t blocksize)
+ static node_t & get_block_hook (void *block, size_type blocksize)
    {
       return *reinterpret_cast<node_t*>(reinterpret_cast<char*>(block) + blocksize);
    }
 
    //!Returns the starting address of the block reference to the block hook placed in the end of the block
- void *get_block_from_hook (node_t *hook, std::size_t blocksize)
+ void *get_block_from_hook (node_t *hook, size_type blocksize)
    {
       return (reinterpret_cast<char*>(hook) - blocksize);
    }
@@ -348,12 +349,12 @@
    typedef typename boost::pointer_to_other
       <void_pointer, segment_manager_base_type>::type segment_mngr_base_ptr_t;
 
- const std::size_t m_nodes_per_block;
- const std::size_t m_real_node_size;
+ const size_type m_nodes_per_block;
+ const size_type m_real_node_size;
    segment_mngr_base_ptr_t mp_segment_mngr_base; //Segment manager
    blockslist_t m_blocklist; //Intrusive container of blocks
    free_nodes_t m_freelist; //Intrusive container of free nods
- std::size_t m_allocated; //Used nodes for debugging
+ size_type m_allocated; //Used nodes for debugging
 };
 
 

Modified: branches/release/boost/interprocess/containers/container/detail/pair.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/pair.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/pair.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -25,7 +25,8 @@
 
 #include <utility> //std::pair
 
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
+#include <boost/type_traits/is_class.hpp>
 
 #ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
 #include INCLUDE_BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP
@@ -36,10 +37,36 @@
 namespace containers_detail {
 
 template <class T1, class T2>
+struct pair;
+
+template <class T>
+struct is_pair
+{
+ static const bool value = false;
+};
+
+template <class T1, class T2>
+struct is_pair< pair<T1, T2> >
+{
+ static const bool value = true;
+};
+
+template <class T1, class T2>
+struct is_pair< std::pair<T1, T2> >
+{
+ static const bool value = true;
+};
+
+struct pair_nat;
+
+struct piecewise_construct_t { };
+static const piecewise_construct_t piecewise_construct = piecewise_construct_t();
+
+template <class T1, class T2>
 struct pair
 {
    private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(pair)
+ BOOST_COPYABLE_AND_MOVABLE(pair)
 
    public:
    typedef T1 first_type;
@@ -48,109 +75,173 @@
    T1 first;
    T2 second;
 
- //std::pair compatibility
- template <class D, class S>
- pair(const std::pair<D, S>& p)
- : first(p.first), second(p.second)
+ //Default constructor
+ pair()
+ : first(), second()
    {}
+/*
+ //pair from two values
+ pair(const T1 &t1, const T2 &t2)
+ : first(t1)
+ , second(t2)
+ {}
+
 
- //To resolve ambiguity with the variadic constructor of 1 argument
- //and the previous constructor
- pair(std::pair<T1, T2>& x)
+ //pair from two values
+ pair(BOOST_RV_REF(T1) t1, BOOST_RV_REF(T2) t2)
+ : first(::boost::move(t1))
+ , second(::boost::move(t2))
+ {}
+*/
+ template<class U, class V>
+ pair(BOOST_FWD_REF(U) u, BOOST_FWD_REF(V) v)
+ : first(::boost::forward<U>(u))
+ , second(::boost::forward<V>(v))
+ {}
+
+ //pair copy assignment
+ pair(const pair& x)
       : first(x.first), second(x.second)
    {}
 
    template <class D, class S>
- pair(BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p)
- : first(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first)), second(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second))
+ pair(const pair<D, S> &p)
+ : first(p.first), second(p.second)
    {}
 
- pair()
- : first(), second()
+ //pair move constructor
+ pair(BOOST_RV_REF(pair) p)
+ : first(::boost::move(p.first)), second(::boost::move(p.second))
    {}
 
- pair(const pair<T1, T2>& x)
- : first(x.first), second(x.second)
+ template <class D, class S>
+ pair(BOOST_RV_REF_2_TEMPL_ARGS(pair, D, S) p)
+ : first(::boost::move(p.first)), second(::boost::move(p.second))
    {}
 
- //To resolve ambiguity with the variadic constructor of 1 argument
- //and the copy constructor
- pair(pair<T1, T2>& x)
+ //std::pair copy constructor
+ pair(const std::pair<T1, T2>& x)
       : first(x.first), second(x.second)
    {}
 
- pair(BOOST_MOVE_MACRO_RV_REF(pair) p)
- : first(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first)), second(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second))
+ template <class D, class S>
+ pair(const std::pair<D, S>& p)
+ : first(p.first), second(p.second)
    {}
 
+ //std::pair move constructor
    template <class D, class S>
- pair(BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(pair, D, S) p)
- : first(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first)), second(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second))
+ pair(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p)
+ : first(::boost::move(p.first)), second(::boost::move(p.second))
    {}
 
- #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ pair(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, T1, T2) p)
+ : first(::boost::move(p.first)), second(::boost::move(p.second))
+ {}
 
- template<class U, class ...Args>
- pair(U &&u, Args &&... args)
- : first(BOOST_CONTAINER_MOVE_NAMESPACE::forward<U>(u))
- , second(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)
+ //piecewise_construct missing
+/*
+ //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)
+ : first(::boost::forward<U>(u))
+ , second()
    {}
 
- #else
+ #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
 
- template<class U>
- pair( BOOST_CONTAINERS_PARAM(U, u)
- #ifdef BOOST_NO_RVALUE_REFERENCES
- , typename containers_detail::disable_if
- < containers_detail::is_same<U, ::BOOST_CONTAINER_MOVE_NAMESPACE::rv<pair> > >::type* = 0
- #endif
- )
- : first(BOOST_CONTAINER_MOVE_NAMESPACE::forward<U>(const_cast<U&>(u)))
+ template<class U, class V, class ...Args>
+ pair(U &&u, V &&v)
+ : first(::boost::forward<U>(u))
+ , second(::boost::forward<V>(v), ::boost::forward<Args>(args)...)
    {}
 
+ #else
+
    #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, _)) \
- : first(BOOST_CONTAINER_MOVE_NAMESPACE::forward<U>(const_cast<U&>(u))) \
+ : first(::boost::forward<U>(u)) \
       , second(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()
    #endif
+*/
+ //pair copy assignment
+ pair& operator=(BOOST_COPY_ASSIGN_REF(pair) p)
+ {
+ first = p.first;
+ second = p.second;
+ return *this;
+ }
 
- pair& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(pair) p)
+ template <class D, class S>
+ pair& operator=(const pair<D, S>&p)
    {
       first = p.first;
       second = p.second;
       return *this;
    }
 
- pair& operator=(BOOST_MOVE_MACRO_RV_REF(pair) p)
+ //pair move assignment
+ pair& operator=(BOOST_RV_REF(pair) p)
    {
- first = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first);
- second = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second);
+ first = ::boost::move(p.first);
+ second = ::boost::move(p.second);
       return *this;
    }
 
- pair& operator=(BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(std::pair, T1, T2) p)
+ template <class D, class S>
+ pair& operator=(BOOST_RV_REF_2_TEMPL_ARGS(pair, D, S) p)
    {
- first = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first);
- second = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second);
+ first = ::boost::move(p.first);
+ second = ::boost::move(p.second);
+ return *this;
+ }
+
+ //std::pair copy assignment
+ pair& operator=(const std::pair<T1, T2> &p)
+ {
+ first = p.first;
+ second = p.second;
       return *this;
    }
 
    template <class D, class S>
- pair& operator=(BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p)
+ pair& operator=(const std::pair<D, S> &p)
+ {
+ first = ::boost::move(p.first);
+ second = ::boost::move(p.second);
+ return *this;
+ }
+
+ //std::pair move assignment
+ pair& operator=(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, T1, T2) p)
    {
- first = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first);
- second = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second);
+ first = ::boost::move(p.first);
+ second = ::boost::move(p.second);
       return *this;
    }
 
+ template <class D, class S>
+ pair& operator=(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p)
+ {
+ first = ::boost::move(p.first);
+ second = ::boost::move(p.second);
+ return *this;
+ }
+
+ //swap
    void swap(pair& p)
- { std::swap(*this, p); }
+ {
+ using std::swap;
+ swap(this->first, p.first);
+ swap(this->second, p.second);
+ }
 };
 
 template <class T1, class T2>
@@ -205,6 +296,23 @@
    static const bool value = false;
 };
 
+//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> >
+ : 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> >
+ : ::boost::true_type
+{};
+
+#endif
+
+
 } //namespace boost {
 
 #include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP

Modified: branches/release/boost/interprocess/containers/container/detail/preprocessor.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/preprocessor.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/preprocessor.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -66,7 +66,7 @@
 #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
 
 #define BOOST_CONTAINERS_AUX_PARAM_INIT(z, n, data) \
- BOOST_PP_CAT(m_p, n) (BOOST_CONTAINER_MOVE_NAMESPACE::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \
+ BOOST_PP_CAT(m_p, n) (boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \
 //!
 
 #else
@@ -111,7 +111,7 @@
 #endif
 
 #define BOOST_CONTAINERS_PP_PARAM_FORWARD(z, n, data) \
-BOOST_CONTAINER_MOVE_NAMESPACE::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)
@@ -123,7 +123,7 @@
 #else
 
 #define BOOST_CONTAINERS_PP_MEMBER_FORWARD(z, n, data) \
-BOOST_CONTAINER_MOVE_NAMESPACE::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: branches/release/boost/interprocess/containers/container/detail/stored_ref.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/stored_ref.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/stored_ref.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -28,7 +28,7 @@
    #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
    { return t; }
    #else
- { return BOOST_CONTAINER_MOVE_NAMESPACE::move(t); }
+ { return boost::move(t); }
    #endif
 };
 
@@ -50,7 +50,7 @@
    #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
    { return t; }
    #else
- { return BOOST_CONTAINER_MOVE_NAMESPACE::move(t); }
+ { return boost::move(t); }
    #endif
 };
 

Modified: branches/release/boost/interprocess/containers/container/detail/tree.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/tree.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/tree.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -15,7 +15,7 @@
 #include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
 #include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP
 
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
 #include <boost/pointer_to_other.hpp>
 #include <boost/type_traits/has_trivial_destructor.hpp>
 #include <boost/detail/no_exceptions_support.hpp>
@@ -26,6 +26,7 @@
 #include INCLUDE_BOOST_CONTAINER_DETAIL_NODE_ALLOC_HOLDER_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_DESTROYERS_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_PAIR_HPP
+#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP
 #ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
 #include INCLUDE_BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP
 #endif
@@ -47,7 +48,7 @@
    typedef KeyOfValue key_of_value;
    typedef Key key_type;
 
- value_compare_impl(key_compare kcomp)
+ value_compare_impl(const key_compare &kcomp)
       : key_compare(kcomp)
    {}
 
@@ -57,9 +58,25 @@
    key_compare &key_comp()
    { return static_cast<key_compare &>(*this); }
 
- template<class A, class B>
- bool operator()(const A &a, const B &b) const
- { return key_compare::operator()(KeyOfValue()(a), KeyOfValue()(b)); }
+ template<class T>
+ struct is_key
+ {
+ static const bool value = is_same<const T, const key_type>::value;
+ };
+
+ template<class T>
+ typename enable_if_c<is_key<T>::value, const key_type &>::type
+ key_forward(const T &key) const
+ { return key; }
+
+ template<class T>
+ typename enable_if_c<!is_key<T>::value, const key_type &>::type
+ key_forward(const T &key) const
+ { return KeyOfValue()(key); }
+
+ template<class KeyType, class KeyType2>
+ bool operator()(const KeyType &key1, const KeyType2 &key2) const
+ { return key_compare::operator()(this->key_forward(key1), this->key_forward(key2)); }
 };
 
 template<class VoidPointer>
@@ -122,7 +139,7 @@
 
    template<class ...Args>
    rbtree_node(Args &&...args)
- : m_data(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)
+ : m_data(boost::forward<Args>(args)...)
    {}
    #endif//#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
 
@@ -164,8 +181,8 @@
 
    public:
    template<class Convertible>
- static void construct(node_type *ptr, BOOST_MOVE_MACRO_FWD_REF(Convertible) convertible)
- { new(ptr) node_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Convertible>(convertible)); }
+ static void construct(node_type *ptr, BOOST_FWD_REF(Convertible) convertible)
+ { new(ptr) node_type(boost::forward<Convertible>(convertible)); }
 };
 
 }//namespace containers_detail {
@@ -267,7 +284,7 @@
       AllocHolder &m_holder;
       Icont &m_icont;
    };
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(rbtree)
+ BOOST_COPYABLE_AND_MOVABLE(rbtree)
 
    public:
 
@@ -296,17 +313,29 @@
    struct key_node_compare
       : private KeyValueCompare
    {
- key_node_compare(KeyValueCompare comp)
+ key_node_compare(const KeyValueCompare &comp)
          : KeyValueCompare(comp)
       {}
-
- template<class KeyType>
- bool operator()(const Node &n, const KeyType &k) const
- { return KeyValueCompare::operator()(n.get_data(), k); }
-
- template<class KeyType>
- bool operator()(const KeyType &k, const Node &n) const
- { return KeyValueCompare::operator()(k, n.get_data()); }
+
+ template<class T>
+ struct is_node
+ {
+ static const bool value = is_same<T, Node>::value;
+ };
+
+ template<class T>
+ typename enable_if_c<is_node<T>::value, const value_type &>::type
+ key_forward(const T &node) const
+ { return node.get_data(); }
+
+ template<class T>
+ typename enable_if_c<!is_node<T>::value, const T &>::type
+ key_forward(const T &key) const
+ { return key; }
+
+ template<class KeyType, class KeyType2>
+ bool operator()(const KeyType &key1, const KeyType2 &key2) const
+ { return KeyValueCompare::operator()(this->key_forward(key1), this->key_forward(key2)); }
    };
 
    typedef key_node_compare<value_compare> KeyNodeCompare;
@@ -437,14 +466,14 @@
          (x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
    }
 
- rbtree(BOOST_MOVE_MACRO_RV_REF(rbtree) x)
+ rbtree(BOOST_RV_REF(rbtree) x)
       : AllocHolder(x, x.key_comp())
    { this->swap(x); }
 
    ~rbtree()
    {} //AllocHolder clears the tree
 
- rbtree& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(rbtree) x)
+ rbtree& operator=(BOOST_COPY_ASSIGN_REF(rbtree) x)
    {
       if (this != &x) {
          //Transfer all the nodes to a temporary tree
@@ -469,7 +498,7 @@
       return *this;
    }
 
- rbtree& operator=(BOOST_MOVE_MACRO_RV_REF(rbtree) mx)
+ rbtree& operator=(BOOST_RV_REF(rbtree) mx)
    { this->clear(); this->swap(mx); return *this; }
 
    public:
@@ -589,9 +618,9 @@
 
    template<class MovableConvertible>
    iterator insert_unique_commit
- (BOOST_MOVE_MACRO_FWD_REF(MovableConvertible) mv, insert_commit_data &data)
+ (BOOST_FWD_REF(MovableConvertible) mv, insert_commit_data &data)
    {
- NodePtr tmp = AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<MovableConvertible>(mv));
+ NodePtr tmp = AllocHolder::create_node(boost::forward<MovableConvertible>(mv));
       iiterator it(this->icont().insert_unique_commit(*tmp, data));
       return iterator(it);
    }
@@ -608,7 +637,7 @@
    }
 
    template<class MovableConvertible>
- std::pair<iterator,bool> insert_unique(BOOST_MOVE_MACRO_FWD_REF(MovableConvertible) mv)
+ std::pair<iterator,bool> insert_unique(BOOST_FWD_REF(MovableConvertible) mv)
    {
       insert_commit_data data;
       std::pair<iterator,bool> ret =
@@ -616,7 +645,7 @@
       if(!ret.second)
          return ret;
       return std::pair<iterator,bool>
- (this->insert_unique_commit(BOOST_CONTAINER_MOVE_NAMESPACE::forward<MovableConvertible>(mv), data), true);
+ (this->insert_unique_commit(boost::forward<MovableConvertible>(mv), data), true);
    }
 
    private:
@@ -652,23 +681,23 @@
 
    template <class... Args>
    iterator emplace_unique(Args&&... args)
- { return this->emplace_unique_impl(AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)); }
+ { return this->emplace_unique_impl(AllocHolder::create_node(boost::forward<Args>(args)...)); }
 
    template <class... Args>
    iterator emplace_hint_unique(const_iterator hint, Args&&... args)
- { return this->emplace_unique_hint_impl(hint, AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)); }
+ { return this->emplace_unique_hint_impl(hint, AllocHolder::create_node(boost::forward<Args>(args)...)); }
 
    template <class... Args>
    iterator emplace_equal(Args&&... args)
    {
- NodePtr p(AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...));
+ NodePtr p(AllocHolder::create_node(boost::forward<Args>(args)...));
       return iterator(this->icont().insert_equal(this->icont().end(), *p));
    }
 
    template <class... Args>
    iterator emplace_hint_equal(const_iterator hint, Args&&... args)
    {
- NodePtr p(AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...));
+ NodePtr p(AllocHolder::create_node(boost::forward<Args>(args)...));
       return iterator(this->icont().insert_equal(hint.get(), *p));
    }
 
@@ -737,14 +766,14 @@
    }
 
    template<class MovableConvertible>
- iterator insert_unique(const_iterator hint, BOOST_MOVE_MACRO_FWD_REF(MovableConvertible) mv)
+ iterator insert_unique(const_iterator hint, BOOST_FWD_REF(MovableConvertible) mv)
    {
       insert_commit_data data;
       std::pair<iterator,bool> ret =
          this->insert_unique_check(hint, KeyOfValue()(mv), data);
       if(!ret.second)
          return ret.first;
- return this->insert_unique_commit(BOOST_CONTAINER_MOVE_NAMESPACE::forward<MovableConvertible>(mv), data);
+ return this->insert_unique_commit(boost::forward<MovableConvertible>(mv), data);
    }
 
    template <class InputIterator>
@@ -770,9 +799,9 @@
    }
 
    template<class MovableConvertible>
- iterator insert_equal(BOOST_MOVE_MACRO_FWD_REF(MovableConvertible) mv)
+ iterator insert_equal(BOOST_FWD_REF(MovableConvertible) mv)
    {
- NodePtr p(AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<MovableConvertible>(mv)));
+ NodePtr p(AllocHolder::create_node(boost::forward<MovableConvertible>(mv)));
       return iterator(this->icont().insert_equal(this->icont().end(), *p));
    }
 
@@ -783,9 +812,9 @@
    }
 
    template<class MovableConvertible>
- iterator insert_equal(const_iterator hint, BOOST_MOVE_MACRO_FWD_REF(MovableConvertible) mv)
+ iterator insert_equal(const_iterator hint, BOOST_FWD_REF(MovableConvertible) mv)
    {
- NodePtr p(AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<MovableConvertible>(mv)));
+ NodePtr p(AllocHolder::create_node(boost::forward<MovableConvertible>(mv)));
       return iterator(this->icont().insert_equal(hint.get(), *p));
    }
 

Modified: branches/release/boost/interprocess/containers/container/detail/type_traits.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/type_traits.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/type_traits.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -21,6 +21,8 @@
 
 #include "config_begin.hpp"
 
+#include <boost/move/move.hpp>
+
 namespace boost {
 namespace container {
 namespace containers_detail {
@@ -81,6 +83,24 @@
    typedef T type;
 };
 
+#ifndef BOOST_NO_RVALUE_REFERENCES
+
+template<class T>
+struct remove_reference<T&&>
+{
+ typedef T type;
+};
+
+#else
+
+template<class T>
+struct remove_reference< ::boost::rv<T> >
+{
+ typedef T type;
+};
+
+#endif
+
 template<class T>
 struct is_reference
 {
@@ -156,11 +176,28 @@
    static const bool value = sizeof(yes_type) == sizeof(is_same_tester(t,u));
 };
 
+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_ref_const
+{
+ typedef typename remove_const< typename remove_reference<T>::type >::type type;
+};
+
 } // namespace containers_detail
 } //namespace container {
 } //namespace boost {
 
-#endif //#ifndef BOOST_CONTAINERS_CONTAINER_DETAIL_TYPE_TRAITS_HPP
-
 #include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP
 
+#endif //#ifndef BOOST_CONTAINERS_CONTAINER_DETAIL_TYPE_TRAITS_HPP

Modified: branches/release/boost/interprocess/containers/container/detail/utilities.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/utilities.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/utilities.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -17,7 +17,8 @@
 #include <boost/type_traits/is_pointer.hpp>
 #include <boost/type_traits/is_enum.hpp>
 #include <boost/type_traits/is_member_pointer.hpp>
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/type_traits/is_class.hpp>
+#include <boost/move/move.hpp>
 #include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP
 #include <algorithm>
@@ -87,7 +88,8 @@
 }
 
 //Rounds "orig_size" by excess to round_to bytes
-inline std::size_t get_rounded_size(std::size_t orig_size, std::size_t round_to)
+template<class SizeType>
+inline SizeType get_rounded_size(SizeType orig_size, SizeType round_to)
 {
    return ((orig_size-1)/round_to+1)*round_to;
 }
@@ -131,10 +133,10 @@
 template<class T>
 struct move_const_ref_type
    : if_c
- < ::boost::is_fundamental<T>::value || ::boost::is_pointer<T>::value ||
- ::boost::is_member_pointer<T>::value || ::boost::is_enum<T>::value
+// < ::boost::is_fundamental<T>::value || ::boost::is_pointer<T>::value || ::boost::is_member_pointer<T>::value || ::boost::is_enum<T>::value
+ < !::boost::is_class<T>::value
    ,const T &
- ,BOOST_MOVE_MACRO_CATCH_CONST_RLVALUE(T)
+ ,BOOST_CATCH_CONST_RLVALUE(T)
>
 {};
 

Modified: branches/release/boost/interprocess/containers/container/detail/version_type.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/version_type.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/version_type.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -21,7 +21,6 @@
 #include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP
 
-
 namespace boost{
 namespace container {
 namespace containers_detail {
@@ -88,4 +87,6 @@
 } //namespace container {
 } //namespace boost{
 
+#include "config_end.hpp"
+
 #endif //#define BOOST_CONTAINERS_DETAIL_VERSION_TYPE_HPP

Modified: branches/release/boost/interprocess/containers/container/detail/workaround.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/detail/workaround.hpp (original)
+++ branches/release/boost/interprocess/containers/container/detail/workaround.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 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 "config_begin.hpp"
 
 #if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)\
- && !defined(BOOST_MOVE_MACRO_DISABLE_VARIADIC_TMPL)
+ && !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL)
 #define BOOST_CONTAINERS_PERFECT_FORWARDING
 
 #endif

Modified: branches/release/boost/interprocess/containers/container/flat_map.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/flat_map.hpp (original)
+++ branches/release/boost/interprocess/containers/container/flat_map.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -26,7 +26,7 @@
 #include INCLUDE_BOOST_CONTAINER_DETAIL_FLAT_TREE_HPP
 #include <boost/type_traits/has_trivial_destructor.hpp>
 #include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
 
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
@@ -76,7 +76,7 @@
 {
    /// @cond
    private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(flat_map)
+ BOOST_COPYABLE_AND_MOVABLE(flat_map)
    //This is the tree that we should store if pair was movable
    typedef containers_detail::flat_tree<Key,
                            std::pair<Key, T>,
@@ -192,14 +192,14 @@
    //! <b>Complexity</b>: Construct.
    //!
    //! <b>Postcondition</b>: x is emptied.
- flat_map(BOOST_MOVE_MACRO_RV_REF(flat_map) x)
- : m_flat_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_flat_tree))
+ flat_map(BOOST_RV_REF(flat_map) x)
+ : m_flat_tree(boost::move(x.m_flat_tree))
    {}
 
    //! <b>Effects</b>: Makes *this a copy of x.
    //!
    //! <b>Complexity</b>: Linear in x.size().
- flat_map<Key,T,Pred,Alloc>& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(flat_map) x)
+ flat_map<Key,T,Pred,Alloc>& operator=(BOOST_COPY_ASSIGN_REF(flat_map) x)
    { m_flat_tree = x.m_flat_tree; return *this; }
 
    //! <b>Effects</b>: Move constructs a flat_map.
@@ -208,8 +208,8 @@
    //! <b>Complexity</b>: Construct.
    //!
    //! <b>Postcondition</b>: x is emptied.
- flat_map<Key,T,Pred,Alloc>& operator=(BOOST_MOVE_MACRO_RV_REF(flat_map) mx)
- { m_flat_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_flat_tree); return *this; }
+ flat_map<Key,T,Pred,Alloc>& operator=(BOOST_RV_REF(flat_map) mx)
+ { m_flat_tree = boost::move(mx.m_flat_tree); return *this; }
 
    //! <b>Effects</b>: Returns the comparison object out
    //! of which a was constructed.
@@ -385,13 +385,13 @@
    //! Returns: A reference to the mapped_type corresponding to x in *this.
    //!
    //! Complexity: Logarithmic.
- T &operator[](BOOST_MOVE_MACRO_RV_REF(key_type) mk)
+ 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_CONTAINER_MOVE_NAMESPACE::move(k), BOOST_CONTAINER_MOVE_NAMESPACE::move(T())));
+ i = insert(i, value_type(boost::move(k), boost::move(T())));
       return (*i).second;
    }
 
@@ -454,9 +454,9 @@
    //! to the elements with bigger keys than x.
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
- std::pair<iterator,bool> insert(BOOST_MOVE_MACRO_RV_REF(value_type) x)
+ std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
    { return force<std::pair<iterator,bool> >(
- m_flat_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(force<impl_value_type>(x)))); }
+ m_flat_tree.insert_unique(boost::move(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.
@@ -469,10 +469,10 @@
    //! to the elements with bigger keys than x.
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
- std::pair<iterator,bool> insert(BOOST_MOVE_MACRO_RV_REF(impl_value_type) x)
+ std::pair<iterator,bool> insert(BOOST_RV_REF(impl_value_type) x)
    {
       return force<std::pair<iterator,bool> >
- (m_flat_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)));
+ (m_flat_tree.insert_unique(boost::move(x)));
    }
 
    //! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
@@ -499,9 +499,9 @@
    //! right before p) plus insertion linear to the elements with bigger keys than x.
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) x)
+ 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_CONTAINER_MOVE_NAMESPACE::move(force<impl_value_type>(x)))); }
+ m_flat_tree.insert_unique(force<impl_const_iterator>(position), boost::move(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.
@@ -512,10 +512,10 @@
    //! right before p) plus insertion linear to the elements with bigger keys than x.
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(impl_value_type) x)
+ 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_CONTAINER_MOVE_NAMESPACE::move(x)));
+ m_flat_tree.insert_unique(force<impl_const_iterator>(position), boost::move(x)));
    }
 
    //! <b>Requires</b>: i, j are not iterators into *this.
@@ -547,7 +547,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_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)); }
+ { return 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
@@ -563,7 +563,7 @@
    //! <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_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)); }
+ { return force_copy<iterator>(m_flat_tree.emplace_hint_unique(force<impl_const_iterator>(hint), boost::forward<Args>(args)...)); }
 
    #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
 
@@ -818,7 +818,7 @@
 {
    /// @cond
    private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(flat_multimap)
+ BOOST_COPYABLE_AND_MOVABLE(flat_multimap)
    typedef containers_detail::flat_tree<Key,
                            std::pair<Key, T>,
                            containers_detail::select1st< std::pair<Key, T> >,
@@ -932,21 +932,21 @@
    //! <b>Complexity</b>: Construct.
    //!
    //! <b>Postcondition</b>: x is emptied.
- flat_multimap(BOOST_MOVE_MACRO_RV_REF(flat_multimap) x)
- : m_flat_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_flat_tree))
+ flat_multimap(BOOST_RV_REF(flat_multimap) x)
+ : m_flat_tree(boost::move(x.m_flat_tree))
    { }
 
    //! <b>Effects</b>: Makes *this a copy of x.
    //!
    //! <b>Complexity</b>: Linear in x.size().
- flat_multimap<Key,T,Pred,Alloc>& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(flat_multimap) x)
+ flat_multimap<Key,T,Pred,Alloc>& operator=(BOOST_COPY_ASSIGN_REF(flat_multimap) x)
       { m_flat_tree = x.m_flat_tree; return *this; }
 
    //! <b>Effects</b>: this->swap(x.get()).
    //!
    //! <b>Complexity</b>: Constant.
- flat_multimap<Key,T,Pred,Alloc>& operator=(BOOST_MOVE_MACRO_RV_REF(flat_multimap) mx)
- { m_flat_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_flat_tree); return *this; }
+ flat_multimap<Key,T,Pred,Alloc>& operator=(BOOST_RV_REF(flat_multimap) mx)
+ { m_flat_tree = boost::move(mx.m_flat_tree); return *this; }
 
    //! <b>Effects</b>: Returns the comparison object out
    //! of which a was constructed.
@@ -1093,8 +1093,8 @@
    //! to the elements with bigger keys than x.
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return force_copy<iterator>(m_flat_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x))); }
+ iterator insert(BOOST_RV_REF(value_type) x)
+ { return 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.
@@ -1103,8 +1103,8 @@
    //! to the elements with bigger keys than x.
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(BOOST_MOVE_MACRO_RV_REF(impl_value_type) x)
- { return force_copy<iterator>(m_flat_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x))); }
+ iterator insert(BOOST_RV_REF(impl_value_type) x)
+ { return 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.
@@ -1131,11 +1131,11 @@
    //! to the elements with bigger keys than x.
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) x)
+ 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)
- , BOOST_CONTAINER_MOVE_NAMESPACE::move(x)));
+ , boost::move(x)));
    }
 
    //! <b>Effects</b>: Inserts a value move constructed from x in the container.
@@ -1149,10 +1149,10 @@
    //! to the elements with bigger keys than x.
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(impl_value_type) x)
+ 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_CONTAINER_MOVE_NAMESPACE::move(x)));
+ m_flat_tree.insert_equal(force<impl_const_iterator>(position), boost::move(x)));
    }
 
    //! <b>Requires</b>: i, j are not iterators into *this.
@@ -1179,7 +1179,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_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)); }
+ { return 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.
@@ -1197,7 +1197,7 @@
    iterator emplace_hint(const_iterator hint, Args&&... args)
    {
       return force_copy<iterator>(m_flat_tree.emplace_hint_equal
- (force<impl_const_iterator>(hint), BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...));
+ (force<impl_const_iterator>(hint), boost::forward<Args>(args)...));
    }
 
    #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING

Modified: branches/release/boost/interprocess/containers/container/flat_set.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/flat_set.hpp (original)
+++ branches/release/boost/interprocess/containers/container/flat_set.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -24,7 +24,7 @@
 #include <memory>
 #include INCLUDE_BOOST_CONTAINER_DETAIL_FLAT_TREE_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
 
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
@@ -65,7 +65,7 @@
 {
    /// @cond
    private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(flat_set)
+ BOOST_COPYABLE_AND_MOVABLE(flat_set)
    typedef containers_detail::flat_tree<T, T, containers_detail::identity<T>, Pred, Alloc> tree_t;
    tree_t m_flat_tree; // flat tree representing flat_set
    typedef typename containers_detail::
@@ -139,21 +139,21 @@
    //! <b>Complexity</b>: Construct.
    //!
    //! <b>Postcondition</b>: x is emptied.
- flat_set(BOOST_MOVE_MACRO_RV_REF(flat_set) mx)
- : m_flat_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_flat_tree))
+ flat_set(BOOST_RV_REF(flat_set) mx)
+ : m_flat_tree(boost::move(mx.m_flat_tree))
    {}
 
    //! <b>Effects</b>: Makes *this a copy of x.
    //!
    //! <b>Complexity</b>: Linear in x.size().
- flat_set<T,Pred,Alloc>& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(flat_set) x)
+ flat_set<T,Pred,Alloc>& operator=(BOOST_COPY_ASSIGN_REF(flat_set) x)
       { m_flat_tree = x.m_flat_tree; return *this; }
 
    //! <b>Effects</b>: Makes *this a copy of x.
    //!
    //! <b>Complexity</b>: Linear in x.size().
- flat_set<T,Pred,Alloc>& operator=(BOOST_MOVE_MACRO_RV_REF(flat_set) mx)
- { m_flat_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_flat_tree); return *this; }
+ flat_set<T,Pred,Alloc>& operator=(BOOST_RV_REF(flat_set) mx)
+ { m_flat_tree = boost::move(mx.m_flat_tree); return *this; }
 
    //! <b>Effects</b>: Returns the comparison object out
    //! of which a was constructed.
@@ -336,7 +336,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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ 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)
    { return priv_insert(u); }
    #endif
 
@@ -351,8 +351,8 @@
    //! to the elements with bigger keys than x.
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
- std::pair<iterator,bool> insert(BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_flat_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
+ { return m_flat_tree.insert_unique(boost::move(x)); }
 
    //! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
    //! no element in the container with key equivalent to the key of x.
@@ -373,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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ 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)
    { return priv_insert(position, u); }
    #endif
 
@@ -386,8 +386,8 @@
    //! right before p) plus insertion linear to the elements with bigger keys than x.
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_flat_tree.insert_unique(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
+ { return m_flat_tree.insert_unique(position, boost::move(x)); }
 
    //! <b>Requires</b>: i, j are not iterators into *this.
    //!
@@ -418,7 +418,7 @@
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
    template <class... Args>
    iterator emplace(Args&&... args)
- { return m_flat_tree.emplace_unique(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return 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
@@ -434,7 +434,7 @@
    //! <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 m_flat_tree.emplace_hint_unique(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_flat_tree.emplace_hint_unique(hint, boost::forward<Args>(args)...); }
 
    #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
 
@@ -685,7 +685,7 @@
 {
    /// @cond
    private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(flat_multiset)
+ BOOST_COPYABLE_AND_MOVABLE(flat_multiset)
    typedef containers_detail::flat_tree<T, T, containers_detail::identity<T>, Pred, Alloc> tree_t;
    tree_t m_flat_tree; // flat tree representing flat_multiset
    typedef typename containers_detail::
@@ -740,15 +740,15 @@
    flat_multiset(const flat_multiset<T,Pred,Alloc>& x)
       : m_flat_tree(x.m_flat_tree) {}
 
- flat_multiset(BOOST_MOVE_MACRO_RV_REF(flat_multiset) x)
- : m_flat_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_flat_tree))
+ flat_multiset(BOOST_RV_REF(flat_multiset) x)
+ : m_flat_tree(boost::move(x.m_flat_tree))
    {}
 
- flat_multiset<T,Pred,Alloc>& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(flat_multiset) x)
+ flat_multiset<T,Pred,Alloc>& operator=(BOOST_COPY_ASSIGN_REF(flat_multiset) x)
       { m_flat_tree = x.m_flat_tree; return *this; }
 
- flat_multiset<T,Pred,Alloc>& operator=(BOOST_MOVE_MACRO_RV_REF(flat_multiset) mx)
- { m_flat_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_flat_tree); return *this; }
+ flat_multiset<T,Pred,Alloc>& operator=(BOOST_RV_REF(flat_multiset) mx)
+ { m_flat_tree = boost::move(mx.m_flat_tree); return *this; }
 
    //! <b>Effects</b>: Returns the comparison object out
    //! of which a was constructed.
@@ -927,7 +927,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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ 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)
    { return priv_insert(u); }
    #endif
 
@@ -938,8 +938,8 @@
    //! to the elements with bigger keys than x.
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_flat_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(BOOST_RV_REF(value_type) x)
+ { return 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.
@@ -959,7 +959,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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ 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)
    { return priv_insert(position, u); }
    #endif
 
@@ -973,8 +973,8 @@
    //! right before p) plus insertion linear to the elements with bigger keys than x.
    //!
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_flat_tree.insert_equal(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
+ { return m_flat_tree.insert_equal(position, boost::move(x)); }
 
    //! <b>Requires</b>: i, j are not iterators into *this.
    //!
@@ -1000,7 +1000,7 @@
    //! <b>Note</b>: If an element it's inserted it might invalidate elements.
    template <class... Args>
    iterator emplace(Args&&... args)
- { return m_flat_tree.emplace_equal(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return 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.
@@ -1015,7 +1015,7 @@
    //! <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 m_flat_tree.emplace_hint_equal(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_flat_tree.emplace_hint_equal(hint, boost::forward<Args>(args)...); }
 
    #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
 

Modified: branches/release/boost/interprocess/containers/container/list.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/list.hpp (original)
+++ branches/release/boost/interprocess/containers/container/list.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -18,7 +18,8 @@
 #include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
 #include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
+#include <boost/move/move_helpers.hpp>
 #include <boost/pointer_to_other.hpp>
 #include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP
@@ -72,7 +73,7 @@
 
    template<class ...Args>
    list_node(Args &&...args)
- : m_data(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)
+ : m_data(boost::forward<Args>(args)...)
    {}
 
    #else //#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
@@ -131,8 +132,6 @@
       <A, typename containers_detail::intrusive_list_type<A>::type>
 {
    /// @cond
- typedef typename containers_detail::
- move_const_ref_type<T>::type insert_const_ref_type;
    typedef typename
       containers_detail::intrusive_list_type<A>::type Icont;
    typedef list <T, A> ThisType;
@@ -198,7 +197,7 @@
 
    /// @cond
    private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(list)
+ BOOST_COPYABLE_AND_MOVABLE(list)
    typedef difference_type list_difference_type;
    typedef pointer list_pointer;
    typedef const_pointer list_const_pointer;
@@ -357,8 +356,8 @@
    //! <b>Throws</b>: If allocator_type's copy constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- list(BOOST_MOVE_MACRO_RV_REF(list) x)
- : AllocHolder(BOOST_CONTAINER_MOVE_NAMESPACE::move(static_cast<AllocHolder&>(x)))
+ list(BOOST_RV_REF(list) x)
+ : AllocHolder(boost::move(static_cast<AllocHolder&>(x)))
    {}
 
    //! <b>Effects</b>: Constructs a list that will use a copy of allocator a
@@ -530,56 +529,46 @@
    size_type max_size() const
    { return AllocHolder::max_size(); }
 
- //! <b>Effects</b>: Inserts a copy of t in the beginning of the list.
+
+ #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
+ //! <b>Effects</b>: Inserts a copy of x at the beginning of the list.
    //!
    //! <b>Throws</b>: If memory allocation throws or
    //! T's copy constructor throws.
    //!
    //! <b>Complexity</b>: Amortized constant time.
- void push_front(insert_const_ref_type x)
- { this->insert(this->cbegin(), x); }
-
- #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- 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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
- { this->insert(this->cbegin(), u); }
- #endif
+ void push_front(const T &x);
 
    //! <b>Effects</b>: Constructs a new element in the beginning of the list
- //! and moves the resources of t to this new element.
+ //! 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_front(BOOST_MOVE_MACRO_RV_REF(T) x)
- { this->insert(this->cbegin(), BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ void push_front(T &&x);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front)
+ #endif
 
- //! <b>Effects</b>: Removes the last element from the list.
+ #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
+ //! <b>Effects</b>: Inserts a copy of x at the end of the list.
    //!
- //! <b>Throws</b>: Nothing.
+ //! <b>Throws</b>: If memory allocation throws or
+ //! T's copy constructor throws.
    //!
    //! <b>Complexity</b>: Amortized constant time.
- void push_back (insert_const_ref_type x)
- { this->insert(this->cend(), x); }
-
- #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- 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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
- { this->insert(this->cend(), u); }
-
- #endif
+ void push_back(const T &x);
 
- //! <b>Effects</b>: Removes the first element from the list.
+ //! <b>Effects</b>: Constructs a new element in the end of the list
+ //! and moves the resources of mx to this new element.
    //!
- //! <b>Throws</b>: Nothing.
+ //! <b>Throws</b>: If memory allocation throws.
    //!
    //! <b>Complexity</b>: Amortized constant time.
- void push_back (BOOST_MOVE_MACRO_RV_REF(T) x)
- { this->insert(this->cend(), BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ void push_back(T &&x);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
+ #endif
 
    //! <b>Effects</b>: Removes the first element from the list.
    //!
@@ -716,7 +705,7 @@
    //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
    //!
    //! <b>Complexity</b>: Linear to the number of elements in x.
- ThisType& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(ThisType) x)
+ ThisType& operator=(BOOST_COPY_ASSIGN_REF(ThisType) x)
    {
       if (this != &x) {
          this->assign(x.begin(), x.end());
@@ -732,7 +721,7 @@
    //! <b>Throws</b>: If allocator_type's copy constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- ThisType& operator=(BOOST_MOVE_MACRO_RV_REF(ThisType) mx)
+ ThisType& operator=(BOOST_RV_REF(ThisType) mx)
    {
       this->clear();
       this->swap(mx);
@@ -760,41 +749,32 @@
    template <class InpIt>
    void insert(const_iterator p, InpIt first, InpIt last)
    {
- const bool aux_boolean = containers_detail::is_convertible<InpIt, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
       typedef containers_detail::bool_<aux_boolean> Result;
       this->priv_insert_dispatch(p, first, last, Result());
    }
 
- //! <b>Requires</b>: p must be a valid iterator of *this.
+ #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
+ //! <b>Requires</b>: position must be a valid iterator of *this.
    //!
- //! <b>Effects</b>: Insert a copy of x before p.
+ //! <b>Effects</b>: Insert a copy of x before position.
    //!
    //! <b>Throws</b>: If memory allocation throws or x's copy constructor throws.
    //!
    //! <b>Complexity</b>: Amortized constant time.
- iterator insert(const_iterator position, insert_const_ref_type x)
- { return this->priv_insert(position, x); }
-
- #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- iterator insert(const_iterator position, T &x) { return this->insert(position, const_cast<const T &>(x)); }
+ iterator insert(const_iterator position, 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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
- { return this->priv_insert(position, u); }
- #endif
-
- //! <b>Requires</b>: p must be a valid iterator of *this.
+ //! <b>Requires</b>: position must be a valid iterator of *this.
    //!
- //! <b>Effects</b>: Insert a new element before p with mx's resources.
+ //! <b>Effects</b>: Insert a new element before position with mx's resources.
    //!
    //! <b>Throws</b>: If memory allocation throws.
    //!
    //! <b>Complexity</b>: Amortized constant time.
- iterator insert(const_iterator p, BOOST_MOVE_MACRO_RV_REF(T) x)
- {
- NodePtr tmp = AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::move(x));
- return iterator(this->icont().insert(p.get(), *tmp));
- }
+ iterator insert(const_iterator position, T &&x);
+ #else
+ 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)
 
@@ -808,7 +788,7 @@
    template <class... Args>
    void emplace_back(Args&&... args)
    {
- this->emplace(this->cend(), BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ this->emplace(this->cend(), boost::forward<Args>(args)...);
    }
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
@@ -821,7 +801,7 @@
    template <class... Args>
    void emplace_front(Args&&... args)
    {
- this->emplace(this->cbegin(), BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ this->emplace(this->cbegin(), boost::forward<Args>(args)...);
    }
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
@@ -835,7 +815,7 @@
    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_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ 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));
@@ -923,7 +903,7 @@
    template <class InpIt>
    void assign(InpIt first, InpIt last)
    {
- const bool aux_boolean = containers_detail::is_convertible<InpIt, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
       typedef containers_detail::bool_<aux_boolean> Result;
       this->priv_assign_dispatch(first, last, Result());
    }
@@ -1166,6 +1146,24 @@
       return iterator(this->icont().insert(p.get(), *tmp));
    }
 
+ iterator priv_insert(const_iterator p, BOOST_RV_REF(T) x)
+ {
+ NodePtr tmp = AllocHolder::create_node(boost::move(x));
+ return iterator(this->icont().insert(p.get(), *tmp));
+ }
+
+ void priv_push_back (const T &x)
+ { this->insert(this->cend(), x); }
+
+ void priv_push_back (BOOST_RV_REF(T) x)
+ { this->insert(this->cend(), boost::move(x)); }
+
+ void priv_push_front (const T &x)
+ { this->insert(this->cbegin(), x); }
+
+ void priv_push_front (BOOST_RV_REF(T) x)
+ { this->insert(this->cbegin(), boost::move(x)); }
+
    //Iterator range version
    template<class InpIterator>
    void priv_create_and_insert_nodes

Modified: branches/release/boost/interprocess/containers/container/map.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/map.hpp (original)
+++ branches/release/boost/interprocess/containers/container/map.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -61,7 +61,9 @@
 #include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_PAIR_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP
+#include <boost/move/move.hpp>
+#include <boost/static_assert.hpp>
 
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
@@ -99,13 +101,17 @@
 {
    /// @cond
    private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(map)
+ BOOST_COPYABLE_AND_MOVABLE(map)
    typedef containers_detail::rbtree<Key,
                            std::pair<const Key, T>,
                            containers_detail::select1st< std::pair<const Key, T> >,
                            Pred,
                            Alloc> tree_t;
    tree_t m_tree; // red-black tree representing map
+
+ //Allocator type must be std::pair<CONST Key, T>
+ BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename Alloc::value_type>::value));
+
    /// @endcond
 
    public:
@@ -193,21 +199,21 @@
    //! <b>Complexity</b>: Construct.
    //!
    //! <b>Postcondition</b>: x is emptied.
- map(BOOST_MOVE_MACRO_RV_REF(map) x)
- : m_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree))
+ map(BOOST_RV_REF(map) x)
+ : m_tree(boost::move(x.m_tree))
    {}
 
    //! <b>Effects</b>: Makes *this a copy of x.
    //!
    //! <b>Complexity</b>: Linear in x.size().
- map& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(map) x)
+ map& operator=(BOOST_COPY_ASSIGN_REF(map) x)
    { m_tree = x.m_tree; return *this; }
 
    //! <b>Effects</b>: this->swap(x.get()).
    //!
    //! <b>Complexity</b>: Constant.
- map& operator=(BOOST_MOVE_MACRO_RV_REF(map) x)
- { m_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree); return *this; }
+ map& operator=(BOOST_RV_REF(map) x)
+ { m_tree = boost::move(x.m_tree); return *this; }
 
    //! <b>Effects</b>: Returns the comparison object out
    //! of which a was constructed.
@@ -341,27 +347,27 @@
       // 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_CONTAINER_MOVE_NAMESPACE::move(v.m_t));
- i = insert(i, BOOST_CONTAINER_MOVE_NAMESPACE::move(val));
+ value_type val(k, boost::move(v.m_t));
+ i = insert(i, boost::move(val));
       }
       return (*i).second;
    }
 
    //! Effects: If there is no key equivalent to x in the map, inserts
- //! value_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(x), T()) into the map (the key is move-constructed)
+ //! value_type(boost::move(x), T()) into the map (the key is move-constructed)
    //!
    //! Returns: A reference to the mapped_type corresponding to x in *this.
    //!
    //! Complexity: Logarithmic.
- T& operator[](BOOST_MOVE_MACRO_RV_REF(key_type) mk)
+ 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_CONTAINER_MOVE_NAMESPACE::move(k), BOOST_CONTAINER_MOVE_NAMESPACE::move(T()));
- i = insert(i, BOOST_CONTAINER_MOVE_NAMESPACE::move(val));
+ value_type val(boost::move(k), boost::move(T()));
+ i = insert(i, boost::move(val));
       }
       return (*i).second;
    }
@@ -429,8 +435,8 @@
    //! points to the element with key equivalent to the key of x.
    //!
    //! <b>Complexity</b>: Logarithmic.
- std::pair<iterator,bool> insert(BOOST_MOVE_MACRO_RV_REF(nonconst_value_type) x)
- { return m_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ std::pair<iterator,bool> insert(BOOST_RV_REF(nonconst_value_type) x)
+ { return m_tree.insert_unique(boost::move(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.
@@ -440,8 +446,8 @@
    //! points to the element with key equivalent to the key of x.
    //!
    //! <b>Complexity</b>: Logarithmic.
- std::pair<iterator,bool> insert(BOOST_MOVE_MACRO_RV_REF(nonconst_impl_value_type) x)
- { return m_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ std::pair<iterator,bool> insert(BOOST_RV_REF(nonconst_impl_value_type) x)
+ { return m_tree.insert_unique(boost::move(x)); }
 
    //! <b>Effects</b>: Move constructs a new value from x if and only if there is
    //! no element in the container with key equivalent to the key of x.
@@ -451,8 +457,8 @@
    //! points to the element with key equivalent to the key of x.
    //!
    //! <b>Complexity</b>: Logarithmic.
- std::pair<iterator,bool> insert(BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
+ { return m_tree.insert_unique(boost::move(x)); }
 
    //! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
    //! no element in the container with key equivalent to the key of x.
@@ -475,8 +481,8 @@
    //!
    //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
    //! is inserted right before p.
- iterator insert(iterator position, BOOST_MOVE_MACRO_RV_REF(nonconst_value_type) x)
- { return m_tree.insert_unique(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(iterator position, BOOST_RV_REF(nonconst_value_type) x)
+ { return m_tree.insert_unique(position, boost::move(x)); }
 
    //! <b>Effects</b>: Move constructs a new value from x if and only if there is
    //! no element in the container with key equivalent to the key of x.
@@ -487,8 +493,8 @@
    //!
    //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
    //! is inserted right before p.
- iterator insert(iterator position, BOOST_MOVE_MACRO_RV_REF(nonconst_impl_value_type) x)
- { return m_tree.insert_unique(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(iterator position, BOOST_RV_REF(nonconst_impl_value_type) x)
+ { return m_tree.insert_unique(position, 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.
@@ -505,8 +511,8 @@
    //! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x.
    //!
    //! <b>Complexity</b>: Logarithmic.
- iterator insert(iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_tree.insert_unique(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(iterator position, BOOST_RV_REF(value_type) x)
+ { return m_tree.insert_unique(position, boost::move(x)); }
 
    //! <b>Requires</b>: i, j are not iterators into *this.
    //!
@@ -532,7 +538,7 @@
    //! is inserted right before p.
    template <class... Args>
    iterator emplace(Args&&... args)
- { return m_tree.emplace_unique(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_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
@@ -546,7 +552,7 @@
    //! is inserted right before p.
    template <class... Args>
    iterator emplace_hint(const_iterator hint, Args&&... args)
- { return m_tree.emplace_hint_unique(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_tree.emplace_hint_unique(hint, boost::forward<Args>(args)...); }
 
    #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
 
@@ -752,7 +758,7 @@
 {
    /// @cond
    private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(multimap)
+ BOOST_COPYABLE_AND_MOVABLE(multimap)
    typedef containers_detail::rbtree<Key,
                            std::pair<const Key, T>,
                            containers_detail::select1st< std::pair<const Key, T> >,
@@ -761,6 +767,9 @@
    tree_t m_tree; // red-black tree representing map
    /// @endcond
 
+ //Allocator type must be std::pair<CONST Key, T>
+ BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename Alloc::value_type>::value));
+
    public:
 
    // typedefs:
@@ -847,21 +856,21 @@
    //! <b>Complexity</b>: Construct.
    //!
    //! <b>Postcondition</b>: x is emptied.
- multimap(BOOST_MOVE_MACRO_RV_REF(multimap) x)
- : m_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree))
+ multimap(BOOST_RV_REF(multimap) x)
+ : m_tree(boost::move(x.m_tree))
    {}
 
    //! <b>Effects</b>: Makes *this a copy of x.
    //!
    //! <b>Complexity</b>: Linear in x.size().
- multimap& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(multimap) x)
+ multimap& operator=(BOOST_COPY_ASSIGN_REF(multimap) x)
    { m_tree = x.m_tree; return *this; }
 
    //! <b>Effects</b>: this->swap(x.get()).
    //!
    //! <b>Complexity</b>: Constant.
- multimap& operator=(BOOST_MOVE_MACRO_RV_REF(multimap) x)
- { m_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree); return *this; }
+ multimap& operator=(BOOST_RV_REF(multimap) x)
+ { m_tree = boost::move(x.m_tree); return *this; }
 
    //! <b>Effects</b>: Returns the comparison object out
    //! of which a was constructed.
@@ -1009,15 +1018,15 @@
    //! the iterator pointing to the newly inserted element.
    //!
    //! <b>Complexity</b>: Logarithmic.
- iterator insert(BOOST_MOVE_MACRO_RV_REF(nonconst_value_type) x)
- { return m_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(BOOST_RV_REF(nonconst_value_type) x)
+ { return m_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.
    //!
    //! <b>Complexity</b>: Logarithmic.
- iterator insert(BOOST_MOVE_MACRO_RV_REF(nonconst_impl_value_type) x)
- { return m_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(BOOST_RV_REF(nonconst_impl_value_type) x)
+ { return m_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.
@@ -1049,8 +1058,8 @@
    //!
    //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
    //! is inserted right before p.
- iterator insert(iterator position, BOOST_MOVE_MACRO_RV_REF(nonconst_value_type) x)
- { return m_tree.insert_equal(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(iterator position, BOOST_RV_REF(nonconst_value_type) x)
+ { return m_tree.insert_equal(position, boost::move(x)); }
 
    //! <b>Effects</b>: Inserts a new value move constructed from x in the container.
    //! p is a hint pointing to where the insert should start to search.
@@ -1060,8 +1069,8 @@
    //!
    //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
    //! is inserted right before p.
- iterator insert(iterator position, BOOST_MOVE_MACRO_RV_REF(nonconst_impl_value_type) x)
- { return m_tree.insert_equal(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(iterator position, BOOST_RV_REF(nonconst_impl_value_type) x)
+ { return m_tree.insert_equal(position, boost::move(x)); }
 
    //! <b>Requires</b>: i, j are not iterators into *this.
    //!
@@ -1085,7 +1094,7 @@
    //! is inserted right before p.
    template <class... Args>
    iterator emplace(Args&&... args)
- { return m_tree.emplace_equal(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_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.
@@ -1098,7 +1107,7 @@
    //! is inserted right before p.
    template <class... Args>
    iterator emplace_hint(const_iterator hint, Args&&... args)
- { return m_tree.emplace_hint_equal(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_tree.emplace_hint_equal(hint, boost::forward<Args>(args)...); }
 
    #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
 

Modified: branches/release/boost/interprocess/containers/container/set.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/set.hpp (original)
+++ branches/release/boost/interprocess/containers/container/set.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -23,10 +23,10 @@
 #include <functional>
 #include <memory>
 
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
 #include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_TREE_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
 #ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
 #include INCLUDE_BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP
 #endif
@@ -62,7 +62,7 @@
 {
    /// @cond
    private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(set)
+ BOOST_COPYABLE_AND_MOVABLE(set)
    typedef containers_detail::rbtree<T, T,
                      containers_detail::identity<T>, Pred, Alloc> tree_t;
    tree_t m_tree; // red-black tree representing set
@@ -136,21 +136,21 @@
    //! <b>Complexity</b>: Construct.
    //!
    //! <b>Postcondition</b>: x is emptied.
- set(BOOST_MOVE_MACRO_RV_REF(set) x)
- : m_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree))
+ set(BOOST_RV_REF(set) x)
+ : m_tree(boost::move(x.m_tree))
    {}
 
    //! <b>Effects</b>: Makes *this a copy of x.
    //!
    //! <b>Complexity</b>: Linear in x.size().
- set& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(set) x)
+ set& operator=(BOOST_COPY_ASSIGN_REF(set) x)
    { m_tree = x.m_tree; return *this; }
 
    //! <b>Effects</b>: this->swap(x.get()).
    //!
    //! <b>Complexity</b>: Constant.
- set& operator=(BOOST_MOVE_MACRO_RV_REF(set) x)
- { m_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree); return *this; }
+ set& operator=(BOOST_RV_REF(set) x)
+ { m_tree = boost::move(x.m_tree); return *this; }
 
    //! <b>Effects</b>: Returns the comparison object out
    //! of which a was constructed.
@@ -330,7 +330,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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ 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)
    { return priv_insert(u); }
    #endif
 
@@ -342,8 +342,8 @@
    //! points to the element with key equivalent to the key of x.
    //!
    //! <b>Complexity</b>: Logarithmic.
- std::pair<iterator,bool> insert(BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
+ { return m_tree.insert_unique(boost::move(x)); }
 
    //! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
    //! no element in the container with key equivalent to the key of x.
@@ -362,7 +362,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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ 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)
    { return priv_insert(position, u); }
    #endif
 
@@ -372,8 +372,8 @@
    //! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x.
    //!
    //! <b>Complexity</b>: Logarithmic.
- iterator insert(const_iterator p, BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_tree.insert_unique(p, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(const_iterator p, BOOST_RV_REF(value_type) x)
+ { return m_tree.insert_unique(p, boost::move(x)); }
 
    //! <b>Requires</b>: i, j are not iterators into *this.
    //!
@@ -399,7 +399,7 @@
    //! <b>Complexity</b>: Logarithmic.
    template <class... Args>
    iterator emplace(Args&&... args)
- { return m_tree.emplace_unique(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_tree.emplace_unique(boost::forward<Args>(args)...); }
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... if and only if there is
@@ -412,7 +412,7 @@
    //! <b>Complexity</b>: Logarithmic.
    template <class... Args>
    iterator emplace_hint(const_iterator hint, Args&&... args)
- { return m_tree.emplace_hint_unique(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_tree.emplace_hint_unique(hint, boost::forward<Args>(args)...); }
 
    #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
 
@@ -620,7 +620,7 @@
 {
    /// @cond
    private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(multiset)
+ BOOST_COPYABLE_AND_MOVABLE(multiset)
    typedef containers_detail::rbtree<T, T,
                      containers_detail::identity<T>, Pred, Alloc> tree_t;
    tree_t m_tree; // red-black tree representing multiset
@@ -695,21 +695,21 @@
    //! <b>Complexity</b>: Construct.
    //!
    //! <b>Postcondition</b>: x is emptied.
- multiset(BOOST_MOVE_MACRO_RV_REF(multiset) x)
- : m_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree))
+ multiset(BOOST_RV_REF(multiset) x)
+ : m_tree(boost::move(x.m_tree))
    {}
 
    //! <b>Effects</b>: Makes *this a copy of x.
    //!
    //! <b>Complexity</b>: Linear in x.size().
- multiset& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(multiset) x)
+ multiset& operator=(BOOST_COPY_ASSIGN_REF(multiset) x)
    { m_tree = x.m_tree; return *this; }
 
    //! <b>Effects</b>: this->swap(x.get()).
    //!
    //! <b>Complexity</b>: Constant.
- multiset& operator=(BOOST_MOVE_MACRO_RV_REF(multiset) x)
- { m_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree); return *this; }
+ multiset& operator=(BOOST_RV_REF(multiset) x)
+ { m_tree = boost::move(x.m_tree); return *this; }
 
    //! <b>Effects</b>: Returns the comparison object out
    //! of which a was constructed.
@@ -885,7 +885,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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ 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)
    { return priv_insert(u); }
    #endif
 
@@ -896,8 +896,8 @@
    //!
    //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
    //! is inserted right before p.
- iterator insert(BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(BOOST_RV_REF(value_type) x)
+ { return m_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.
@@ -915,7 +915,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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ 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)
    { return priv_insert(position, u); }
    #endif
 
@@ -927,8 +927,8 @@
    //!
    //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
    //! is inserted right before p.
- iterator insert(const_iterator p, BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_tree.insert_equal(p, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(const_iterator p, BOOST_RV_REF(value_type) x)
+ { return m_tree.insert_equal(p, boost::move(x)); }
 
    //! <b>Requires</b>: i, j are not iterators into *this.
    //!
@@ -948,7 +948,7 @@
    //! <b>Complexity</b>: Logarithmic.
    template <class... Args>
    iterator emplace(Args&&... args)
- { return m_tree.emplace_equal(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_tree.emplace_equal(boost::forward<Args>(args)...); }
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)...
@@ -960,7 +960,7 @@
    //! is inserted right before p.
    template <class... Args>
    iterator emplace_hint(const_iterator hint, Args&&... args)
- { return m_tree.emplace_hint_equal(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_tree.emplace_hint_equal(hint, boost::forward<Args>(args)...); }
 
    #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
 

Modified: branches/release/boost/interprocess/containers/container/slist.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/slist.hpp (original)
+++ branches/release/boost/interprocess/containers/container/slist.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -19,7 +19,7 @@
 #include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
 
 #include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
 #include <boost/pointer_to_other.hpp>
 #include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
@@ -73,7 +73,7 @@
 
    template<class ...Args>
    slist_node(Args &&...args)
- : m_data(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)
+ : m_data(boost::forward<Args>(args)...)
    {}
 
    #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
@@ -222,7 +222,7 @@
 
    /// @cond
    private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(slist)
+ BOOST_COPYABLE_AND_MOVABLE(slist)
    typedef difference_type list_difference_type;
    typedef pointer list_pointer;
    typedef const_pointer list_const_pointer;
@@ -372,8 +372,8 @@
    //! <b>Throws</b>: If allocator_type's copy constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- slist(BOOST_MOVE_MACRO_RV_REF(slist) x)
- : AllocHolder(BOOST_CONTAINER_MOVE_NAMESPACE::move((AllocHolder&)x))
+ slist(BOOST_RV_REF(slist) x)
+ : AllocHolder(boost::move((AllocHolder&)x))
    {}
 
    //! <b>Effects</b>: Makes *this contain the same elements as x.
@@ -384,7 +384,7 @@
    //! <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_MOVE_MACRO_COPY_ASSIGN_REF(slist) x)
+ slist& operator= (BOOST_COPY_ASSIGN_REF(slist) x)
    {
       if (&x != this){
          this->assign(x.begin(), x.end());
@@ -400,7 +400,7 @@
    //! <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_MOVE_MACRO_RV_REF(slist) mx)
+ slist& operator= (BOOST_RV_REF(slist) mx)
    {
       if (&mx != this){
          this->clear();
@@ -451,7 +451,7 @@
    template <class InpIt>
    void assign(InpIt first, InpIt last)
    {
- const bool aux_boolean = containers_detail::is_convertible<InpIt, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
       typedef containers_detail::bool_<aux_boolean> Result;
       this->priv_assign_dispatch(first, last, Result());
    }
@@ -603,7 +603,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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ 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)
    { return priv_push_front(u); }
    #endif
 
@@ -613,8 +613,8 @@
    //! <b>Throws</b>: If memory allocation throws.
    //!
    //! <b>Complexity</b>: Amortized constant time.
- void push_front(BOOST_MOVE_MACRO_RV_REF(T) x)
- { this->icont().push_front(*this->create_node(BOOST_CONTAINER_MOVE_NAMESPACE::move(x))); }
+ void push_front(BOOST_RV_REF(T) x)
+ { this->icont().push_front(*this->create_node(boost::move(x))); }
 
    //! <b>Effects</b>: Removes the first element from the list.
    //!
@@ -665,7 +665,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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ 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)
    { return this->priv_insert_after(position, u); }
    #endif
 
@@ -682,8 +682,8 @@
    //!
    //! <b>Note</b>: Does not affect the validity of iterators and references of
    //! previous values.
- iterator insert_after(const_iterator prev_pos, BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return iterator(this->icont().insert_after(prev_pos.get(), *this->create_node(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)))); }
+ iterator insert_after(const_iterator prev_pos, BOOST_RV_REF(value_type) x)
+ { return iterator(this->icont().insert_after(prev_pos.get(), *this->create_node(boost::move(x)))); }
 
    //! <b>Requires</b>: prev_pos must be a valid iterator of *this.
    //!
@@ -713,7 +713,7 @@
    template <class InIter>
    void insert_after(const_iterator prev_pos, InIter first, InIter last)
    {
- const bool aux_boolean = containers_detail::is_convertible<InIter, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InIter, size_type>::value;
       typedef containers_detail::bool_<aux_boolean> Result;
       this->priv_insert_after_range_dispatch(prev_pos, first, last, Result());
    }
@@ -733,7 +733,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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ 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)
    { return this->priv_insert(position, u); }
    #endif
 
@@ -744,8 +744,8 @@
    //! <b>Throws</b>: If memory allocation throws.
    //!
    //! <b>Complexity</b>: Linear to the elements before p.
- iterator insert(const_iterator p, BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return this->insert_after(previous(p), BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(const_iterator p, BOOST_RV_REF(value_type) x)
+ { return this->insert_after(previous(p), boost::move(x)); }
 
    //! <b>Requires</b>: p must be a valid iterator of *this.
    //!
@@ -781,7 +781,7 @@
    //! <b>Complexity</b>: Amortized constant time.
    template <class... Args>
    void emplace_front(Args&&... args)
- { this->emplace_after(this->cbefore_begin(), BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { this->emplace_after(this->cbefore_begin(), boost::forward<Args>(args)...); }
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... before p
@@ -792,7 +792,7 @@
    //! <b>Complexity</b>: Linear to the elements before p
    template <class... Args>
    iterator emplace(const_iterator p, Args&&... args)
- { return this->emplace_after(this->previous(p), BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return this->emplace_after(this->previous(p), boost::forward<Args>(args)...); }
 
    //! <b>Effects</b>: Inserts an object of type T constructed with
    //! std::forward<Args>(args)... after prev
@@ -805,7 +805,7 @@
    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_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ 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));
@@ -1338,7 +1338,7 @@
 
    template<class Integer>
    void priv_insert_dispatch(const_iterator prev, Integer n, Integer x, containers_detail::true_)
- { this->priv_create_and_insert_nodes(prev, (std::size_t)n, x); }
+ { this->priv_create_and_insert_nodes(prev, (size_type)n, x); }
 
    void priv_fill_assign(size_type n, const T& val)
    {
@@ -1380,7 +1380,7 @@
 
    template <class Int>
    void priv_insert_after_range_dispatch(const_iterator prev_pos, Int n, Int x, containers_detail::true_)
- { this->priv_create_and_insert_nodes(prev_pos, (std::size_t)n, x); }
+ { 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_)

Modified: branches/release/boost/interprocess/containers/container/stable_vector.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/stable_vector.hpp (original)
+++ branches/release/boost/interprocess/containers/container/stable_vector.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -140,7 +140,7 @@
 
    template<class ...Args>
    node_type(Args &&...args)
- : value(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)
+ : value(boost::forward<Args>(args)...)
    {}
 
    #else //BOOST_CONTAINERS_PERFECT_FORWARDING
@@ -177,10 +177,14 @@
 
    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>;
@@ -205,13 +209,19 @@
    {}
    
    private:
- static node_type_ptr_t node_ptr_cast(void_ptr p)
+ 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)));
    }
 
- static void_ptr_ptr void_ptr_ptr_cast(void_ptr 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)));
+ }
+
+ 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)));
@@ -225,9 +235,9 @@
    { pn = node_ptr_cast(*(void_ptr_ptr_cast(pn->up)+1)); }
    void decrement()
    { pn = node_ptr_cast(*(void_ptr_ptr_cast(pn->up)-1)); }
- void advance(std::ptrdiff_t n)
+ void advance(difference_type n)
    { pn = node_ptr_cast(*(void_ptr_ptr_cast(pn->up)+n)); }
- std::ptrdiff_t distance_to(const iterator& x)const
+ difference_type distance_to(const iterator& x)const
    { return void_ptr_ptr_cast(x.pn->up) - void_ptr_ptr_cast(pn->up); }
 
    public:
@@ -261,9 +271,9 @@
       return *this;
    }
 
- iterator operator+(difference_type off) const
+ friend iterator operator+(const iterator &left, difference_type off)
    {
- iterator tmp(*this);
+ iterator tmp(left);
       tmp += off;
       return tmp;
    }
@@ -278,38 +288,36 @@
    iterator& operator-=(difference_type off)
    { *this += -off; return *this; }
 
- iterator operator-(difference_type off) const
+ friend iterator operator-(const iterator &left, difference_type off)
    {
- iterator tmp(*this);
+ iterator tmp(left);
       tmp -= off;
       return tmp;
    }
 
- difference_type operator-(const iterator& right) const
+ friend difference_type operator-(const iterator& left, const iterator& right)
    {
- void_ptr_ptr p1 = void_ptr_ptr_cast(this->pn->up);
- void_ptr_ptr p2 = void_ptr_ptr_cast(right.pn->up);
- return p1 - p2;
+ return void_ptr_ptr_cast(left.pn->up) - void_ptr_ptr_cast(right.pn->up);
    }
 
    //Comparison operators
- bool operator== (const iterator& r) const
- { return pn == r.pn; }
+ friend bool operator== (const iterator& l, const iterator& r)
+ { return l.pn == r.pn; }
 
- bool operator!= (const iterator& r) const
- { return pn != r.pn; }
+ friend bool operator!= (const iterator& l, const iterator& r)
+ { return l.pn != r.pn; }
 
- bool operator< (const iterator& r) const
- { return void_ptr_ptr_cast(pn->up) < void_ptr_ptr_cast(r.pn->up); }
+ friend bool operator< (const iterator& l, const iterator& r)
+ { return void_ptr_ptr_cast(l.pn->up) < void_ptr_ptr_cast(r.pn->up); }
 
- bool operator<= (const iterator& r) const
- { return void_ptr_ptr_cast(pn->up) <= void_ptr_ptr_cast(r.pn->up); }
+ friend bool operator<= (const iterator& l, const iterator& r)
+ { return void_ptr_ptr_cast(l.pn->up) <= void_ptr_ptr_cast(r.pn->up); }
 
- bool operator> (const iterator& r) const
- { return void_ptr_ptr_cast(pn->up) > void_ptr_ptr_cast(r.pn->up); }
+ friend bool operator> (const iterator& l, const iterator& r)
+ { return void_ptr_ptr_cast(l.pn->up) > void_ptr_ptr_cast(r.pn->up); }
 
- bool operator>= (const iterator& r) const
- { return void_ptr_ptr_cast(pn->up) >= void_ptr_ptr_cast(r.pn->up); }
+ friend bool operator>= (const iterator& l, const iterator& r)
+ { return void_ptr_ptr_cast(l.pn->up) >= void_ptr_ptr_cast(r.pn->up); }
 
    node_type_ptr_t pn;
 };
@@ -379,8 +387,12 @@
       move_const_ref_type<T>::type insert_const_ref_type;
    typedef typename Allocator::template
       rebind<void>::other::pointer void_ptr;
+ typedef typename boost::pointer_to_other
+ <void_ptr, const void>::type const_void_ptr;
    typedef typename Allocator::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 stable_vector_detail::node_type
       <void_ptr, T> node_type_t;
    typedef typename Allocator::template
@@ -454,8 +466,14 @@
 
    ///@cond
    private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(stable_vector)
+ BOOST_COPYABLE_AND_MOVABLE(stable_vector)
    static const size_type ExtraPointers = 3;
+ //This container stores metadata at the end of the void_ptr vector with additional 3 pointers:
+ // back() is impl.back() - ExtraPointers;
+ // end node index is impl.end()[-3]
+ // Node cache first is impl.end()[-2];
+ // Node cache last is *impl.back();
+
    typedef typename stable_vector_detail::
       select_multiallocation_chain
       < node_allocator_type
@@ -508,7 +526,7 @@
       cod.release();
    }
 
- stable_vector(BOOST_MOVE_MACRO_RV_REF(stable_vector) x)
+ stable_vector(BOOST_RV_REF(stable_vector) x)
       : internal_data(x.get_al()),impl(x.get_al())
    { this->swap(x); }
 
@@ -518,7 +536,7 @@
       clear_pool();
    }
 
- stable_vector& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(stable_vector) x)
+ stable_vector& operator=(BOOST_COPY_ASSIGN_REF(stable_vector) x)
    {
       STABLE_VECTOR_CHECK_INVARIANT;
       if (this != &x) {
@@ -527,7 +545,7 @@
       return *this;
    }
 
- stable_vector& operator=(BOOST_MOVE_MACRO_RV_REF(stable_vector) x)
+ stable_vector& operator=(BOOST_RV_REF(stable_vector) x)
    {
       if (&x != this){
          this->swap(x);
@@ -676,12 +694,12 @@
    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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ 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)
    { return priv_push_back(u); }
    #endif
 
- void push_back(BOOST_MOVE_MACRO_RV_REF(T) t)
- { this->insert(end(), BOOST_CONTAINER_MOVE_NAMESPACE::move(t)); }
+ void push_back(BOOST_RV_REF(T) t)
+ { this->insert(end(), boost::move(t)); }
 
    void pop_back()
    { this->erase(this->end()-1); }
@@ -693,14 +711,14 @@
    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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ 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)
    { return this->priv_insert(position, u); }
    #endif
 
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(T) x)
+ iterator insert(const_iterator position, BOOST_RV_REF(T) x)
    {
       typedef repeat_iterator<T, difference_type> repeat_it;
- typedef BOOST_CONTAINER_MOVE_NAMESPACE::move_iterator<repeat_it> repeat_move_it;
+ typedef boost::move_iterator<repeat_it> repeat_move_it;
       //Just call more general insert(pos, size, value) and return iterator
       size_type pos_n = position - cbegin();
       this->insert(position
@@ -735,8 +753,8 @@
    void emplace_back(Args &&...args)
    {
       typedef emplace_functor<node_type_t, Args...> EmplaceFunctor;
- typedef emplace_iterator<node_type_t, EmplaceFunctor> EmplaceIterator;
- EmplaceFunctor &&ef = EmplaceFunctor(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ typedef emplace_iterator<node_type_t, EmplaceFunctor, difference_type> EmplaceIterator;
+ EmplaceFunctor &&ef = EmplaceFunctor(boost::forward<Args>(args)...);
       this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator());
    }
 
@@ -755,8 +773,8 @@
       //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_iterator<node_type_t, EmplaceFunctor> EmplaceIterator;
- EmplaceFunctor &&ef = EmplaceFunctor(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ typedef emplace_iterator<node_type_t, EmplaceFunctor, difference_type> EmplaceIterator;
+ EmplaceFunctor &&ef = EmplaceFunctor(boost::forward<Args>(args)...);
       this->insert(position, EmplaceIterator(ef), EmplaceIterator());
       return iterator(this->begin() + pos_n);
    }
@@ -766,7 +784,7 @@
    void emplace_back()
    {
       typedef emplace_functor<node_type_t> EmplaceFunctor;
- typedef emplace_iterator<node_type_t, EmplaceFunctor> EmplaceIterator;
+ typedef emplace_iterator<node_type_t, EmplaceFunctor, difference_type> EmplaceIterator;
       EmplaceFunctor ef;
       this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator());
    }
@@ -774,7 +792,7 @@
    iterator emplace(const_iterator position)
    {
       typedef emplace_functor<node_type_t> EmplaceFunctor;
- typedef emplace_iterator<node_type_t, EmplaceFunctor> EmplaceIterator;
+ 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());
@@ -787,7 +805,7 @@
    { \
       typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg) \
          <node_type_t, BOOST_PP_ENUM_PARAMS(n, P)> EmplaceFunctor; \
- typedef emplace_iterator<node_type_t, EmplaceFunctor> EmplaceIterator; \
+ 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()); \
    } \
@@ -797,7 +815,7 @@
    { \
       typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg) \
          <node_type_t, BOOST_PP_ENUM_PARAMS(n, P)> EmplaceFunctor; \
- typedef emplace_iterator<node_type_t, EmplaceFunctor> EmplaceIterator; \
+ typedef emplace_iterator<node_type_t, EmplaceFunctor, difference_type> EmplaceIterator; \
       EmplaceFunctor ef(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
       size_type pos_n = pos - this->cbegin(); \
       this->insert(pos, EmplaceIterator(ef), EmplaceIterator()); \
@@ -812,11 +830,11 @@
    iterator erase(const_iterator position)
    {
       STABLE_VECTOR_CHECK_INVARIANT;
- difference_type d=position-this->cbegin();
- impl_iterator it=impl.begin()+d;
+ difference_type d = position - this->cbegin();
+ impl_iterator it = impl.begin() + d;
       this->delete_node(*it);
- impl.erase(it);
- this->align_nodes(impl.begin()+d,get_last_align());
+ it = impl.erase(it);
+ this->align_nodes(it, get_last_align());
       return this->begin()+d;
    }
 
@@ -847,17 +865,17 @@
    void clear_pool(allocator_v1)
    {
       if(!impl.empty() && impl.back()){
- void_ptr &p1 = *(impl.end()-2);
- void_ptr &p2 = 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(), p1, p2, this->internal_data.pool_size);
+ holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, this->internal_data.pool_size);
          while(!holder.empty()){
             node_type_ptr_t n = holder.front();
             holder.pop_front();
             this->deallocate_one(n);
          }
- p1 = p2 = 0;
+ pool_first_ref = pool_last_ref = 0;
          this->internal_data.pool_size = 0;
       }
    }
@@ -866,12 +884,12 @@
    {
 
       if(!impl.empty() && impl.back()){
- void_ptr &p1 = *(impl.end()-2);
- void_ptr &p2 = 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(), p1, p2, internal_data.pool_size);
- get_al().deallocate_individual(BOOST_CONTAINER_MOVE_NAMESPACE::move(holder));
- p1 = p2 = 0;
+ holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
+ get_al().deallocate_individual(boost::move(holder));
+ pool_first_ref = pool_last_ref = 0;
          this->internal_data.pool_size = 0;
       }
    }
@@ -896,30 +914,30 @@
 
    void add_to_pool(size_type n, allocator_v2)
    {
- void_ptr &p1 = *(impl.end()-2);
- void_ptr &p2 = 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(), p1, p2, internal_data.pool_size);
- BOOST_STATIC_ASSERT((::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<multiallocation_chain>::value == true));
+ 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));
       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());
- p1 = data.first;
- p2 = data.second;
+ pool_first_ref = data.first;
+ pool_last_ref = data.second;
    }
 
    void put_in_pool(node_type_ptr_t p)
    {
- void_ptr &p1 = *(impl.end()-2);
- void_ptr &p2 = 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(), p1, p2, internal_data.pool_size);
+ holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
       holder.push_front(p);
       ++this->internal_data.pool_size;
       std::pair<void_ptr, void_ptr> ret(holder.extract_data());
- p1 = ret.first;
- p2 = ret.second;
+ pool_first_ref = ret.first;
+ pool_last_ref = ret.second;
    }
 
    node_type_ptr_t get_from_pool()
@@ -928,20 +946,20 @@
          return node_type_ptr_t(0);
       }
       else{
- void_ptr &p1 = *(impl.end()-2);
- void_ptr &p2 = 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(), p1, p2, internal_data.pool_size);
+ holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
          node_type_ptr_t ret = holder.front();
          holder.pop_front();
          --this->internal_data.pool_size;
          if(!internal_data.pool_size){
- p1 = p2 = 0;
+ pool_first_ref = pool_last_ref = void_ptr(0);
          }
          else{
             std::pair<void_ptr, void_ptr> data(holder.extract_data());
- p1 = data.first;
- p2 = data.second;
+ pool_first_ref = data.first;
+ pool_last_ref = data.second;
          }
          return ret;
       }
@@ -992,8 +1010,8 @@
          impl_iterator it1(impl.begin() + d1), it2(impl.begin() + d2);
          for(impl_iterator it = it1; it != it2; ++it)
             this->delete_node(*it);
- impl.erase(it1, it2);
- this->align_nodes(impl.begin() + d1, get_last_align());
+ impl_iterator e = impl.erase(it1, it2);
+ this->align_nodes(e, get_last_align());
       }
       return iterator(this->begin() + d1);
    }
@@ -1018,19 +1036,19 @@
       return priv_erase(first, last, allocator_v1());
    }
 
- static node_type_ptr_t node_ptr_cast(void_ptr p)
+ 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)));
    }
 
- static node_type_base_ptr_t node_base_ptr_cast(void_ptr 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)));
    }
 
- static value_type& value(void_ptr p)
+ static value_type& value(const void_ptr &p)
    {
       return node_ptr_cast(p)->value;
    }
@@ -1065,7 +1083,7 @@
    }
 
    template<class Iter>
- void_ptr new_node(void_ptr up, Iter it)
+ void_ptr new_node(const void_ptr &up, Iter it)
    {
       node_type_ptr_t p = this->allocate_one();
       try{
@@ -1079,14 +1097,14 @@
       return p;
    }
 
- void delete_node(void_ptr p)
+ void delete_node(const void_ptr &p)
    {
       node_type_ptr_t n(node_ptr_cast(p));
       n->~node_type_t();
       this->put_in_pool(n);
    }
 
- static void align_nodes(impl_iterator first,impl_iterator last)
+ static void align_nodes(impl_iterator first, impl_iterator last)
    {
       while(first!=last){
          node_ptr_cast(*first)->up = void_ptr(&*first);
@@ -1136,14 +1154,14 @@
       size_type i=0;
       try{
          while(first!=last){
- *(it + i) = this->new_node(void_ptr((void*)(&*(it + i))), first);
+ it[i] = this->new_node(void_ptr_ptr(&it[i]), first);
             ++first;
             ++i;
          }
       }
       catch(...){
- impl.erase(it + i, it + n);
- this->align_nodes(it + i, get_last_align());
+ impl_iterator e = impl.erase(it + i, it + n);
+ this->align_nodes(e, get_last_align());
          throw;
       }
    }
@@ -1161,17 +1179,17 @@
             mem.pop_front();
             //This can throw
             boost::container::construct_in_place(&*p, first);
- p->set_pointer(void_ptr((void*)(&*(it + i))));
+ p->set_pointer(void_ptr_ptr(&it[i]));
             ++first;
- *(it + i) = p;
+ it[i] = p;
             ++i;
          }
       }
       catch(...){
          get_al().deallocate_one(p);
- get_al().deallocate_many(BOOST_CONTAINER_MOVE_NAMESPACE::move(mem));
- impl.erase(it+i, it+n);
- this->align_nodes(it+i,get_last_align());
+ get_al().deallocate_many(boost::move(mem));
+ impl_iterator e = impl.erase(it+i, it+n);
+ this->align_nodes(e, get_last_align());
          throw;
       }
    }
@@ -1190,16 +1208,16 @@
             }
             //This can throw
             boost::container::construct_in_place(&*p, first);
- p->set_pointer(void_ptr(&*(it+i)));
+ p->set_pointer(void_ptr_ptr(&it[i]));
             ++first;
- *(it+i)=p;
+ it[i]=p;
             ++i;
          }
       }
       catch(...){
          put_in_pool(p);
- impl.erase(it+i,it+n);
- this->align_nodes(it+i,get_last_align());
+ impl_iterator e = impl.erase(it+i, it+n);
+ this->align_nodes(e, get_last_align());
          throw;
       }
    }
@@ -1228,9 +1246,10 @@
       if(get_end_node() != *(impl.end() - ExtraPointers)){
          return false;
       }
- for(const_impl_iterator it=impl.begin(),it_end=get_last_align();it!=it_end;++it){
- if(node_ptr_cast(*it)->up != &*it)
- return false;
+ for(const_impl_iterator it = impl.begin(), it_end = get_last_align(); it != it_end; ++it){
+ if(const_void_ptr(node_ptr_cast(*it)->up) !=
+ const_void_ptr(const_void_ptr_ptr(&*it)))
+ return false;
       }
       size_type n = capacity()-size();
       const void_ptr &pool_head = impl.back();
@@ -1238,7 +1257,7 @@
       node_type_ptr_t p = node_ptr_cast(pool_head);
       while(p){
          ++num_pool;
- p = p->up;
+ p = node_ptr_cast(p->up);
       }
       return n >= num_pool;
    }

Modified: branches/release/boost/interprocess/containers/container/string.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/string.hpp (original)
+++ branches/release/boost/interprocess/containers/container/string.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -22,7 +22,7 @@
 #include INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_ALLOCATION_TYPE_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
 #include <boost/static_assert.hpp>
 
 #include <functional>
@@ -42,6 +42,7 @@
 #include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP
 #include <boost/detail/no_exceptions_support.hpp>
 #include <boost/type_traits/has_trivial_destructor.hpp>
+#include <boost/aligned_storage.hpp>
 
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
@@ -67,7 +68,7 @@
 class basic_string_base
 {
    basic_string_base();
- BOOST_MOVE_MACRO_MOVABLE_BUT_NOT_COPYABLE(basic_string_base)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_string_base)
 
  public:
    typedef A allocator_type;
@@ -81,14 +82,14 @@
       : members_(a)
    { init(); }
 
- basic_string_base(const allocator_type& a, std::size_t n)
+ basic_string_base(const allocator_type& a, size_type n)
       : members_(a)
    {
       this->init();
       this->allocate_initial_block(n);
    }
 
- basic_string_base(BOOST_MOVE_MACRO_RV_REF(basic_string_base) b)
+ basic_string_base(BOOST_RV_REF(basic_string_base) b)
       : members_(b.members_)
    {
       init();
@@ -134,14 +135,6 @@
       }
    };
 
- //This basic type should have the same alignment as long_t
-//iG typedef typename type_with_alignment<containers_detail::alignment_of<long_t>::value>::type
-// long_alignment_type;
- typedef void *long_alignment_type;
- BOOST_STATIC_ASSERT((containers_detail::alignment_of<long_alignment_type>::value %
- containers_detail::alignment_of<long_t>::value) == 0);
-
-
    //This type is the first part of the structure controlling a short string
    //The "data" member stores
    struct short_header
@@ -152,11 +145,9 @@
 
    //This type has the same alignment and size as long_t but it's POD
    //so, unlike long_t, it can be placed in a union
- struct long_raw_t
- {
- long_alignment_type a;
- unsigned char b[sizeof(long_t) - sizeof(long_alignment_type)];
- };
+
+ typedef typename boost::aligned_storage< sizeof(long_t),
+ containers_detail::alignment_of<long_t>::value>::type long_raw_t;
 
    protected:
    static const size_type MinInternalBufferChars = 8;
@@ -284,7 +275,7 @@
    size_type next_capacity(size_type additional_objects) const
    { return get_next_capacity(this->alloc().max_size(), this->priv_storage(), additional_objects); }
 
- void deallocate(pointer p, std::size_t n)
+ void deallocate(pointer p, size_type n)
    {
       if (p && (n > InternalBufferChars))
          this->alloc().deallocate(p, n);
@@ -302,7 +293,7 @@
    void destroy(pointer p)
    { containers_detail::get_pointer(p)->~value_type(); }
 
- void allocate_initial_block(std::size_t n)
+ void allocate_initial_block(size_type n)
    {
       if (n <= this->max_size()) {
          if(n > InternalBufferChars){
@@ -321,7 +312,7 @@
    void deallocate_block()
    { this->deallocate(this->priv_addr(), this->priv_storage()); }
       
- std::size_t max_size() const
+ size_type max_size() const
    { return this->alloc().max_size() - 1; }
 
    // Helper functions for exception handling.
@@ -429,7 +420,7 @@
 {
    /// @cond
    private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(basic_string)
+ BOOST_COPYABLE_AND_MOVABLE(basic_string)
    typedef containers_detail::basic_string_base<A> base_t;
    static const typename base_t::size_type InternalBufferChars = base_t::InternalBufferChars;
 
@@ -509,7 +500,7 @@
    struct reserve_t {};
    /// @endcond
 
- basic_string(reserve_t, std::size_t n,
+ basic_string(reserve_t, size_type n,
                const allocator_type& a = allocator_type())
       : base_t(a, n + 1)
    { this->priv_terminate_string(); }
@@ -535,8 +526,8 @@
    //! <b>Throws</b>: If allocator_type's copy constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- basic_string(BOOST_MOVE_MACRO_RV_REF(basic_string) s)
- : base_t(BOOST_CONTAINER_MOVE_NAMESPACE::move((base_t&)s))
+ basic_string(BOOST_RV_REF(basic_string) s)
+ : base_t(boost::move((base_t&)s))
    {}
 
    //! <b>Effects</b>: Constructs a basic_string taking the allocator as parameter,
@@ -584,7 +575,7 @@
       : base_t(a)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InputIterator, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InputIterator, size_type>::value;
       typedef containers_detail::bool_<aux_boolean> Result;
       this->priv_initialize_dispatch(f, l, Result());
    }
@@ -602,7 +593,7 @@
    //! <b>Postcondition</b>: x == *this.
    //!
    //! <b>Complexity</b>: Linear to the elements x contains.
- basic_string& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(basic_string) s)
+ basic_string& operator=(BOOST_COPY_ASSIGN_REF(basic_string) s)
    {
       if (&s != this)
          this->assign(s.begin(), s.end());
@@ -614,7 +605,7 @@
    //! <b>Throws</b>: If allocator_type's copy constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- basic_string& operator=(BOOST_MOVE_MACRO_RV_REF(basic_string) ms)
+ basic_string& operator=(BOOST_RV_REF(basic_string) ms)
    {
       basic_string &s = ms;
       if (&s != this){
@@ -931,7 +922,7 @@
    { return this->operator=(s); }
 
    //! <b>Effects</b>: Moves the resources from ms *this.
- basic_string& assign(BOOST_MOVE_MACRO_RV_REF(basic_string) ms)
+ basic_string& assign(BOOST_RV_REF(basic_string) ms)
    { return this->operator=(ms);}
 
    //! <b>Effects</b>: Assigns the range [pos, pos + n) from s to *this.
@@ -960,7 +951,7 @@
    basic_string& assign(InputIter first, InputIter last)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InputIter, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InputIter, size_type>::value;
       typedef containers_detail::bool_<aux_boolean> Result;
       return this->priv_assign_dispatch(first, last, Result());
    }
@@ -1050,7 +1041,7 @@
    }
 
    //! <b>Effects</b>: Inserts the character c n-times before position.
- void insert(iterator position, std::size_t n, CharT c)
+ void insert(iterator position, size_type n, CharT c)
    {
       this->insert(position, cvalue_iterator(c, n),
                              cvalue_iterator());
@@ -1061,7 +1052,7 @@
    void insert(iterator p, InputIter first, InputIter last)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InputIter, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InputIter, size_type>::value;
       typedef containers_detail::bool_<aux_boolean> Result;
       this->priv_insert_dispatch(p, first, last, Result());
    }
@@ -1204,7 +1195,7 @@
                         InputIter f, InputIter l)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InputIter, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InputIter, size_type>::value;
       typedef containers_detail::bool_<aux_boolean> Result;
       return this->priv_replace_dispatch(first, last, f, l, Result());
    }
@@ -1295,7 +1286,7 @@
    //! substring of *this, beginning at character position min(pos, size()).
    size_type rfind(const CharT* s, size_type pos, size_type n) const
    {
- const std::size_t len = size();
+ const size_type len = size();
 
       if (n > len)
          return npos;
@@ -1540,8 +1531,8 @@
    static int s_compare(const_pointer f1, const_pointer l1,
                         const_pointer f2, const_pointer l2)
    {
- const std::ptrdiff_t n1 = l1 - f1;
- const std::ptrdiff_t n2 = l2 - f2;
+ 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));
@@ -1900,19 +1891,19 @@
 }
 
 template <class CharT, class Traits, class A> inline
-BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
+BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
    operator+(
- BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
+ BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
    , const basic_string<CharT,Traits,A>& y)
 {
    mx += y;
- return BOOST_CONTAINER_MOVE_NAMESPACE::move(mx);
+ return boost::move(mx);
 }
 
 template <class CharT, class Traits, class A> inline
-BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
+BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
    operator+(const basic_string<CharT,Traits,A>& x,
- BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
+ 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);
@@ -1922,10 +1913,10 @@
 inline basic_string<CharT,Traits,A>
 operator+(const CharT* s, const basic_string<CharT,Traits,A>& y)
 {
- typedef basic_string<CharT,Traits,A> str_t;
+ typedef basic_string<CharT, Traits, A> str_t;
    typedef typename str_t::reserve_t reserve_t;
    reserve_t reserve;
- const std::size_t n = Traits::length(s);
+ const typename str_t::size_type n = Traits::length(s);
    str_t result(reserve, n + y.size());
    result.append(s, s + n);
    result.append(y);
@@ -1933,12 +1924,12 @@
 }
 
 template <class CharT, class Traits, class A> inline
-BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
+BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
 operator+(const CharT* s,
- BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
+ 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_CONTAINER_MOVE_NAMESPACE::move(my.get().replace(size_type(0), size_type(0), s));
+ return boost::move(my.get().replace(size_type(0), size_type(0), s));
 }
 
 template <class CharT, class Traits, class A>
@@ -1955,9 +1946,9 @@
 }
 
 template <class CharT, class Traits, class A> inline
-BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
+BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
 operator+(CharT c,
- BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
+ 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);
@@ -1970,7 +1961,7 @@
    typedef basic_string<CharT,Traits,A> str_t;
    typedef typename str_t::reserve_t reserve_t;
    reserve_t reserve;
- const std::size_t n = Traits::length(s);
+ const typename str_t::size_type n = Traits::length(s);
    str_t result(reserve, x.size() + n, x.alloc());
    result.append(x);
    result.append(s, s + n);
@@ -1978,12 +1969,12 @@
 }
 
 template <class CharT, class Traits, class A>
-BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-operator+(BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
+BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
+operator+(BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
          , const CharT* s)
 {
    mx += s;
- return BOOST_CONTAINER_MOVE_NAMESPACE::move(mx);
+ return boost::move(mx);
 }
 
 template <class CharT, class Traits, class A>
@@ -2000,12 +1991,12 @@
 }
 
 template <class CharT, class Traits, class A>
-BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-operator+( BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
+BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
+operator+( BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
          , const CharT c)
 {
    mx += c;
- return BOOST_CONTAINER_MOVE_NAMESPACE::move(mx);
+ return boost::move(mx);
 }
 
 // Operator== and operator!=
@@ -2023,7 +2014,7 @@
 inline bool
 operator==(const CharT* s, const basic_string<CharT,Traits,A>& y)
 {
- std::size_t n = Traits::length(s);
+ typename basic_string<CharT,Traits,A>::size_type n = Traits::length(s);
    return n == y.size() && Traits::compare(s, y.data(), n) == 0;
 }
 
@@ -2031,7 +2022,7 @@
 inline bool
 operator==(const basic_string<CharT,Traits,A>& x, const CharT* s)
 {
- std::size_t n = Traits::length(s);
+ typename basic_string<CharT,Traits,A>::size_type n = Traits::length(s);
    return x.size() == n && Traits::compare(x.data(), s, n) == 0;
 }
 
@@ -2068,7 +2059,7 @@
 operator<(const CharT* s, const basic_string<CharT,Traits,A>& y)
 {
    return y.compare(s) > 0;
-// std::size_t n = Traits::length(s);
+// basic_string<CharT,Traits,A>::size_type n = Traits::length(s);
 // return basic_string<CharT,Traits,A>
 // ::s_compare(s, s + n, y.begin(), y.end()) < 0;
 }
@@ -2079,7 +2070,7 @@
           const CharT* s)
 {
    return x.compare(s) < 0;
-// std::size_t n = Traits::length(s);
+// basic_string<CharT,Traits,A>::size_type n = Traits::length(s);
 // return basic_string<CharT,Traits,A>
 // ::s_compare(x.begin(), x.end(), s, s + n) < 0;
 }
@@ -2174,8 +2165,8 @@
 
    if (sentry) {
       ok = true;
- std::size_t n = s.size();
- std::size_t pad_len = 0;
+ typename basic_string<CharT,Traits,A>::size_type n = s.size();
+ typename basic_string<CharT,Traits,A>::size_type pad_len = 0;
       const bool left = (os.flags() & std::ios::left) != 0;
       const std::size_t w = os.width(0);
       std::basic_streambuf<CharT, Traits>* buf = os.rdbuf();
@@ -2251,7 +2242,7 @@
 std::basic_istream<CharT, Traits>&
 getline(std::istream& is, basic_string<CharT,Traits,A>& s,CharT delim)
 {
- std::size_t nread = 0;
+ typename basic_string<CharT,Traits,A>::size_type nread = 0;
    typename std::basic_istream<CharT, Traits>::sentry sentry(is, true);
    if (sentry) {
       std::basic_streambuf<CharT, Traits>* buf = is.rdbuf();

Modified: branches/release/boost/interprocess/containers/container/vector.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/container/vector.hpp (original)
+++ branches/release/boost/interprocess/containers/container/vector.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -31,6 +31,7 @@
 #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 INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_ALLOCATION_TYPE_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP
@@ -38,7 +39,7 @@
 #include INCLUDE_BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_DESTROYERS_HPP
 #include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
 #include <boost/pointer_to_other.hpp>
 #include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
 #include INCLUDE_BOOST_CONTAINER_DETAIL_ADVANCED_INSERT_INT_HPP
@@ -375,8 +376,6 @@
    /// @cond
    typedef vector<T, A> self_t;
    typedef containers_detail::vector_alloc_holder<A> base_t;
- typedef typename containers_detail::
- move_const_ref_type<T>::type insert_const_ref_type;
    /// @endcond
    public:
    //! The type of object, T, stored in the vector
@@ -411,7 +410,7 @@
 
    /// @cond
    private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(vector)
+ 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;
 
@@ -421,7 +420,7 @@
 
    typedef constant_iterator<T, difference_type> cvalue_iterator;
    typedef repeat_iterator<T, difference_type> repeat_it;
- typedef BOOST_CONTAINER_MOVE_NAMESPACE::move_iterator<repeat_it> repeat_move_it;
+ typedef boost::move_iterator<repeat_it> repeat_move_it;
    /// @endcond
 
    public:
@@ -471,7 +470,7 @@
    //! <b>Throws</b>: If allocator_type's copy constructor throws.
    //!
    //! <b>Complexity</b>: Constant.
- vector(BOOST_MOVE_MACRO_RV_REF(vector) mx)
+ vector(BOOST_RV_REF(vector) mx)
       : base_t(static_cast<base_t&>(mx).alloc())
    { this->swap(mx); }
 
@@ -780,8 +779,8 @@
          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_CONTAINER_MOVE_NAMESPACE::move_iterator<T*>, T*>
- proxy(::BOOST_CONTAINER_MOVE_NAMESPACE::make_move_iterator(dummy_it), ::BOOST_CONTAINER_MOVE_NAMESPACE::make_move_iterator(dummy_it));
+ 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));
             //Backwards (and possibly forward) expansion
             if(ret.second){
                #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
@@ -818,7 +817,7 @@
    //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
    //!
    //! <b>Complexity</b>: Linear to the number of elements in x.
- vector& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(vector) 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);
@@ -834,7 +833,7 @@
    //! <b>Throws</b>: If allocator_type's copy constructor throws.
    //!
    //! <b>Complexity</b>: Linear.
- vector& operator=(BOOST_MOVE_MACRO_RV_REF(vector) x)
+ vector& operator=(BOOST_RV_REF(vector) x)
    {
       if (&x != this){
          this->swap(x);
@@ -861,17 +860,32 @@
    void assign(InIt first, InIt last)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InIt, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InIt, size_type>::value;
       typedef containers_detail::bool_<aux_boolean> Result;
       this->priv_assign_dispatch(first, last, Result());
    }
 
+ #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
    //! <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.
    //!
    //! <b>Complexity</b>: Amortized constant time.
+ void push_back(const T &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.
+ void push_back(T &&x);
+ #else
+ 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); }
 
@@ -879,11 +893,13 @@
    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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value
- >::type* =0)
+ 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
@@ -892,17 +908,25 @@
    //! <b>Throws</b>: If memory allocation throws.
    //!
    //! <b>Complexity</b>: Amortized constant time.
- void push_back(BOOST_MOVE_MACRO_RV_REF(T) x)
+ 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_CONTAINER_MOVE_NAMESPACE::move(x));
+ 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_CONTAINER_MOVE_NAMESPACE::move(x));
+ 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)
 
@@ -918,12 +942,12 @@
       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(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ new((void*)(back_pos))value_type(::boost::forward<Args>(args)...);
          ++this->members_.m_size;
       }
       else{
          typedef containers_detail::advanced_insert_aux_emplace<T, T*, Args...> type;
- type &&proxy = type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ type &&proxy = type(::boost::forward<Args>(args)...);
          priv_range_insert(back_pos, 1, proxy);
       }
    }
@@ -943,7 +967,7 @@
       //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_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ type &&proxy = type(::boost::forward<Args>(args)...);
       priv_range_insert(position.get_ptr(), 1, proxy);
       return iterator(this->members_.m_start + pos_n);
    }
@@ -974,30 +998,30 @@
 
    #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, _)) \
+ void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
    { \
       T* back_pos = containers_detail::get_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, _)); \
+ (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
          ++this->members_.m_size; \
       } \
       else{ \
- containers_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
+ 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, _)); \
+ proxy(BOOST_PP_ENUM(n, BOOST_CONTAINERS_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, _)) \
+ iterator emplace(const_iterator pos, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
    { \
       size_type pos_n = pos - cbegin(); \
- containers_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
+ 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); \
+ proxy(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ priv_range_insert(containers_detail::get_pointer(pos.get_ptr()), 1, proxy); \
       return iterator(this->members_.m_start + pos_n); \
    } \
    //!
@@ -1026,6 +1050,7 @@
       }
    }
 
+ #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
    //! <b>Requires</b>: position must be a valid iterator of *this.
    //!
    //! <b>Effects</b>: Insert a copy of x before position.
@@ -1034,16 +1059,7 @@
    //!
    //! <b>Complexity</b>: If position is end(), amortized constant time
    //! Linear time otherwise.
- iterator insert(const_iterator position, insert_const_ref_type x)
- { return this->priv_insert(position, x); }
-
- #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- 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_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
- { return this->priv_insert(position, u); }
- #endif
+ iterator insert(const_iterator position, const T &x);
 
    //! <b>Requires</b>: position must be a valid iterator of *this.
    //!
@@ -1053,15 +1069,10 @@
    //!
    //! <b>Complexity</b>: If position is end(), amortized constant time
    //! Linear time otherwise.
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(T) x)
- {
- //Just call more general insert(pos, size, value) and return iterator
- size_type pos_n = position - cbegin();
- this->insert(position
- ,repeat_move_it(repeat_it(x, 1))
- ,repeat_move_it(repeat_it()));
- return iterator(this->members_.m_start + pos_n);
- }
+ iterator insert(const_iterator position, T &&x);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
+ #endif
 
    //! <b>Requires</b>: pos must be a valid iterator of *this.
    //!
@@ -1075,7 +1086,7 @@
    void insert(const_iterator pos, InIt first, InIt last)
    {
       //Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InIt, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InIt, size_type>::value;
       typedef containers_detail::bool_<aux_boolean> Result;
       this->priv_insert_dispatch(pos, first, last, Result());
    }
@@ -1112,7 +1123,7 @@
    {
       T *pos = containers_detail::get_pointer(position.get_ptr());
       T *beg = containers_detail::get_pointer(this->members_.m_start);
- BOOST_CONTAINER_MOVE_NAMESPACE::move(pos + 1, beg + this->members_.m_size, pos);
+ ::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);
@@ -1128,7 +1139,7 @@
    {
       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_CONTAINER_MOVE_NAMESPACE::move
+ T* ptr = containers_detail::get_pointer(boost::move
             (containers_detail::get_pointer(last.get_ptr())
             ,end_pos
             ,containers_detail::get_pointer(first.get_ptr())
@@ -1207,15 +1218,26 @@
       return iterator(this->members_.m_start + pos_n);
    }
 
- void priv_push_back(const T &x)
+ iterator priv_insert(const_iterator position, BOOST_RV_REF(T) x)
+ {
+ //Just call more general insert(pos, size, value) and return iterator
+ size_type pos_n = position - cbegin();
+ this->insert(position
+ ,repeat_move_it(repeat_it(x, 1))
+ ,repeat_move_it(repeat_it()));
+ return iterator(this->members_.m_start + pos_n);
+ }
+
+ template <class U>
+ void priv_push_back(BOOST_MOVE_CATCH_FWD(U) 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(x);
+ new((void*)containers_detail::get_pointer(this->members_.m_start + this->members_.m_size))value_type(::boost::forward<U>(x));
          ++this->members_.m_size;
       }
       else{
- this->insert(this->cend(), x);
+ this->insert(this->cend(), ::boost::forward<U>(x));
       }
    }
 
@@ -1335,10 +1357,10 @@
       if (elems_after > n){
          //New elements can be just copied.
          //Move to uninitialized memory last objects
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(old_finish - n, old_finish, old_finish);
+ ::boost::uninitialized_move(old_finish - n, old_finish, old_finish);
          this->members_.m_size += n;
          //Copy previous to last objects to the initialized end
- BOOST_CONTAINER_MOVE_NAMESPACE::move_backward(pos, old_finish - n, old_finish);
+ boost::move_backward(pos, old_finish - n, old_finish);
          //Insert new objects in the pos
          interf.copy_all_to(pos);
       }
@@ -1348,7 +1370,7 @@
          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_CONTAINER_MOVE_NAMESPACE::uninitialized_move
+ ::boost::uninitialized_move
             ( pos, old_finish, containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size);
          this->members_.m_size += elems_after;
          //Copy first new elements in pos
@@ -1370,7 +1392,7 @@
       //the start of the new buffer
       T *old_buffer = containers_detail::get_pointer(this->members_.m_start);
       if(old_buffer){
- new_finish = ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move
+ new_finish = ::boost::uninitialized_move
             (containers_detail::get_pointer(this->members_.m_start), pos, old_finish = new_finish);
          constructed_values_destroyer.increment_size(new_finish - old_finish);
       }
@@ -1381,7 +1403,7 @@
       //Initialize from the rest of the old buffer,
       //starting from previous point
       if(old_buffer){
- new_finish = ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move
+ new_finish = ::boost::uninitialized_move
             (pos, old_buffer + this->members_.m_size, new_finish);
          //Destroy and deallocate old elements
          //If there is allocated memory, destroy and deallocate
@@ -1422,7 +1444,7 @@
       //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_CONTAINER_MOVE_NAMESPACE::uninitialized_move(old_start, pos, new_start);
+ ::boost::uninitialized_move(old_start, pos, new_start);
          this->members_.m_size = elemsbefore;
          interf.uninitialized_copy_all_to(new_start + elemsbefore);
          this->members_.m_size += n;
@@ -1440,7 +1462,7 @@
             //|___________|__________|_________|________________________|
             //
             //Now initialize the rest of memory with the last old values
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move
+ ::boost::uninitialized_move
                (pos, old_finish, new_start + elemsbefore + n);
             //All new elements correctly constructed, avoid new element destruction
             this->members_.m_size = old_size + n;
@@ -1467,13 +1489,13 @@
             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_CONTAINER_MOVE_NAMESPACE::uninitialized_move(pos, pos + raw_gap, new_start + elemsbefore + n);
+ ::boost::uninitialized_move(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
             old_values_destroyer.release();
             //Now copy remaining last objects in the old buffer begin
- T *to_destroy = BOOST_CONTAINER_MOVE_NAMESPACE::move(pos + raw_gap, old_finish, old_start);
+ T *to_destroy = ::boost::move(pos + raw_gap, old_finish, old_start);
             //Now destroy redundant elements except if they were moved and
             //they have trivial destructor after move
             size_type n_destroy = old_finish - to_destroy;
@@ -1532,13 +1554,13 @@
             //
             //Copy the first part of old_begin to raw_mem
             T *start_n = old_start + difference_type(s_before);
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(old_start, start_n, new_start);
+ ::boost::uninitialized_move(old_start, start_n, new_start);
             //The buffer is all constructed until old_end,
             //release destroyer and update size
             old_values_destroyer.release();
             this->members_.m_size = old_size + s_before;
             //Now copy the second part of old_begin overwriting himself
- T* next = BOOST_CONTAINER_MOVE_NAMESPACE::move(start_n, pos, old_start);
+ T* next = ::boost::move(start_n, pos, old_start);
             if(do_after){
                //Now copy the new_beg elements
                interf.copy_some_and_update(next, s_before, true);
@@ -1548,7 +1570,7 @@
                interf.copy_all_to(next);
                T* move_start = next + n;
                //Now displace old_end elements
- T* move_end = BOOST_CONTAINER_MOVE_NAMESPACE::move(pos, old_finish, move_start);
+ T* move_end = ::boost::move(pos, old_finish, move_start);
                //Destroy remaining moved elements from old_end except if
                //they have trivial destructor after being moved
                difference_type n_destroy = s_before - n;
@@ -1584,7 +1606,7 @@
             //|___________|_____|_________|__________________________|
             //
             //First copy whole old_begin and part of new to raw_mem
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(old_start, pos, new_start);
+ ::boost::uninitialized_move(old_start, pos, new_start);
             this->members_.m_size = elemsbefore;
 
             const size_type mid_n = difference_type(s_before) - elemsbefore;
@@ -1603,7 +1625,7 @@
                interf.copy_all_to(old_start);
                T* move_start = old_start + (n-mid_n);
                //Displace old_end
- T* move_end = BOOST_CONTAINER_MOVE_NAMESPACE::move(pos, old_finish, move_start);
+ T* move_end = ::boost::move(pos, old_finish, move_start);
                //Destroy remaining moved elements from old_end except if they
                //have trivial destructor after being moved
                difference_type n_destroy = s_before - n;
@@ -1654,10 +1676,10 @@
                //
                //First copy the part of old_end raw_mem
                T* finish_n = old_finish - difference_type(n_after);
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(finish_n, old_finish, old_finish);
+ ::boost::uninitialized_move(finish_n, old_finish, old_finish);
                this->members_.m_size += n_after;
                //Displace the rest of old_end to the new position
- BOOST_CONTAINER_MOVE_NAMESPACE::move_backward(pos, finish_n, old_finish);
+ 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);
@@ -1680,7 +1702,7 @@
                //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_CONTAINER_MOVE_NAMESPACE::uninitialized_move(pos, old_finish, old_finish + mid_last_dist);
+ ::boost::uninitialized_move(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);
@@ -1693,7 +1715,7 @@
    void priv_range_insert(const_iterator pos, InIt first, InIt last, std::input_iterator_tag)
    {
       for(;first != last; ++first){
- this->insert(pos, BOOST_CONTAINER_MOVE_NAMESPACE::move(value_type(*first)));
+ this->insert(pos, ::boost::move(value_type(*first)));
       }
    }
 
@@ -1764,14 +1786,14 @@
             T *end = std::copy(first, mid, start);
             //Initialize the remaining new elements in the uninitialized memory
             // iG std::uninitialized_copy(mid, last, end);
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(mid, last, end);
+ ::boost::uninitialized_copy_or_move(mid, last, end);
             this->members_.m_size = n;
          }
       }
       else if(!ret.second){
          typename value_traits::UCopiedArrayDeallocator scoped_alloc(ret.first, this->alloc(), real_cap);
          // iG std::uninitialized_copy(first, last, containers_detail::get_pointer(ret.first));
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first, last, containers_detail::get_pointer(ret.first));
+ ::boost::uninitialized_copy_or_move(first, last, containers_detail::get_pointer(ret.first));
          scoped_alloc.release();
          //Destroy and deallocate old buffer
          if(this->members_.m_start != 0){
@@ -1801,7 +1823,7 @@
          FwdIt mid = first;
          std::advance(mid, first_count);
          // iG std::uninitialized_copy(first, mid, containers_detail::get_pointer(ret.first));
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first, mid, containers_detail::get_pointer(ret.first));
+ ::boost::uninitialized_copy_or_move(first, mid, containers_detail::get_pointer(ret.first));
 
          if(old_offset > n){
             //All old elements will be destroyed by "old_values_destroyer"

Modified: branches/release/boost/interprocess/containers/pair.hpp
==============================================================================
--- branches/release/boost/interprocess/containers/pair.hpp (original)
+++ branches/release/boost/interprocess/containers/pair.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -23,6 +23,7 @@
 namespace interprocess {
 
 using boost::container::containers_detail::pair;
+using boost::container::containers_detail::piecewise_construct;
 
 } //namespace interprocess {
 } //namespace boost {

Modified: branches/release/boost/interprocess/detail/atomic.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/atomic.hpp (original)
+++ branches/release/boost/interprocess/detail/atomic.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -2,6 +2,7 @@
 //
 // (C) Copyright Ion Gaztanaga 2006-2009
 // (C) Copyright Markus Schoepflin 2007
+// (C) Copyright Bryce Lelbach 2010
 //
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
@@ -108,12 +109,21 @@
    (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp)
 {
    boost::uint32_t prev = cmp;
+ // This version by Mans Rullgard of Pathscale
+ __asm__ __volatile__ ( "lock\n\t"
+ "cmpxchg %2,%0"
+ : "+m"(*mem), "+a"(prev)
+ : "r"(with)
+ : "cc");
+
+ return prev;
+/*
    asm volatile( "lock\n\t"
                  "cmpxchg %3,%1"
                : "=a" (prev), "=m" (*(mem))
                : "0" (prev), "r" (with)
                : "memory", "cc");
- return prev;
+*/
 /*
    boost::uint32_t prev;
 

Modified: branches/release/boost/interprocess/detail/file_wrapper.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/file_wrapper.hpp (original)
+++ branches/release/boost/interprocess/detail/file_wrapper.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -25,7 +25,7 @@
 class file_wrapper
 {
    /// @cond
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(file_wrapper)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(file_wrapper)
    /// @endcond
    public:
 
@@ -52,14 +52,14 @@
    //!Moves the ownership of "moved"'s file to *this.
    //!After the call, "moved" does not represent any file.
    //!Does not throw
- file_wrapper(BOOST_INTERPROCESS_RV_REF(file_wrapper) moved)
+ file_wrapper(BOOST_RV_REF(file_wrapper) moved)
       : m_handle(file_handle_t(detail::invalid_file()))
    { this->swap(moved); }
 
    //!Moves the ownership of "moved"'s file to *this.
    //!After the call, "moved" does not represent any file.
    //!Does not throw
- file_wrapper &operator=(BOOST_INTERPROCESS_RV_REF(file_wrapper) moved)
+ file_wrapper &operator=(BOOST_RV_REF(file_wrapper) moved)
    {
       file_wrapper tmp(boost::interprocess::move(moved));
       this->swap(tmp);

Modified: branches/release/boost/interprocess/detail/in_place_interface.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/in_place_interface.hpp (original)
+++ branches/release/boost/interprocess/detail/in_place_interface.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -18,6 +18,7 @@
 #include <boost/interprocess/detail/config_begin.hpp>
 #include <boost/interprocess/detail/workaround.hpp>
 #include <boost/interprocess/detail/type_traits.hpp>
+#include <boost/type_traits/alignment_of.hpp>
 #include <typeinfo> //typeid
 
 //!\file
@@ -46,7 +47,7 @@
 struct placement_destroy : public in_place_interface
 {
    placement_destroy()
- : in_place_interface(detail::alignment_of<T>::value, sizeof(T), typeid(T).name())
+ : in_place_interface(::boost::alignment_of<T>::value, sizeof(T), typeid(T).name())
    {}
 
    virtual void destroy_n(void *mem, std::size_t num, std::size_t &destroyed)

Modified: branches/release/boost/interprocess/detail/intermodule_singleton.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/intermodule_singleton.hpp (original)
+++ branches/release/boost/interprocess/detail/intermodule_singleton.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -27,6 +27,7 @@
 #include <boost/interprocess/detail/tmp_dir_helpers.hpp>
 #include <boost/interprocess/detail/os_file_functions.hpp>
 #include <boost/interprocess/detail/mpl.hpp>
+#include <boost/type_traits/type_with_alignment.hpp>
 #include <boost/assert.hpp>
 #include <cstddef>
 #include <cstdio>
@@ -636,7 +637,7 @@
       return *static_cast<ManagedShMem *>(static_cast<void *>(&shm_mem));
    }
 
- enum { MemSize = ((sizeof(ManagedShMem)-1)/sizeof(max_align))+1u };
+ enum { MemSize = ((sizeof(ManagedShMem)-1)/sizeof(::boost::detail::max_align))+1u };
 
    static void initialize_shm();
    static void destroy_shm();
@@ -645,7 +646,7 @@
    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 max_align shm_mem[MemSize];
+ static ::boost::detail::max_align shm_mem[MemSize];
 };
 
 template<class ManagedShMem>
@@ -655,7 +656,7 @@
 volatile boost::uint32_t intermodule_singleton_common<ManagedShMem>::this_module_shm_initialized;
 
 template<class ManagedShMem>
-max_align intermodule_singleton_common<ManagedShMem>::shm_mem[intermodule_singleton_common<ManagedShMem>::MemSize];
+::boost::detail::max_align intermodule_singleton_common<ManagedShMem>::shm_mem[intermodule_singleton_common<ManagedShMem>::MemSize];
 
 template<class ManagedShMem>
 void intermodule_singleton_common<ManagedShMem>::initialize_shm()

Modified: branches/release/boost/interprocess/detail/intersegment_ptr.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/intersegment_ptr.hpp (original)
+++ branches/release/boost/interprocess/detail/intersegment_ptr.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -97,7 +97,7 @@
       std::size_t pow : pow_size_bits;
       std::size_t frc : frc_size_bits;
       std::size_t beg : begin_bits;
- std::ptrdiff_t off : sizeof(ptrdiff_t)*CHAR_BIT - 2;
+ std::ptrdiff_t off : sizeof(std::ptrdiff_t)*CHAR_BIT - 2;
       std::ptrdiff_t bits : 2;
    };
 
@@ -159,7 +159,7 @@
       std::size_t diff = orig_size - low_size;
       BOOST_ASSERT(pow >= frc_size_bits);
       std::size_t rounded = detail::get_rounded_size_po2
- (diff, (1u << (pow - frc_size_bits)));
+ (diff, (std::size_t)(1u << (pow - frc_size_bits)));
       if(rounded == low_size){
          ++pow;
          frc = 0;
@@ -762,7 +762,7 @@
    //!This only works with two basic_intersegment_ptr pointing
    //!to the same segment. Otherwise undefined
    template <class T2>
- ptrdiff_t _diff(const intersegment_ptr<T2> &other) const
+ std::ptrdiff_t _diff(const intersegment_ptr<T2> &other) const
    { return base_t::diff(other); }
 
    //!Returns true if both point to the
@@ -1037,5 +1037,6 @@
 
 #endif
 
-#endif //#ifndef BOOST_INTERPROCESS_INTERSEGMENT_PTR_HPP
+#include <boost/interprocess/detail/config_end.hpp>
 
+#endif //#ifndef BOOST_INTERPROCESS_INTERSEGMENT_PTR_HPP

Modified: branches/release/boost/interprocess/detail/managed_memory_impl.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/managed_memory_impl.hpp (original)
+++ branches/release/boost/interprocess/detail/managed_memory_impl.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -86,7 +86,9 @@
    typedef MemoryAlgorithm memory_algorithm;
    typedef typename MemoryAlgorithm::mutex_family mutex_family;
    typedef CharType char_t;
- typedef std::ptrdiff_t handle_t;
+ typedef typename MemoryAlgorithm::size_type size_type;
+ typedef typename MemoryAlgorithm::difference_type difference_type;
+ typedef difference_type handle_t;
    typedef typename segment_manager::
       const_named_iterator const_named_iterator;
    typedef typename segment_manager::
@@ -102,14 +104,14 @@
 
    /// @endcond
 
- static const std::size_t PayloadPerAllocation = segment_manager::PayloadPerAllocation;
+ static const size_type PayloadPerAllocation = segment_manager::PayloadPerAllocation;
 
    private:
    typedef basic_managed_memory_impl
                <CharType, MemoryAlgorithm, IndexType, Offset> self_t;
    protected:
    template<class ManagedMemory>
- static bool grow(const char *filename, std::size_t extra_bytes)
+ static bool grow(const char *filename, size_type extra_bytes)
    {
       typedef typename ManagedMemory::device_type device_type;
       //Increase file size
@@ -135,7 +137,7 @@
    static bool shrink_to_fit(const char *filename)
    {
       typedef typename ManagedMemory::device_type device_type;
- std::size_t new_size, old_size;
+ size_type new_size, old_size;
       try{
          ManagedMemory managed_memory(open_only, filename);
          old_size = managed_memory.get_size();
@@ -163,7 +165,7 @@
    { this->close_impl(); }
 
    //!Places segment manager in the reserved space. This can throw.
- bool create_impl (void *addr, std::size_t size)
+ bool create_impl (void *addr, size_type size)
    {
       if(mp_header) return false;
 
@@ -185,7 +187,7 @@
    }
  
    //!Connects to a segment manager in the reserved buffer. Never throws.
- bool open_impl (void *addr, std::size_t)
+ bool open_impl (void *addr, size_type)
    {
       if(mp_header) return false;
       mp_header = static_cast<segment_manager*>(addr);
@@ -211,7 +213,7 @@
    }
 
    //!
- void grow(std::size_t extra_bytes)
+ void grow(size_type extra_bytes)
    { mp_header->grow(extra_bytes); }
 
    void shrink_to_fit()
@@ -228,12 +230,12 @@
    { return reinterpret_cast<char*>(mp_header) - Offset; }
 
    //!Returns the size of memory segment. Never throws.
- std::size_t get_size () const
+ size_type get_size () const
    { return mp_header->get_size() + Offset; }
 
    //!Returns the number of free bytes of the memory
    //!segment
- std::size_t get_free_memory() const
+ size_type get_free_memory() const
    { return mp_header->get_free_memory(); }
 
    //!Returns the result of "all_memory_deallocated()" function
@@ -255,8 +257,8 @@
    //!The address must belong to the memory segment. Never throws.
    handle_t get_handle_from_address (const void *ptr) const
    {
- return reinterpret_cast<const char*>(ptr) -
- reinterpret_cast<const char*>(this->get_address());
+ return (handle_t)(reinterpret_cast<const char*>(ptr) -
+ reinterpret_cast<const char*>(this->get_address()));
    }
 
    //!Returns true if the address belongs to the managed memory segment
@@ -274,25 +276,25 @@
    //!Searches for nbytes of free memory in the segment, marks the
    //!memory as used and return the pointer to the memory. If no
    //!memory is available throws a boost::interprocess::bad_alloc exception
- void* allocate (std::size_t nbytes)
+ void* allocate (size_type nbytes)
    { return mp_header->allocate(nbytes); }
 
    //!Searches for nbytes of free memory in the segment, marks the
    //!memory as used and return the pointer to the memory. If no memory
    //!is available returns 0. Never throws.
- void* allocate (std::size_t nbytes, std::nothrow_t nothrow)
+ void* allocate (size_type nbytes, std::nothrow_t nothrow)
    { return mp_header->allocate(nbytes, nothrow); }
 
    //!Allocates nbytes bytes aligned to "alignment" bytes. "alignment"
    //!must be power of two. If no memory
    //!is available returns 0. Never throws.
- void * allocate_aligned (std::size_t nbytes, std::size_t alignment, std::nothrow_t nothrow)
+ void * allocate_aligned (size_type nbytes, size_type alignment, std::nothrow_t nothrow)
    { return mp_header->allocate_aligned(nbytes, alignment, nothrow); }
 
    template<class T>
    std::pair<T *, bool>
- allocation_command (boost::interprocess::allocation_type command, std::size_t limit_size,
- std::size_t preferred_size,std::size_t &received_size,
+ allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
+ size_type preferred_size,size_type &received_size,
                            T *reuse_ptr = 0)
    {
       return mp_header->allocation_command
@@ -302,7 +304,7 @@
    //!Allocates nbytes bytes aligned to "alignment" bytes. "alignment"
    //!must be power of two. If no
    //!memory is available throws a boost::interprocess::bad_alloc exception
- void * allocate_aligned(std::size_t nbytes, std::size_t alignment)
+ void * allocate_aligned(size_type nbytes, size_type alignment)
    { return mp_header->allocate_aligned(nbytes, alignment); }
 
    /// @cond
@@ -310,19 +312,19 @@
    //Experimental. Don't use.
 
    //!Allocates n_elements of elem_size bytes.
- multiallocation_chain allocate_many(std::size_t elem_bytes, std::size_t num_elements)
+ multiallocation_chain allocate_many(size_type elem_bytes, size_type num_elements)
    { return mp_header->allocate_many(elem_bytes, num_elements); }
 
    //!Allocates n_elements, each one of elem_sizes[i] bytes.
- multiallocation_chain allocate_many(const std::size_t *elem_sizes, std::size_t n_elements)
+ multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements)
    { return mp_header->allocate_many(elem_sizes, n_elements); }
 
    //!Allocates n_elements of elem_size bytes.
- multiallocation_chain allocate_many(std::size_t elem_bytes, std::size_t num_elements, std::nothrow_t nothrow)
+ multiallocation_chain allocate_many(size_type elem_bytes, size_type num_elements, std::nothrow_t nothrow)
    { return mp_header->allocate_many(elem_bytes, num_elements, nothrow); }
 
    //!Allocates n_elements, each one of elem_sizes[i] bytes.
- multiallocation_chain allocate_many(const std::size_t *elem_sizes, std::size_t n_elements, std::nothrow_t nothrow)
+ multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements, std::nothrow_t nothrow)
    { return mp_header->allocate_many(elem_sizes, n_elements, nothrow); }
 
    //!Allocates n_elements, each one of elem_sizes[i] bytes.
@@ -339,7 +341,7 @@
    //!buffer and the object count. If not found returned pointer is 0.
    //!Never throws.
    template <class T>
- std::pair<T*, std::size_t> find (char_ptr_holder_t name)
+ std::pair<T*, size_type> find (char_ptr_holder_t name)
    { return mp_header->template find<T>(name); }
 
    //!Creates a named object or array in memory
@@ -619,19 +621,19 @@
    //!Returns the length of an object created with construct/find_or_construct
    //!functions (1 if is a single element, >=1 if it's an array). Does not throw.
    template<class T>
- static std::size_t get_instance_length(const T *ptr)
+ static size_type get_instance_length(const T *ptr)
    { return segment_manager::get_instance_length(ptr); }
 
    //!Preallocates needed index resources to optimize the
    //!creation of "num" named objects in the memory segment.
    //!Can throw boost::interprocess::bad_alloc if there is no enough memory.
- void reserve_named_objects(std::size_t num)
+ void reserve_named_objects(size_type num)
    { mp_header->reserve_named_objects(num); }
 
    //!Preallocates needed index resources to optimize the
    //!creation of "num" unique objects in the memory segment.
    //!Can throw boost::interprocess::bad_alloc if there is no enough memory.
- void reserve_unique_objects(std::size_t num)
+ void reserve_unique_objects(size_type num)
    { mp_header->reserve_unique_objects(num); }
 
    //!Calls shrink_to_fit in both named and unique object indexes
@@ -641,12 +643,12 @@
 
    //!Returns the number of named objects stored
    //!in the managed segment.
- std::size_t get_num_named_objects()
+ size_type get_num_named_objects()
    { return mp_header->get_num_named_objects(); }
 
    //!Returns the number of unique objects stored
    //!in the managed segment.
- std::size_t get_num_unique_objects()
+ size_type get_num_unique_objects()
    { return mp_header->get_num_unique_objects(); }
 
    //!Returns a constant iterator to the index storing the
@@ -704,7 +706,7 @@
    //!buffer and the object count. If not found returned pointer is 0.
    //!Never throws.
    template <class T>
- std::pair<T*, std::size_t> find_no_lock (char_ptr_holder_t name)
+ std::pair<T*, size_type> find_no_lock (char_ptr_holder_t name)
    { return mp_header->template find_no_lock<T>(name); }
    /// @endcond
 
@@ -725,7 +727,7 @@
    create_open_func(BasicManagedMemoryImpl * const frontend, detail::create_enum_t type)
       : m_frontend(frontend), m_type(type){}
 
- bool operator()(void *addr, std::size_t size, bool created) const
+ bool operator()(void *addr, typename BasicManagedMemoryImpl::size_type size, bool created) const
    {
       if(((m_type == detail::DoOpen) && created) ||
          ((m_type == detail::DoCreate) && !created))

Modified: branches/release/boost/interprocess/detail/managed_multi_shared_memory.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/managed_multi_shared_memory.hpp (original)
+++ branches/release/boost/interprocess/detail/managed_multi_shared_memory.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -63,10 +63,15 @@
 
    typedef basic_managed_multi_shared_memory
                <CharType, MemoryAlgorithm, IndexType> self_t;
+ typedef detail::basic_managed_memory_impl
+ <CharType, MemoryAlgorithm, IndexType> base_t;
+
    typedef typename MemoryAlgorithm::void_pointer void_pointer;
    typedef typename detail::
       managed_open_or_create_impl<shared_memory_object> managed_impl;
    typedef typename void_pointer::segment_group_id segment_group_id;
+ typedef typename base_t::size_type size_type;
+
    ////////////////////////////////////////////////////////////////////////
    //
    // Some internal helper structs/functors
@@ -86,7 +91,7 @@
 // const void *addr)
 // : m_shmem(shmem), m_mem_name(mem_name), m_addr(addr){}
 //
-// void *operator()(std::size_t size)
+// void *operator()(size_type size)
 // {
 // if(!m_shmem.create(m_mem_name, size, m_addr))
 // return 0;
@@ -102,7 +107,7 @@
       : public multi_segment_services
    {
       public:
- typedef std::pair<void *, std::size_t> result_type;
+ typedef std::pair<void *, size_type> result_type;
       typedef basic_managed_multi_shared_memory frontend_t;
       typedef typename
          basic_managed_multi_shared_memory::void_pointer void_pointer;
@@ -110,7 +115,7 @@
       group_services(frontend_t *const frontend)
          : mp_frontend(frontend), m_group(0), m_min_segment_size(0){}
 
- virtual std::pair<void *, std::size_t> create_new_segment(std::size_t alloc_size)
+ virtual std::pair<void *, size_type> create_new_segment(size_type alloc_size)
       {
          //We should allocate an extra byte so that the
          //[base_addr + alloc_size] byte belongs to this segment
@@ -138,17 +143,17 @@
       segment_group_id get_group() const
          { return m_group; }
 
- void set_min_segment_size(std::size_t min_segment_size)
+ void set_min_segment_size(size_type min_segment_size)
          { m_min_segment_size = min_segment_size; }
 
- std::size_t get_min_segment_size() const
+ size_type get_min_segment_size() const
          { return m_min_segment_size; }
 
       private:
 
       frontend_t * const mp_frontend;
       segment_group_id m_group;
- std::size_t m_min_segment_size;
+ size_type m_min_segment_size;
    };
 
    //!Functor to execute atomically when opening or creating a shared memory
@@ -160,10 +165,10 @@
          basic_managed_multi_shared_memory::void_pointer void_pointer;
 
       create_open_func(self_t * const frontend,
- type_t type, std::size_t segment_number)
+ type_t type, size_type segment_number)
          : mp_frontend(frontend), m_type(type), m_segment_number(segment_number){}
 
- bool operator()(void *addr, std::size_t size, bool created) const
+ bool operator()(void *addr, size_type size, bool created) const
       {
          if(((m_type == DoOpen) && created) ||
             ((m_type == DoCreate) && !created))
@@ -203,7 +208,7 @@
       }
       self_t * const mp_frontend;
       type_t m_type;
- std::size_t m_segment_number;
+ size_type m_segment_number;
    };
 
    //!Functor to execute atomically when closing a shared memory segment.
@@ -223,9 +228,6 @@
       self_t * const mp_frontend;
    };
 
- typedef detail::basic_managed_memory_impl
- <CharType, MemoryAlgorithm, IndexType> base_t;
-
    //Friend declarations
    friend struct basic_managed_multi_shared_memory::create_open_func;
    friend struct basic_managed_multi_shared_memory::close_func;
@@ -240,7 +242,7 @@
 
    basic_managed_multi_shared_memory(create_only_t,
                                      const char *name,
- std::size_t size,
+ size_type size,
                                      const permissions &perm = permissions())
       : m_group_services(get_this_pointer())
    {
@@ -249,7 +251,7 @@
 
    basic_managed_multi_shared_memory(open_or_create_t,
                                      const char *name,
- std::size_t size,
+ size_type size,
                                      const permissions &perm = permissions())
       : m_group_services(get_this_pointer())
    {
@@ -268,7 +270,7 @@
    private:
    bool priv_open_or_create(typename create_open_func::type_t type,
                              const char *name,
- std::size_t size,
+ size_type size,
                              const permissions &perm)
    {
       if(!m_shmem_list.empty())
@@ -298,17 +300,17 @@
    }
 
    bool priv_new_segment(typename create_open_func::type_t type,
- std::size_t size,
+ size_type size,
                           const void *addr,
                           const permissions &perm)
    {
       BOOST_TRY{
          //Get the number of groups of this multi_segment group
- std::size_t segment_id = m_shmem_list.size();
+ size_type segment_id = m_shmem_list.size();
          //Format the name of the shared memory: append segment number.
          boost::interprocess::basic_ovectorstream<boost::interprocess::string> formatter;
          //Pre-reserve string size
- std::size_t str_size = m_root_name.length()+10;
+ size_type str_size = m_root_name.length()+10;
          if(formatter.vector().size() < str_size){
             //This can throw.
             formatter.reserve(str_size);

Modified: branches/release/boost/interprocess/detail/managed_open_or_create_impl.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/managed_open_or_create_impl.hpp (original)
+++ branches/release/boost/interprocess/detail/managed_open_or_create_impl.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -11,6 +11,7 @@
 #ifndef BOOST_INTERPROCESS_MANAGED_OPEN_OR_CREATE_IMPL
 #define BOOST_INTERPROCESS_MANAGED_OPEN_OR_CREATE_IMPL
 
+#include <boost/interprocess/detail/config_begin.hpp>
 #include <boost/interprocess/detail/os_thread_functions.hpp>
 #include <boost/interprocess/detail/os_file_functions.hpp>
 #include <boost/interprocess/creation_tags.hpp>
@@ -23,6 +24,8 @@
 #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/cstdint.hpp>
 
 namespace boost {
@@ -86,7 +89,7 @@
    : public managed_open_or_create_impl_device_holder<StoreDevice, DeviceAbstraction>
 {
    //Non-copyable
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(managed_open_or_create_impl)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(managed_open_or_create_impl)
 
    typedef typename managed_open_or_create_impl_device_id_t<DeviceAbstraction>::type device_id_t;
    typedef managed_open_or_create_impl_device_holder<StoreDevice, DeviceAbstraction> DevHolder;
@@ -103,7 +106,7 @@
       ManagedOpenOrCreateUserOffset =
          detail::ct_rounded_size
             < sizeof(boost::uint32_t)
- , detail::alignment_of<detail::max_align>::value>::value;
+ , ::boost::alignment_of< ::boost::detail::max_align >::value >::value;
 
    managed_open_or_create_impl()
    {}
@@ -213,10 +216,10 @@
          , construct_func);
    }
 
- managed_open_or_create_impl(BOOST_INTERPROCESS_RV_REF(managed_open_or_create_impl) moved)
+ managed_open_or_create_impl(BOOST_RV_REF(managed_open_or_create_impl) moved)
    { this->swap(moved); }
 
- managed_open_or_create_impl &operator=(BOOST_INTERPROCESS_RV_REF(managed_open_or_create_impl) moved)
+ 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));
       this->swap(tmp);
@@ -260,13 +263,22 @@
 
    //These are templatized to allow explicit instantiations
    template<bool dummy>
- static void truncate_device(DeviceAbstraction &, std::size_t, detail::false_)
+ static void truncate_device(DeviceAbstraction &, offset_t, detail::false_)
    {} //Empty
 
    template<bool dummy>
- static void truncate_device(DeviceAbstraction &dev, std::size_t size, detail::true_)
+ static void truncate_device(DeviceAbstraction &dev, offset_t size, detail::true_)
    { dev.truncate(size); }
 
+
+ template<bool dummy>
+ static bool check_offset_t_size(std::size_t , detail::false_)
+ { return true; } //Empty
+
+ template<bool dummy>
+ static bool check_offset_t_size(std::size_t size, detail::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, detail::false_)
@@ -302,7 +314,10 @@
       if(type != detail::DoOpen && size < ManagedOpenOrCreateUserOffset){
          throw interprocess_exception(error_info(size_error));
       }
-
+ //Check size can be represented by offset_t (used by truncate)
+ if(type != detail::DoOpen && !check_offset_t_size<FileBased>(size, file_like_t())){
+ throw interprocess_exception(error_info(size_error));
+ }
       if(type == detail::DoOpen && mode == read_write){
          DeviceAbstraction tmp(open_only, id, read_write);
          tmp.swap(dev);
@@ -453,4 +468,6 @@
 } //namespace interprocess {
 } //namespace boost {
 
+#include <boost/interprocess/detail/config_end.hpp>
+
 #endif //#ifndef BOOST_INTERPROCESS_MANAGED_OPEN_OR_CREATE_IMPL

Modified: branches/release/boost/interprocess/detail/move.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/move.hpp (original)
+++ branches/release/boost/interprocess/detail/move.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -1,7 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright David Abrahams, Vicente Botet 2009.
-// (C) Copyright Ion Gaztanaga 2009-2010.
+// (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)
@@ -12,1146 +11,18 @@
 
 //! \file
 
-#ifndef BOOST_MOVE_DETAIL_MOVE_HPP
-#define BOOST_MOVE_DETAIL_MOVE_HPP
+#ifndef BOOST_INTERPROCESS_DETAIL_MOVE_HPP
+#define BOOST_INTERPROCESS_DETAIL_MOVE_HPP
 
-#include <boost/config.hpp>
-#include <algorithm> //copy, copy_backward
-#include <memory> //uninitialized_copy
-#include <iterator> //std::iterator
-#include <boost/mpl/if.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/mpl/bool.hpp>
-#include <boost/type_traits/has_trivial_destructor.hpp>
-#include <boost/utility/addressof.hpp>
-
-//! Defining or undefining this macro will change Boost.Move behaviour
-//! for copyable and movable classes when assigning from non-const rvalues:
-//! \code
-//! copyable_and_movable produce(){ return copyable_and_movable(); }
-//! \endcode
-//! If the macro is NOT defined:
-//! \code
-//! copyable_and_movable cm;
-//! cm = copyable_and_movable(); //object is COPIED (missed optimization)
-//! \endcode
-//! If the macro IS defined:
-//! \code
-//! copyable_and_movable cm;
-//! cm = copyable_and_movable(); //object is MOVED
-//! \endcode
-//! However, the second option has also some downsides. See documentation for more details.
-#define BOOST_MOVE_OPTIMIZED_EMULATION
-
-/// @cond
-
-//Define to easily port between Boost.Move and internal Boost.Interprocess move emulation
-//
-// This configuration is temporary. Boost.Interprocess emulation uses
-// different macros to avoid any redefinition of a top-levl Boost macro.
-// It will disappear once the library is accepted and
-// Boost.Interprocess is updated to the standard interface.
-//
-#define BOOST_MOVE_IN_BOOST_INTERPROCESS_NAMESPACE
-
-#ifdef BOOST_MOVE_IN_BOOST_INTERPROCESS_NAMESPACE
-
-#define INTERPROCESS_NAMESPACE_BEGIN namespace interprocess {
-#define INTERPROCESS_NAMESPACE_END }// namespace interprocess {
-#define BOOST_MOVE_NAMESPACE boost::interprocess
-
-#else //BOOST_MOVE_IN_BOOST_INTERPROCESS_NAMESPACE
-
-#define INTERPROCESS_NAMESPACE_BEGIN
-#define INTERPROCESS_NAMESPACE_END
-#define BOOST_MOVE_NAMESPACE boost
-
-#endif //BOOST_MOVE_IN_BOOST_INTERPROCESS_NAMESPACE
-
-namespace boost {
-INTERPROCESS_NAMESPACE_BEGIN
-namespace move_detail {
-
-template <class T>
-struct identity
-{
- typedef T type;
-};
-
-template <class T, class U>
-class is_convertible
-{
- typedef char true_t;
- class false_t { char dummy[2]; };
- static true_t dispatch(U);
- static false_t dispatch(...);
- static T trigger();
- public:
- enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) };
-};
-
-} //namespace move_detail {
-INTERPROCESS_NAMESPACE_END
-} //namespace boost {
-
-/// @endcond
-
-#if !defined(BOOST_NO_RVALUE_REFERENCES)
-
-#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 5)
-
-#define BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
-
-#else
-
-#if defined(_MSC_VER) && (_MSC_VER == 1600)
-#define BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG
-#endif
-
-#endif
-
-#endif
-
-
-#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
-
-#include <boost/type_traits/is_fundamental.hpp>
-#include <boost/type_traits/is_pointer.hpp>
-#include <boost/type_traits/is_same.hpp>
-
-#ifdef __GNUC__
-# define BOOST_MOVE_ATTRIBUTE_MAY_ALIAS __attribute__((__may_alias__))
-#else
-# define BOOST_MOVE_ATTRIBUTE_MAY_ALIAS
-#endif
-
-namespace boost {
-INTERPROCESS_NAMESPACE_BEGIN
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// struct rv
-//
-//////////////////////////////////////////////////////////////////////////////
-template <class T>
-class rv : public T
-{
- rv();
- ~rv();
- rv(rv const&);
- void operator=(rv const&);
-} BOOST_MOVE_ATTRIBUTE_MAY_ALIAS;
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// move_detail::is_rv
-//
-//////////////////////////////////////////////////////////////////////////////
-
-namespace move_detail {
-
-template <class T>
-struct is_rv
-{
- static const bool value = false;
-};
-
-template <class T>
-struct is_rv< rv<T> >
-{
- static const bool value = true;
-};
-
-} //namespace move_detail {
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// is_movable
-//
-//////////////////////////////////////////////////////////////////////////////
-template<class T>
-struct is_movable
- : public ::boost::mpl::bool_<move_detail::is_convertible<T, rv<T>&>::value>
-{
-};
-
-template<class T>
-struct is_movable< rv<T> >
- : public ::boost::mpl::bool_<false>
-{
-};
-
-template <class T>
-struct has_nothrow_move
- : public ::boost::mpl::bool_<false>
-{
-};
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// move()
-//
-//////////////////////////////////////////////////////////////////////////////
-template <class T>
-typename ::boost::disable_if<is_movable<T>, T&>::type move(T& x)
-{
- return x;
-}
-
-template <class T>
-typename enable_if<is_movable<T>, rv<T>&>::type move(T& x)
-{
- return *static_cast<rv<T>* >(boost::addressof(x));
-}
-
-template <class T>
-typename enable_if<is_movable<T>, rv<T>&>::type move(rv<T>& x)
-{
- return x;
-}
-
-
-#define BOOST_RV_REF(TYPE)\
- ::BOOST_MOVE_NAMESPACE::rv< TYPE >& \
-//
-
-#define BOOST_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\
- ::BOOST_MOVE_NAMESPACE::rv< TYPE<ARG1, ARG2> >& \
-//
-
-#define BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\
- ::BOOST_MOVE_NAMESPACE::rv< TYPE<ARG1, ARG2, ARG3> >& \
-//
-
-
-#define BOOST_FWD_REF(TYPE)\
- const TYPE & \
-//
-
-#define BOOST_CATCH_CONST_RLVALUE(TYPE)\
- const ::BOOST_MOVE_NAMESPACE::rv< TYPE >& \
-//
-
-#ifdef BOOST_MOVE_OPTIMIZED_EMULATION
-
-#define BOOST_COPY_ASSIGN_REF(TYPE)\
- const ::BOOST_MOVE_NAMESPACE::rv< TYPE >& \
-//
-
-#define BOOST_MOVE_MACRO_COPY_ASSIGN_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\
- const ::BOOST_MOVE_NAMESPACE::rv< TYPE<ARG1, ARG2> >& \
-//
-
-#define BOOST_MOVE_MACRO_COPY_ASSIGN_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\
- const ::BOOST_MOVE_NAMESPACE::rv< TYPE<ARG1, ARG2, ARG3> >& \
-//
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// forward()
-//
-//////////////////////////////////////////////////////////////////////////////
-
-template <class T>
-typename enable_if< ::BOOST_MOVE_NAMESPACE::move_detail::is_rv<T>, T &>::type
- forward(const typename move_detail::identity<T>::type &x)
-{
- return const_cast<T&>(x);
-}
-
-template <class T>
-typename disable_if< ::BOOST_MOVE_NAMESPACE::move_detail::is_rv<T>, const T &>::type
- forward(const typename move_detail::identity<T>::type &x)
-{
- return x;
-}
-
-#else //BOOST_MOVE_OPTIMIZED_EMULATION
-
-#define BOOST_COPY_ASSIGN_REF(TYPE)\
- const TYPE & \
-//
-
-#define BOOST_MOVE_MACRO_COPY_ASSIGN_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\
- const TYPE< ARG1, ARG2 >& \
-//
-
-#define BOOST_MOVE_MACRO_COPY_ASSIGN_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\
- const TYPE< ARG1, ARG2, ARG3 > & \
-//
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// forward()
-//
-//////////////////////////////////////////////////////////////////////////////
-
-//Catches const lvalues for movable types
-template <class T>
-const T&
- forward( BOOST_CATCH_CONST_RLVALUE(T) x
- , typename ::boost::enable_if_c< ::BOOST_MOVE_NAMESPACE::is_movable<T>::value >::type* = 0)
-{
- return static_cast<const T&>(x);
-}
-
-//Catches const lvalues for non-movable types
-template <class T>
-const T&
- forward( const T &x
- , typename ::boost::enable_if_c< !::BOOST_MOVE_NAMESPACE::is_movable<T>::value &&
- !::boost::move_detail::is_rv<T>::value
- >::type* = 0)
-{
- return static_cast<const T&>(x);
-}
-
-//Catches forwarded ::boost::rv<T> via BOOST_FWD_REFs
-template <class T>
-T &
- forward( const T &t
- , typename ::boost::enable_if_c< ::boost::move_detail::is_rv<T>::value >::type* = 0)
-{
- return const_cast<T&>(t);
-}
-
-//Catches forwarded ::boost::rv<T>
-template <class T, class U>
-const T &
- forward( const U &u
- , typename ::boost::enable_if_c< ::boost::is_same< ::boost::rv<T>, U >::value >::type * = 0)
-{
- return static_cast<const T&>(u);
-}
-
-//Catches non-const lvalues
-template <class T>
-T&
- forward( typename move_detail::identity<T>::type &x
- , typename ::boost::enable_if_c< !::boost::move_detail::is_rv<T>::value >::type* = 0)
-{
- return x;
-}
-
-//Catches non-const rvalues
-template <class T>
-typename enable_if<is_movable<T>, ::boost::rv<T> & >::type
- forward(BOOST_RV_REF(T) x)
-{ return x; }
-
-#endif
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// BOOST_MOVABLE_BUT_NOT_COPYABLE
-//
-//////////////////////////////////////////////////////////////////////////////
-#define BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)\
- private:\
- TYPE(TYPE &);\
- TYPE& operator=(TYPE &);\
- public:\
- operator ::BOOST_MOVE_NAMESPACE::rv<TYPE>&() \
- { return *static_cast< ::BOOST_MOVE_NAMESPACE::rv<TYPE>* >(this); }\
- operator const ::BOOST_MOVE_NAMESPACE::rv<TYPE>&() const \
- { return *static_cast<const ::BOOST_MOVE_NAMESPACE::rv<TYPE>* >(this); }\
- private:\
-//
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// BOOST_COPYABLE_AND_MOVABLE
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#ifdef BOOST_MOVE_OPTIMIZED_EMULATION
-
-#define BOOST_COPYABLE_AND_MOVABLE(TYPE)\
- public:\
- TYPE& operator=(TYPE &t)\
- { this->operator=(static_cast<const ::BOOST_MOVE_NAMESPACE::rv<TYPE> &>(const_cast<const TYPE &>(t))); return *this;}\
- public:\
- operator ::BOOST_MOVE_NAMESPACE::rv<TYPE>&() \
- { return *static_cast< ::BOOST_MOVE_NAMESPACE::rv<TYPE>* >(this); }\
- operator const ::BOOST_MOVE_NAMESPACE::rv<TYPE>&() const \
- { return *static_cast<const ::BOOST_MOVE_NAMESPACE::rv<TYPE>* >(this); }\
- private:\
-//
-
-#else //#ifdef BOOST_MOVE_OPTIMIZED_EMULATION
-
-#define BOOST_COPYABLE_AND_MOVABLE(TYPE)\
- public:\
- operator ::BOOST_MOVE_NAMESPACE::rv<TYPE>&() \
- { return *static_cast< ::BOOST_MOVE_NAMESPACE::rv<TYPE>* >(this); }\
- operator const ::BOOST_MOVE_NAMESPACE::rv<TYPE>&() const \
- { return *static_cast<const ::BOOST_MOVE_NAMESPACE::rv<TYPE>* >(this); }\
- private:\
-//
-
-#endif
-
-
-INTERPROCESS_NAMESPACE_END
-} //namespace boost
-
-#else //BOOST_NO_RVALUE_REFERENCES
-
-#include <boost/type_traits/remove_reference.hpp>
-
-namespace boost {
-INTERPROCESS_NAMESPACE_BEGIN
-
-/// @cond
-
-namespace move_detail {
-
-template<class T>
-struct is_lvalue_reference
- : public ::boost::mpl::bool_<false>
-{};
-
-template<class T>
-struct is_lvalue_reference<T&>
- : public ::boost::mpl::bool_<true>
-{};
-
-typedef char one;
-struct two {one _[2];};
-
-template <class T>
-struct internal_member_value_traits
-{
- template <class U> static one test(...);
- template <class U> static two test(typename U::boost_move_emulation_t* = 0);
- static const bool value = sizeof(test<T>(0)) == sizeof(two);
-};
-
-} //namespace move_detail {
-
-/// @endcond
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// is_movable
-//
-//////////////////////////////////////////////////////////////////////////////
-
-//! For compilers with rvalue references, this traits class returns true
-//! if BOOST_ENABLE_MOVE_EMULATION is activated.
-//!
-//! For other compilers returns true if T is convertible to <i>::boost::rv<T>&</i>
-template<class T>
-struct is_movable
- : public ::boost::mpl::bool_<move_detail::internal_member_value_traits<T>::value>
-{
-};
-
-//! By default this traits returns false. Classes with non-thworing move construction
-//! and assignment should specialize this trait to obtain some performance improvements.
-template <class T>
-struct has_nothrow_move
- : public ::boost::mpl::bool_<false>
-{};
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// move
-//
-//////////////////////////////////////////////////////////////////////////////
-
-
-#if defined(BOOST_MOVE_DOXYGEN_INVOKED)
-//! This function provides a way to convert a reference into a rvalue reference
-//! in compilers with rvalue references. For other compilers converts T & into
-//! <i>::boost::rv<T> &</i> so that move emulation is activated.
-template <class T> inline
-rvalue_reference move (input_reference);
-
-#else //BOOST_MOVE_DOXYGEN_INVOKED
-
-#if defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
-
-//Old move approach, lvalues could bind to rvalue references
-template <class T> inline
-typename remove_reference<T>::type && move(T&& t)
-{ return t; }
-
-#else //Old move
-
-template <class T> inline
-typename remove_reference<T>::type && move(T&& t)
-{ return static_cast<typename remove_reference<T>::type &&>(t); }
-
-#endif //Old move
-
-#endif //BOOST_MOVE_DOXYGEN_INVOKED
-
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// forward
-//
-//////////////////////////////////////////////////////////////////////////////
-
-
-#if defined(BOOST_MOVE_DOXYGEN_INVOKED)
-//! This function provides limited form of forwarding that is usually enough for
-//! in-place construction and avoids the exponential overloading necessary for
-//! perfect forwarding in C++03.
-//!
-//! For compilers with rvalue references this function provides perfect forwarding.
-//!
-//! Otherwise:
-//! * If input_reference binds to const ::boost::rv<T> & then it output_reference is
-//! ::boost::rev<T> &
-//!
-//! * Else, input_reference is equal to output_reference is equal to input_reference.
-template <class T> inline output_reference forward(input_reference);
-
-#else
-
-#if defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
-
-//Old move approach, lvalues could bind to rvalue references
-
-template <class T> inline
-T&& forward (typename move_detail::identity<T>::type&& t)
-{ return t; }
-
-#else //Old move
-
-//Implementation #5 from N2951, thanks to Howard Hinnant
-
-template <class T, class U>
-inline T&& forward(U&& t
- , typename enable_if_c<
- move_detail::is_lvalue_reference<T>::value ? move_detail::is_lvalue_reference<U>::value : true>::type * = 0/*
- , typename enable_if_c<
- move_detail::is_convertible
- <typename remove_reference<U>::type*, typename remove_reference<T>::type*>::value>::type * = 0*/)
-{ return static_cast<T&&>(t); }
-
-#endif //Old move
-
-#endif //BOOST_MOVE_DOXYGEN_INVOKED
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// BOOST_ENABLE_MOVE_EMULATION
-//
-//////////////////////////////////////////////////////////////////////////////
-
-///@cond
-
-#define BOOST_ENABLE_MOVE_EMULATION(TYPE)\
- typedef int boost_move_emulation_t;
-\
-//
-
-/// @endcond
-
-//! This macro marks a type as movable but not copyable, disabling copy construction
-//! and assignment. The user will need to write a move constructor/assignment as explained
-//! in the documentation to fully write a movable but not copyable class.
-#define BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)\
- public:\
- typedef int boost_move_emulation_t;\
- private:\
- TYPE(const TYPE &);\
- TYPE& operator=(const TYPE &);\
-//
-
-//! This macro marks a type as copyable and movable.
-//! The user will need to write a move constructor/assignment and a copy assignment
-//! as explained in the documentation to fully write a copyable and movable class.
-#define BOOST_COPYABLE_AND_MOVABLE(TYPE)\
- typedef int boost_move_emulation_t;
-//
-
-/// @cond
-
-#define BOOST_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\
- TYPE<ARG1, ARG2> && \
-//
-
-#define BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\
- TYPE<ARG1, ARG2, ARG3> && \
-//
-
-/// @endcond
-
-//!This macro is used to achieve portable syntax in move
-//!constructors and assignments for classes marked as
-//!BOOST_COPYABLE_AND_MOVABLE or BOOST_MOVABLE_BUT_NOT_COPYABLE
-#define BOOST_RV_REF(TYPE)\
- TYPE && \
-//
-
-//!This macro is used to achieve portable syntax in copy
-//!assignment for classes marked as BOOST_COPYABLE_AND_MOVABLE.
-#define BOOST_COPY_ASSIGN_REF(TYPE)\
- const TYPE & \
-//
-
-/// @cond
-
-#define BOOST_COPY_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\
- const TYPE<ARG1, ARG2> & \
-//
-
-#define BOOST_COPY_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\
- TYPE<ARG1, ARG2, ARG3>& \
-//
-
-/// @endcond
-
-//! This macro is used to implement portable perfect forwarding
-//! as explained in the documentation.
-#define BOOST_FWD_REF(TYPE)\
- TYPE && \
-//
-
-/// @cond
-
-#define BOOST_CATCH_CONST_RLVALUE(TYPE)\
- const TYPE & \
-//
-
-/// @endcond
-
-INTERPROCESS_NAMESPACE_END
-} //namespace boost {
-
-#endif //BOOST_NO_RVALUE_REFERENCES
+#include <boost/move/move.hpp>
 
 namespace boost {
-INTERPROCESS_NAMESPACE_BEGIN
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// move_iterator
-//
-//////////////////////////////////////////////////////////////////////////////
-
-//! Class template move_iterator is an iterator adaptor with the same behavior
-//! as the underlying iterator except that its dereference operator implicitly
-//! converts the value returned by the underlying iterator's dereference operator
-//! to an rvalue reference. Some generic algorithms can be called with move
-//! iterators to replace copying with moving.
-template <class It>
-class move_iterator
-{
- public:
- typedef It iterator_type;
- typedef typename std::iterator_traits<iterator_type>::value_type value_type;
- #if !defined(BOOST_NO_RVALUE_REFERENCES) || defined(BOOST_MOVE_DOXYGEN_INVOKED)
- typedef value_type && reference;
- #else
- typedef typename ::boost::mpl::if_
- < ::BOOST_MOVE_NAMESPACE::is_movable<value_type>
- , ::BOOST_MOVE_NAMESPACE::rv<value_type>&
- , value_type & >::type reference;
- #endif
- typedef It pointer;
- typedef typename std::iterator_traits<iterator_type>::difference_type difference_type;
- typedef typename std::iterator_traits<iterator_type>::iterator_category iterator_category;
-
- move_iterator()
- {}
-
- explicit move_iterator(It i)
- : m_it(i)
- {}
-
- template <class U>
- move_iterator(const move_iterator<U>& u)
- : m_it(u.base())
- {}
-
- iterator_type base() const
- { return m_it; }
-
- reference operator*() const
- {
- #if defined(BOOST_NO_RVALUE_REFERENCES) || defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
- return *m_it;
- #else
- return ::BOOST_MOVE_NAMESPACE::move(*m_it);
- #endif
- }
-
- pointer operator->() const
- { return m_it; }
-
- move_iterator& operator++()
- { ++m_it; return *this; }
-
- move_iterator<iterator_type> operator++(int)
- { move_iterator<iterator_type> tmp(*this); ++(*this); return tmp; }
-
- move_iterator& operator--()
- { --m_it; return *this; }
-
- move_iterator<iterator_type> operator--(int)
- { move_iterator<iterator_type> tmp(*this); --(*this); return tmp; }
-
- move_iterator<iterator_type> operator+ (difference_type n) const
- { return move_iterator<iterator_type>(m_it + n); }
-
- move_iterator& operator+=(difference_type n)
- { m_it += n; return *this; }
-
- move_iterator<iterator_type> operator- (difference_type n) const
- { return move_iterator<iterator_type>(m_it - n); }
-
- move_iterator& operator-=(difference_type n)
- { m_it -= n; return *this; }
-
- reference operator[](difference_type n) const
- {
- #if defined(BOOST_NO_RVALUE_REFERENCES) || defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
- return m_it[n];
- #else
- return ::BOOST_MOVE_NAMESPACE::move(m_it[n]);
- #endif
- }
-
- friend bool operator==(const move_iterator& x, const move_iterator& y)
- { return x.base() == y.base(); }
-
- friend bool operator!=(const move_iterator& x, const move_iterator& y)
- { return x.base() != y.base(); }
-
- friend bool operator< (const move_iterator& x, const move_iterator& y)
- { return x.base() < y.base(); }
-
- friend bool operator<=(const move_iterator& x, const move_iterator& y)
- { return x.base() <= y.base(); }
-
- friend bool operator> (const move_iterator& x, const move_iterator& y)
- { return x.base() > y.base(); }
-
- friend bool operator>=(const move_iterator& x, const move_iterator& y)
- { return x.base() >= y.base(); }
-
- friend difference_type operator-(const move_iterator& x, const move_iterator& y)
- { return x.base() - y.base(); }
-
- friend move_iterator operator+(difference_type n, const move_iterator& x)
- { return move_iterator(x.base() + n); }
-
- private:
- It m_it;
-};
-
-
-//is_move_iterator
-namespace move_detail {
-
-template <class I>
-struct is_move_iterator
- : public ::boost::mpl::bool_<false>
-{
-};
-
-template <class I>
-struct is_move_iterator< ::BOOST_MOVE_NAMESPACE::move_iterator<I> >
- : public ::boost::mpl::bool_<true>
-{
-};
-
-} //namespace move_detail {
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// move_iterator
-//
-//////////////////////////////////////////////////////////////////////////////
-
-//!
-//! <b>Returns</b>: move_iterator<It>(i).
-template<class It>
-move_iterator<It> make_move_iterator(const It &it)
-{ return move_iterator<It>(it); }
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// back_move_insert_iterator
-//
-//////////////////////////////////////////////////////////////////////////////
-
-
-//! A move insert iterator that move constructs elements at the
-//! back of a container
-template <typename C> // C models Container
-class back_move_insert_iterator
- : public std::iterator<std::output_iterator_tag, void, void, void, void>
-{
- C* container_m;
-
- public:
- typedef C container_type;
-
- explicit back_move_insert_iterator(C& x) : container_m(&x) { }
-
- back_move_insert_iterator& operator=(typename C::reference x)
- { container_m->push_back(BOOST_MOVE_NAMESPACE::move(x)); return *this; }
-
- back_move_insert_iterator& operator*() { return *this; }
- back_move_insert_iterator& operator++() { return *this; }
- back_move_insert_iterator& operator++(int) { return *this; }
-};
-
-//!
-//! <b>Returns</b>: back_move_insert_iterator<C>(x).
-template <typename C> // C models Container
-inline back_move_insert_iterator<C> back_move_inserter(C& x)
-{
- return back_move_insert_iterator<C>(x);
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// front_move_insert_iterator
-//
-//////////////////////////////////////////////////////////////////////////////
-
-//! A move insert iterator that move constructs elements int the
-//! front of a container
-template <typename C> // C models Container
-class front_move_insert_iterator
- : public std::iterator<std::output_iterator_tag, void, void, void, void>
-{
- C* container_m;
-
-public:
- typedef C container_type;
-
- explicit front_move_insert_iterator(C& x) : container_m(&x) { }
-
- front_move_insert_iterator& operator=(typename C::reference x)
- { container_m->push_front(BOOST_MOVE_NAMESPACE::move(x)); return *this; }
-
- front_move_insert_iterator& operator*() { return *this; }
- front_move_insert_iterator& operator++() { return *this; }
- front_move_insert_iterator& operator++(int) { return *this; }
-};
-
-//!
-//! <b>Returns</b>: front_move_insert_iterator<C>(x).
-template <typename C> // C models Container
-inline front_move_insert_iterator<C> front_move_inserter(C& x)
-{
- return front_move_insert_iterator<C>(x);
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// insert_move_iterator
-//
-//////////////////////////////////////////////////////////////////////////////
-template <typename C> // C models Container
-class move_insert_iterator
- : public std::iterator<std::output_iterator_tag, void, void, void, void>
-{
- C* container_m;
- typename C::iterator pos_;
-
- public:
- typedef C container_type;
-
- explicit move_insert_iterator(C& x, typename C::iterator pos)
- : container_m(&x), pos_(pos)
- {}
-
- move_insert_iterator& operator=(typename C::reference x)
- {
- pos_ = container_m->insert(pos_, ::BOOST_MOVE_NAMESPACE::move(x));
- ++pos_;
- return *this;
- }
-
- move_insert_iterator& operator*() { return *this; }
- move_insert_iterator& operator++() { return *this; }
- move_insert_iterator& operator++(int) { return *this; }
-};
-
-//!
-//! <b>Returns</b>: move_insert_iterator<C>(x, it).
-template <typename C> // C models Container
-inline move_insert_iterator<C> move_inserter(C& x, typename C::iterator it)
-{
- return move_insert_iterator<C>(x, it);
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// move
-//
-//////////////////////////////////////////////////////////////////////////////
-
-
-//! <b>Effects</b>: Moves elements in the range [first,last) into the range [result,result + (last -
-//! first)) starting from first and proceeding to last. For each non-negative integer n < (last-first),
-//! performs *(result + n) = ::boost::move (*(first + n)).
-//!
-//! <b>Effects</b>: result + (last - first).
-//!
-//! <b>Requires</b>: result shall not be in the range [first,last).
-//!
-//! <b>Complexity</b>: Exactly last - first move assignments.
-template <typename I, // I models InputIterator
- typename O> // O models OutputIterator
-O move(I f, I l, O result)
-{
- while (f != l) {
- *result = ::BOOST_MOVE_NAMESPACE::move(*f);
- ++f; ++result;
- }
- return result;
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// move_backward
-//
-//////////////////////////////////////////////////////////////////////////////
-
-//! <b>Effects</b>: Moves elements in the range [first,last) into the range
-//! [result - (last-first),result) starting from last - 1 and proceeding to
-//! first. For each positive integer n <= (last - first),
-//! performs *(result - n) = ::boost::move(*(last - n)).
-//!
-//! <b>Requires</b>: result shall not be in the range [first,last).
-//!
-//! <b>Returns</b>: result - (last - first).
-//!
-//! <b>Complexity</b>: Exactly last - first assignments.
-template <typename I, // I models BidirectionalIterator
-typename O> // O models BidirectionalIterator
-O move_backward(I f, I l, O result)
-{
- while (f != l) {
- --l; --result;
- *result = ::BOOST_MOVE_NAMESPACE::move(*l);
- }
- return result;
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// uninitialized_move
-//
-//////////////////////////////////////////////////////////////////////////////
-
-//! <b>Effects</b>:
-//! \code
-//! for (; first != last; ++result, ++first)
-//! new (static_cast<void*>(&*result))
-//! typename iterator_traits<ForwardIterator>::value_type(boost::move(*first));
-//! \endcode
-//!
-//! <b>Returns</b>: result
-template
- <typename I, // I models InputIterator
- typename F> // F models ForwardIterator
-F uninitialized_move(I f, I l, F r
- /// @cond
- ,typename enable_if<is_movable<typename std::iterator_traits<I>::value_type> >::type* = 0
- /// @endcond
- )
-{
- typedef typename std::iterator_traits<I>::value_type input_value_type;
- while (f != l) {
- ::new(static_cast<void*>(&*r)) input_value_type(BOOST_MOVE_NAMESPACE::move(*f));
- ++f; ++r;
- }
- return r;
-}
-
-/// @cond
-
-template
- <typename I, // I models InputIterator
- typename F> // F models ForwardIterator
-F uninitialized_move(I f, I l, F r,
- typename disable_if<is_movable<typename std::iterator_traits<I>::value_type> >::type* = 0)
-{
- return std::uninitialized_copy(f, l, r);
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// uninitialized_copy_or_move
-//
-//////////////////////////////////////////////////////////////////////////////
-
-namespace move_detail {
-
-template
-<typename I, // I models InputIterator
-typename F> // F models ForwardIterator
-F uninitialized_move_move_iterator(I f, I l, F r,
- typename enable_if< is_movable<typename I::value_type> >::type* = 0)
-{
- return ::BOOST_MOVE_NAMESPACE::uninitialized_move(f, l, r);
-}
-
-template
-<typename I, // I models InputIterator
-typename F> // F models ForwardIterator
-F uninitialized_move_move_iterator(I f, I l, F r,
- typename disable_if< is_movable<typename I::value_type> >::type* = 0)
-{
- return std::uninitialized_copy(f.base(), l.base(), r);
-}
-
-} //namespace move_detail {
-
-template
-<typename I, // I models InputIterator
-typename F> // F models ForwardIterator
-F uninitialized_copy_or_move(I f, I l, F r,
- typename enable_if< move_detail::is_move_iterator<I> >::type* = 0)
-{
- return ::BOOST_MOVE_NAMESPACE::move_detail::uninitialized_move_move_iterator(f, l, r);
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// copy_or_move
-//
-//////////////////////////////////////////////////////////////////////////////
-
-namespace move_detail {
-
-template
-<typename I, // I models InputIterator
-typename F> // F models ForwardIterator
-F move_move_iterator(I f, I l, F r,
- typename enable_if< is_movable<typename I::value_type> >::type* = 0)
-{
- return ::BOOST_MOVE_NAMESPACE::move(f, l, r);
-}
-
-template
-<typename I, // I models InputIterator
-typename F> // F models ForwardIterator
-F move_move_iterator(I f, I l, F r,
- typename disable_if< is_movable<typename I::value_type> >::type* = 0)
-{
- return std::copy(f.base(), l.base(), r);
-}
-
-
-} //namespace move_detail {
-
-template
-<typename I, // I models InputIterator
-typename F> // F models ForwardIterator
-F copy_or_move(I f, I l, F r,
- typename enable_if< move_detail::is_move_iterator<I> >::type* = 0)
-{
- return ::BOOST_MOVE_NAMESPACE::move_detail::move_move_iterator(f, l, r);
-}
-
-/// @endcond
-
-//! <b>Effects</b>:
-//! \code
-//! for (; first != last; ++result, ++first)
-//! new (static_cast<void*>(&*result))
-//! typename iterator_traits<ForwardIterator>::value_type(*first);
-//! \endcode
-//!
-//! <b>Returns</b>: result
-//!
-//! <b>Note</b>: This function is provided because
-//! <i>std::uninitialized_copy</i> from some STL implementations
-//! is not compatible with <i>move_iterator</i>
-template
-<typename I, // I models InputIterator
-typename F> // F models ForwardIterator
-F uninitialized_copy_or_move(I f, I l, F r
- /// @cond
- ,typename disable_if< move_detail::is_move_iterator<I> >::type* = 0
- /// @endcond
- )
-{
- return std::uninitialized_copy(f, l, r);
-}
-
-//! <b>Effects</b>:
-//! \code
-//! for (; first != last; ++result, ++first)
-//! *result = *first;
-//! \endcode
-//!
-//! <b>Returns</b>: result
-//!
-//! <b>Note</b>: This function is provided because
-//! <i>std::uninitialized_copy</i> from some STL implementations
-//! is not compatible with <i>move_iterator</i>
-template
-<typename I, // I models InputIterator
-typename F> // F models ForwardIterator
-F copy_or_move(I f, I l, F r
- /// @cond
- ,typename disable_if< move_detail::is_move_iterator<I> >::type* = 0
- /// @endcond
- )
-{
- return std::copy(f, l, r);
-}
-
-//! If this trait yields to true
-//! (<i>has_trivial_destructor_after_move &lt;T&gt;::value == true</i>)
-//! means that if T is used as argument of a move construction/assignment,
-//! there is no need to call T's destructor.
-//! This optimization tipically is used to improve containers' performance.
-//!
-//! By default this trait is true if the type has trivial destructor,
-//! every class should specialize this trait if it wants to improve performance
-//! when inserted in containers.
-template <class T>
-struct has_trivial_destructor_after_move
- : public ::boost::has_trivial_destructor<T>
-{};
-
-#ifndef BOOST_MOVE_DOXYGEN_INVOKED
-
-#ifdef BOOST_MOVE_IN_BOOST_INTERPROCESS_NAMESPACE
-
-#define BOOST_INTERPROCESS_ENABLE_MOVE_EMULATION(TYPE) BOOST_ENABLE_MOVE_EMULATION(TYPE)
-#define BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(TYPE) BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)
-#define BOOST_INTERPROCESS_COPYABLE_AND_MOVABLE(TYPE) BOOST_COPYABLE_AND_MOVABLE(TYPE)
-#define BOOST_INTERPROCESS_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2) BOOST_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)
-#define BOOST_INTERPROCESS_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3) BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)
-#define BOOST_INTERPROCESS_RV_REF(TYPE) BOOST_RV_REF(TYPE)
-#define BOOST_INTERPROCESS_COPY_ASSIGN_REF(TYPE) BOOST_COPY_ASSIGN_REF(TYPE)
-#define BOOST_INTERPROCESS_COPY_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2) BOOST_COPY_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)
-#define BOOST_INTERPROCESS_COPY_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3) BOOST_COPY_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)
-#define BOOST_INTERPROCESS_FWD_REF(TYPE) BOOST_FWD_REF(TYPE)
-#define BOOST_INTERPROCESS_CATCH_CONST_RLVALUE(TYPE) BOOST_CATCH_CONST_RLVALUE(TYPE)
-
-#endif
-
-#define BOOST_MOVE_MACRO_ENABLE_MOVE_EMULATION(TYPE) BOOST_ENABLE_MOVE_EMULATION(TYPE)
-#define BOOST_MOVE_MACRO_MOVABLE_BUT_NOT_COPYABLE(TYPE) BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)
-#define BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(TYPE) BOOST_COPYABLE_AND_MOVABLE(TYPE)
-#define BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2) BOOST_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)
-#define BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3) BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)
-#define BOOST_MOVE_MACRO_RV_REF(TYPE) BOOST_RV_REF(TYPE)
-#define BOOST_MOVE_MACRO_COPY_ASSIGN_REF(TYPE) BOOST_COPY_ASSIGN_REF(TYPE)
-#define BOOST_MOVE_MACRO_COPY_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2) BOOST_COPY_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)
-#define BOOST_MOVE_MACRO_COPY_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3) BOOST_COPY_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)
-#define BOOST_MOVE_MACRO_FWD_REF(TYPE) BOOST_FWD_REF(TYPE)
-#define BOOST_MOVE_MACRO_CATCH_CONST_RLVALUE(TYPE) BOOST_CATCH_CONST_RLVALUE(TYPE)
+namespace interprocess {
 
-#endif //BOOST_MOVE_DOXYGEN_INVOKED
+using ::boost::move;
+using ::boost::forward;
 
-INTERPROCESS_NAMESPACE_END
+} //namespace interprocess {
 } //namespace boost {
 
-#endif //#ifndef BOOST_MOVE_HPP
+#endif //#ifndef BOOST_INTERPROCESS_DETAIL_MOVE_HPP

Modified: branches/release/boost/interprocess/detail/segment_manager_helper.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/segment_manager_helper.hpp (original)
+++ branches/release/boost/interprocess/detail/segment_manager_helper.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -25,6 +25,8 @@
 #include <boost/interprocess/detail/utilities.hpp>
 #include <boost/interprocess/detail/in_place_interface.hpp>
 #include <boost/interprocess/exceptions.hpp>
+#include <boost/type_traits/make_unsigned.hpp>
+#include <boost/type_traits/alignment_of.hpp>
 #include <cstddef> //std::size_t
 #include <string> //char_traits
 #include <new> //std::nothrow
@@ -70,24 +72,25 @@
 };
 
 /// @cond
+template<class size_type>
 struct block_header
 {
- std::size_t m_value_bytes;
+ size_type m_value_bytes;
    unsigned short m_num_char;
    unsigned char m_value_alignment;
    unsigned char m_alloc_type_sizeof_char;
 
- block_header(std::size_t value_bytes
- ,std::size_t value_alignment
- ,std::size_t alloc_type
+ block_header(size_type value_bytes
+ ,size_type value_alignment
+ ,unsigned char alloc_type
                ,std::size_t sizeof_char
                ,std::size_t num_char
                )
       : m_value_bytes(value_bytes)
- , m_num_char(num_char)
- , m_value_alignment(value_alignment)
+ , m_num_char((unsigned short)num_char)
+ , m_value_alignment((unsigned char)value_alignment)
       , m_alloc_type_sizeof_char
- ( ((unsigned char)alloc_type << 5u) |
+ ( (alloc_type << 5u) |
            ((unsigned char)sizeof_char & 0x1F) )
    {};
 
@@ -96,32 +99,32 @@
    block_header &operator= (const T& )
    { return *this; }
 
- std::size_t total_size() const
+ size_type total_size() const
    {
       if(alloc_type() != anonymous_type){
          return name_offset() + (m_num_char+1)*sizeof_char();
       }
       else{
- return value_offset() + m_value_bytes;
+ return this->value_offset() + m_value_bytes;
       }
    }
 
- std::size_t value_bytes() const
+ size_type value_bytes() const
    { return m_value_bytes; }
 
    template<class Header>
- std::size_t total_size_with_header() const
+ size_type total_size_with_header() const
    {
       return get_rounded_size
- ( sizeof(Header)
- , detail::alignment_of<block_header>::value)
+ ( size_type(sizeof(Header))
+ , size_type(::boost::alignment_of<block_header<size_type> >::value))
            + total_size();
    }
 
- std::size_t alloc_type() const
+ unsigned char alloc_type() const
    { return (m_alloc_type_sizeof_char >> 5u)&(unsigned char)0x7; }
 
- std::size_t sizeof_char() const
+ unsigned char sizeof_char() const
    { return m_alloc_type_sizeof_char & (unsigned char)0x1F; }
 
    template<class CharType>
@@ -131,26 +134,26 @@
          (reinterpret_cast<const char*>(this) + name_offset()));
    }
 
- std::size_t name_length() const
+ unsigned short name_length() const
    { return m_num_char; }
 
- std::size_t name_offset() const
+ size_type name_offset() const
    {
- return value_offset() + get_rounded_size(m_value_bytes, sizeof_char());
+ return this->value_offset() + get_rounded_size(size_type(m_value_bytes), size_type(sizeof_char()));
    }
 
    void *value() const
    {
- return const_cast<char*>((reinterpret_cast<const char*>(this) + value_offset()));
+ return const_cast<char*>((reinterpret_cast<const char*>(this) + this->value_offset()));
    }
 
- std::size_t value_offset() const
+ size_type value_offset() const
    {
- return get_rounded_size(sizeof(block_header), m_value_alignment);
+ return get_rounded_size(size_type(sizeof(block_header<size_type>)), size_type(m_value_alignment));
    }
 
    template<class CharType>
- bool less_comp(const block_header &b) const
+ bool less_comp(const block_header<size_type> &b) const
    {
       return m_num_char < b.m_num_char ||
              (m_num_char < b.m_num_char &&
@@ -159,7 +162,7 @@
    }
 
    template<class CharType>
- bool equal_comp(const block_header &b) const
+ bool equal_comp(const block_header<size_type> &b) const
    {
       return m_num_char == b.m_num_char &&
              std::char_traits<CharType>::compare
@@ -167,10 +170,10 @@
    }
 
    template<class T>
- static block_header *block_header_from_value(T *value)
- { return block_header_from_value(value, sizeof(T), detail::alignment_of<T>::value); }
+ static block_header<size_type> *block_header_from_value(T *value)
+ { return block_header_from_value(value, sizeof(T), ::boost::alignment_of<T>::value); }
 
- static block_header *block_header_from_value(const void *value, std::size_t sz, std::size_t algn)
+ static block_header<size_type> *block_header_from_value(const void *value, std::size_t sz, std::size_t algn)
    {
       block_header * hdr =
          const_cast<block_header*>
@@ -184,21 +187,21 @@
    }
 
    template<class Header>
- static block_header *from_first_header(Header *header)
+ static block_header<size_type> *from_first_header(Header *header)
    {
- block_header * hdr =
- reinterpret_cast<block_header*>(reinterpret_cast<char*>(header) +
- get_rounded_size(sizeof(Header), detail::alignment_of<block_header>::value));
+ block_header<size_type> * hdr =
+ reinterpret_cast<block_header<size_type>*>(reinterpret_cast<char*>(header) +
+ get_rounded_size(size_type(sizeof(Header)), size_type(::boost::alignment_of<block_header<size_type> >::value)));
       //Some sanity checks
       return hdr;
    }
 
    template<class Header>
- static Header *to_first_header(block_header *bheader)
+ static Header *to_first_header(block_header<size_type> *bheader)
    {
       Header * hdr =
          reinterpret_cast<Header*>(reinterpret_cast<char*>(bheader) -
- get_rounded_size(sizeof(Header), detail::alignment_of<block_header>::value));
+ get_rounded_size(size_type(sizeof(Header)), size_type(::boost::alignment_of<block_header<size_type> >::value)));
       //Some sanity checks
       return hdr;
    }
@@ -257,7 +260,7 @@
 typedef instance_t<unique_type> unique_instance_t;
 
 
-template<class Hook, class CharType>
+template<class Hook, class CharType, class SizeType>
 struct intrusive_value_type_impl
    : public Hook
 {
@@ -268,34 +271,35 @@
 
    public:
    typedef CharType char_type;
+ typedef SizeType size_type;
 
    intrusive_value_type_impl(){}
 
- enum { BlockHdrAlignment = detail::alignment_of<block_header>::value };
+ enum { BlockHdrAlignment = ::boost::alignment_of<block_header<size_type> >::value };
 
- block_header *get_block_header() const
+ block_header<size_type> *get_block_header() const
    {
- return const_cast<block_header*>
- (reinterpret_cast<const block_header *>(reinterpret_cast<const char*>(this) +
- get_rounded_size(sizeof(*this), BlockHdrAlignment)));
+ return const_cast<block_header<size_type>*>
+ (reinterpret_cast<const block_header<size_type> *>(reinterpret_cast<const char*>(this) +
+ ::boost::interprocess::detail::get_rounded_size(size_type(sizeof(*this)), size_type(BlockHdrAlignment))));
    }
 
- bool operator <(const intrusive_value_type_impl<Hook, CharType> & other) const
+ bool operator <(const intrusive_value_type_impl<Hook, CharType, SizeType> & other) const
    { return (this->get_block_header())->template less_comp<CharType>(*other.get_block_header()); }
 
- bool operator ==(const intrusive_value_type_impl<Hook, CharType> & other) const
+ bool operator ==(const intrusive_value_type_impl<Hook, CharType, SizeType> & other) const
    { return (this->get_block_header())->template equal_comp<CharType>(*other.get_block_header()); }
 
- static intrusive_value_type_impl *get_intrusive_value_type(block_header *hdr)
+ static intrusive_value_type_impl *get_intrusive_value_type(block_header<size_type> *hdr)
    {
       return reinterpret_cast<intrusive_value_type_impl *>(reinterpret_cast<char*>(hdr) -
- get_rounded_size(sizeof(intrusive_value_type_impl), BlockHdrAlignment));
+ get_rounded_size(size_type(sizeof(intrusive_value_type_impl)), size_type(BlockHdrAlignment)));
    }
 
    CharType *name() const
    { return get_block_header()->template name<CharType>(); }
 
- std::size_t name_length() const
+ unsigned short name_length() const
    { return get_block_header()->name_length(); }
 
    void *value() const
@@ -333,16 +337,18 @@
    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::make_unsigned<difference_type>::type size_type;
 
    private:
    //Offset pointer to the object's name
    const_char_ptr_t mp_str;
    //Length of the name buffer (null NOT included)
- std::size_t m_len;
+ size_type m_len;
    public:
 
    //!Constructor of the key
- index_key (const char_type *name, std::size_t length)
+ index_key (const char_type *name, size_type length)
       : mp_str(name), m_len(length) {}
 
    //!Less than function for index ordering
@@ -352,7 +358,7 @@
                (m_len == right.m_len &&
                std::char_traits<char_type>::compare
                   (detail::get_pointer(mp_str)
- ,detail::get_pointer(right.mp_str), m_len) < 0);
+ ,detail::get_pointer(right.mp_str), m_len) < 0);
    }
 
    //!Equal to function for index ordering
@@ -367,13 +373,13 @@
    void name(const CharT *name)
    { mp_str = name; }
 
- void name_length(std::size_t len)
+ void name_length(size_type len)
    { m_len = len; }
 
    const CharT *name() const
    { return detail::get_pointer(mp_str); }
 
- std::size_t name_length() const
+ size_type name_length() const
    { return m_len; }
 };
 
@@ -406,7 +412,7 @@
 
    template<class HeaderBase>
    struct intrusive_value_type
- { typedef detail::intrusive_value_type_impl<HeaderBase, CharT> type; };
+ { typedef detail::intrusive_value_type_impl<HeaderBase, CharT, typename segment_manager_base::size_type> type; };
 
    typedef intrusive_compare_key<CharT> intrusive_compare_key_type;
 };
@@ -425,7 +431,7 @@
    const char_type *name() const
    { return m_val->name(); }
 
- std::size_t name_length() const
+ unsigned short name_length() const
    { return m_val->name_length(); }
 
    const void *value() const
@@ -442,6 +448,7 @@
    typedef typename iterator_val_t::first_type first_type;
    typedef typename iterator_val_t::second_type second_type;
    typedef typename first_type::char_type char_type;
+ typedef typename first_type::size_type size_type;
 
    public:
    segment_manager_iterator_value_adaptor(const typename Iterator::value_type &val)
@@ -451,12 +458,12 @@
    const char_type *name() const
    { return m_val->first.name(); }
 
- std::size_t name_length() const
+ size_type name_length() const
    { return m_val->first.name_length(); }
 
    const void *value() const
    {
- return reinterpret_cast<block_header*>
+ return reinterpret_cast<block_header<size_type>*>
          (detail::get_pointer(m_val->second.m_ptr))->value();
    }
 

Modified: branches/release/boost/interprocess/detail/tmp_dir_helpers.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/tmp_dir_helpers.hpp (original)
+++ branches/release/boost/interprocess/detail/tmp_dir_helpers.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -19,15 +19,15 @@
 #include <string>
 
 #if defined(BOOST_INTERPROCESS_WINDOWS)
- #define BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME
- #define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME
- #include <boost/interprocess/detail/win32_api.hpp>
+ //#define BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME
+ //#define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME
+ //#include <boost/interprocess/detail/win32_api.hpp>
 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
- #include <sys/sysctl.h>
- #if defined(CTL_KERN) && defined (KERN_BOOTTIME)
- #define BOOST_INTERPROCESS_HAS_BSD_KERNEL_BOOTTIME
- #define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME
- #endif
+ //#include <sys/sysctl.h>
+ //#if defined(CTL_KERN) && defined (KERN_BOOTTIME)
+ //#define BOOST_INTERPROCESS_HAS_BSD_KERNEL_BOOTTIME
+ //#define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME
+ //#endif
 #endif
 
 namespace boost {
@@ -52,7 +52,7 @@
    // FreeBSD specific: sysctl "kern.boottime"
    int request[2] = { CTL_KERN, KERN_BOOTTIME };
    struct ::timeval result;
- size_t result_len = sizeof result;
+ std::size_t result_len = sizeof result;
 
    if (::sysctl (request, 2, &result, &result_len, NULL, 0) < 0)
       return;
@@ -64,9 +64,9 @@
       , '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
 
    std::size_t char_counter = 0;
- long fields[2] = { result.tv_sec, result.tv_usec };
+ long long fields[2] = { result.tv_sec, result.tv_usec };
    for(std::size_t field = 0; field != 2; ++field){
- for(std::size_t i = 0; i != sizeof(long); ++i){
+ for(std::size_t i = 0; i != sizeof(long long); ++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)];
@@ -86,7 +86,7 @@
 {
    #if defined (BOOST_INTERPROCESS_WINDOWS)
    winapi::get_shared_documents_folder(tmp_name);
- if(tmp_name.empty()){
+ if(tmp_name.empty() || !winapi::is_directory(tmp_name.c_str())){
       tmp_name = get_temporary_path();
    }
    #else
@@ -152,7 +152,8 @@
 inline void create_tmp_and_clean_old_and_get_filename(const char *filename, std::string &tmp_name)
 {
    create_tmp_and_clean_old(tmp_name);
- tmp_filename(filename, tmp_name);
+ tmp_name += "/";
+ tmp_name += filename;
 }
 
 inline void add_leading_slash(const char *name, std::string &new_name)

Modified: branches/release/boost/interprocess/detail/type_traits.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/type_traits.hpp (original)
+++ branches/release/boost/interprocess/detail/type_traits.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -8,8 +8,6 @@
 //
 // See http://www.boost.org/libs/interprocess for documentation.
 //
-// The alignment_of implementation comes from John Maddock's boost::alignment_of code
-//
 //////////////////////////////////////////////////////////////////////////////
 
 #ifndef BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_HPP
@@ -27,48 +25,6 @@
 
 struct nat{};
 
-//boost::alignment_of yields to 10K lines of preprocessed code, so we
-//need an alternative
-template <typename T> struct alignment_of;
-
-template <typename T>
-struct alignment_of_hack
-{
- char c;
- T t;
- alignment_of_hack();
-};
-
-template <unsigned A, unsigned S>
-struct alignment_logic
-{
- enum{ value = A < S ? A : S };
-};
-
-template< typename T >
-struct alignment_of
-{
- enum{ value = alignment_logic
- < sizeof(alignment_of_hack<T>) - sizeof(T)
- , sizeof(T)>::value };
-};
-
-//This is not standard, but should work with all compilers
-union max_align
-{
- char char_;
- short short_;
- int int_;
- long long_;
- #ifdef BOOST_HAS_LONG_LONG
- long long long_long_;
- #endif
- float float_;
- double double_;
- long double long_double_;
- void * void_ptr_;
-};
-
 template<class T>
 struct remove_reference
 {

Modified: branches/release/boost/interprocess/detail/utilities.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/utilities.hpp (original)
+++ branches/release/boost/interprocess/detail/utilities.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -70,25 +70,29 @@
 }
 
 //Rounds "orig_size" by excess to round_to bytes
-inline std::size_t get_rounded_size(std::size_t orig_size, std::size_t round_to)
+template<class SizeType>
+inline SizeType get_rounded_size(SizeType orig_size, SizeType round_to)
 {
    return ((orig_size-1)/round_to+1)*round_to;
 }
 
 //Truncates "orig_size" to a multiple of "multiple" bytes.
-inline std::size_t get_truncated_size(std::size_t orig_size, std::size_t multiple)
+template<class SizeType>
+inline SizeType get_truncated_size(SizeType orig_size, SizeType multiple)
 {
    return orig_size/multiple*multiple;
 }
 
 //Rounds "orig_size" by excess to round_to bytes. round_to must be power of two
-inline std::size_t get_rounded_size_po2(std::size_t orig_size, std::size_t round_to)
+template<class SizeType>
+inline SizeType get_rounded_size_po2(SizeType orig_size, SizeType round_to)
 {
    return ((orig_size-1)&(~(round_to-1))) + round_to;
 }
 
 //Truncates "orig_size" to a multiple of "multiple" bytes. multiple must be power of two
-inline std::size_t get_truncated_size_po2(std::size_t orig_size, std::size_t multiple)
+template<class SizeType>
+inline SizeType get_truncated_size_po2(SizeType orig_size, SizeType multiple)
 {
    return (orig_size & (~(multiple-1)));
 }

Modified: branches/release/boost/interprocess/detail/win32_api.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/win32_api.hpp (original)
+++ branches/release/boost/interprocess/detail/win32_api.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -15,6 +15,7 @@
 #include <boost/interprocess/detail/workaround.hpp>
 #include <cstddef>
 #include <cstring>
+#include <cassert>
 #include <string>
 #include <vector>
 #include <memory>
@@ -24,6 +25,7 @@
 # pragma comment( lib, "advapi32.lib" )
 # pragma comment( lib, "oleaut32.lib" )
 # pragma comment( lib, "Ole32.lib" )
+# pragma comment( lib, "Psapi.lib" )
 #endif
 
 #if (defined BOOST_INTERPROCESS_WINDOWS)
@@ -132,6 +134,7 @@
 static const unsigned long lang_neutral = (unsigned long)0x00;
 static const unsigned long sublang_default = (unsigned long)0x01;
 static const unsigned long invalid_file_size = (unsigned long)0xFFFFFFFF;
+static const unsigned long invalid_file_attributes = ((unsigned long)-1);
 static void * const invalid_handle_value = (void*)(long)(-1);
 static const unsigned long create_new = 1;
 static const unsigned long create_always = 2;
@@ -166,6 +169,8 @@
 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;
@@ -820,6 +825,7 @@
    unsigned long dwLanguageId, char *lpBuffer, unsigned long nSize,
    std::va_list *Arguments);
 extern "C" __declspec(dllimport) void *__stdcall LocalFree (void *);
+extern "C" __declspec(dllimport) unsigned long __stdcall GetFileAttributesA(const char *);
 extern "C" __declspec(dllimport) int __stdcall CreateDirectoryA(const char *, interprocess_security_attributes*);
 extern "C" __declspec(dllimport) int __stdcall RemoveDirectoryA(const char *lpPathName);
 extern "C" __declspec(dllimport) int __stdcall GetTempPathA(unsigned long length, char *buffer);
@@ -839,7 +845,10 @@
 extern "C" __declspec(dllimport) void *__stdcall GetProcAddress(void *, const char*);
 extern "C" __declspec(dllimport) void *__stdcall GetModuleHandleA(const char*);
 extern "C" __declspec(dllimport) void *__stdcall GetFileInformationByHandle(void *, interprocess_by_handle_file_information*);
-
+extern "C" __declspec(dllimport) unsigned long __stdcall GetMappedFileNameW(void *, void *, wchar_t *, unsigned long);
+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 *);
 
 //COM API
 extern "C" __declspec(dllimport) long __stdcall CoInitialize(void *pvReserved);
@@ -865,6 +874,8 @@
 //Pointer to functions
 typedef long (__stdcall *NtDeleteFile_t)(object_attributes_t *ObjectAttributes);
 typedef long (__stdcall *NtSetInformationFile_t)(void *FileHandle, io_status_block_t *IoStatusBlock, void *FileInformation, unsigned long Length, int FileInformationClass );
+typedef long (__stdcall * NtQuerySystemInformation_t)(int, void*, unsigned long, unsigned long *);
+typedef long (__stdcall * NtQueryObject_t)(void*, object_information_class, void *, unsigned long, unsigned long *);
 typedef long (__stdcall *NtQueryInformationFile_t)(void *,io_status_block_t *,void *, long, int);
 typedef long (__stdcall *NtOpenFile_t)(void*,unsigned long ,object_attributes_t*,io_status_block_t*,unsigned long,unsigned long);
 typedef long (__stdcall *NtClose_t) (void*);
@@ -872,13 +883,8 @@
 typedef void (__stdcall *RtlFreeUnicodeString_t)(unicode_string_t *);
 typedef void (__stdcall *RtlInitUnicodeString_t)( unicode_string_t *, const wchar_t * );
 typedef long (__stdcall *RtlAppendUnicodeToString_t)(unicode_string_t *Destination, const wchar_t *Source);
-typedef long (__stdcall * NtQuerySystemInformation_t)(int, void*, unsigned long, unsigned long *);
-typedef long (__stdcall * NtQueryObject_t)(void*, object_information_class, void *, unsigned long, unsigned long *);
 typedef unsigned long (__stdcall * GetMappedFileName_t)(void *, void *, wchar_t *, unsigned long);
-typedef unsigned long (__stdcall * GetMappedFileName_t)(void *, void *, wchar_t *, unsigned long);
-typedef long (__stdcall * RegOpenKey_t)(void *, const char *, void **);
 typedef long (__stdcall * RegOpenKeyEx_t)(void *, const char *, unsigned long, unsigned long, void **);
-typedef long (__stdcall * RegQueryValue_t)(void *, const char *, char *, long*);
 typedef long (__stdcall * RegQueryValueEx_t)(void *, const char *, unsigned long*, unsigned long*, unsigned char *, unsigned long*);
 typedef long (__stdcall * RegCloseKey_t)(void *);
 
@@ -1108,6 +1114,18 @@
 inline void *get_module_handle(const char *name)
 { return GetModuleHandleA(name); }
 
+inline unsigned long get_mapped_file_name(void *process, void *lpv, wchar_t *lpfilename, unsigned long nSize)
+{ return GetMappedFileNameW(process, lpv, lpfilename, nSize); }
+
+inline long reg_open_key_ex(void *hKey, const char *lpSubKey, unsigned long ulOptions, unsigned long samDesired, void **phkResult)
+{ return RegOpenKeyExA(hKey, lpSubKey, ulOptions, samDesired, phkResult); }
+
+inline long reg_query_value_ex(void *hKey, const char *lpValueName, unsigned long*lpReserved, unsigned long*lpType, unsigned char *lpData, unsigned long*lpcbData)
+{ return RegQueryValueExA(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData); }
+
+inline long reg_close_key(void *hKey)
+{ return RegCloseKey(hKey); }
+
 inline void initialize_object_attributes
 ( object_attributes_t *pobject_attr, unicode_string_t *name
  , unsigned long attr, void *rootdir, void *security_descr)
@@ -1128,6 +1146,88 @@
    ucStr->MaximumLength = bufSize;
 }
 
+//A class that locates and caches loaded DLL function addresses.
+template<int Dummy>
+struct function_address_holder
+{
+ enum { NtSetInformationFile, NtQuerySystemInformation, NtQueryObject, NumFunction };
+ enum { NtDll_dll, NumModule };
+
+ private:
+ static void *FunctionAddresses[NumFunction];
+ static volatile long FunctionStates[NumFunction];
+ static void *ModuleAddresses[NumModule];
+ static volatile long ModuleStates[NumModule];
+
+ static void *get_module_from_id(unsigned int id)
+ {
+ assert(id < (unsigned int)NumModule);
+ const char *module[] = { "ntdll.dll" };
+ bool compile_check[sizeof(module)/sizeof(module[0]) == NumModule];
+ (void)compile_check;
+ return get_module_handle(module[id]);
+ }
+
+ static void *get_module(const unsigned int id)
+ {
+ assert(id < (unsigned int)NumModule);
+ while(ModuleStates[id] < 2u){
+ if(interlocked_compare_exchange(&ModuleStates[id], 1, 0) == 0){
+ ModuleAddresses[id] = get_module_from_id(id);
+ interlocked_increment(&ModuleStates[id]);
+ break;
+ }
+ else{
+ sched_yield();
+ }
+ }
+ return ModuleAddresses[id];
+ }
+
+ static void *get_address_from_dll(const unsigned int id)
+ {
+ assert(id < (unsigned int)NumFunction);
+ const char *function[] = { "NtSetInformationFile", "NtQuerySystemInformation", "NtQueryObject" };
+ bool compile_check[sizeof(function)/sizeof(function[0]) == NumFunction];
+ (void)compile_check;
+ return get_proc_address(get_module(NtDll_dll), function[id]);
+ }
+
+ public:
+ static void *get(const unsigned int id)
+ {
+ assert(id < (unsigned int)NumFunction);
+ while(FunctionStates[id] < 2u){
+ if(interlocked_compare_exchange(&FunctionStates[id], 1, 0) == 0){
+ FunctionAddresses[id] = get_address_from_dll(id);
+ interlocked_increment(&FunctionStates[id]);
+ break;
+ }
+ else{
+ sched_yield();
+ }
+ }
+ return FunctionAddresses[id];
+ }
+};
+
+template<int Dummy>
+void *function_address_holder<Dummy>::FunctionAddresses[function_address_holder<Dummy>::NumFunction];
+
+template<int Dummy>
+volatile long function_address_holder<Dummy>::FunctionStates[function_address_holder<Dummy>::NumFunction];
+
+template<int Dummy>
+void *function_address_holder<Dummy>::ModuleAddresses[function_address_holder<Dummy>::NumModule];
+
+template<int Dummy>
+volatile long function_address_holder<Dummy>::ModuleStates[function_address_holder<Dummy>::NumModule];
+
+
+struct dll_func
+ : public function_address_holder<0>
+{};
+
 //Complex winapi based functions...
 struct library_unloader
 {
@@ -1144,30 +1244,29 @@
       return false;
    }
 
- void *hiPSAPI = load_library("PSAPI.DLL");
- if (0 == hiPSAPI)
- return 0;
-
- library_unloader unloader(hiPSAPI);
-
- // Pointer to function getMappedFileName() in PSAPI.DLL
- GetMappedFileName_t pfGMFN =
- (GetMappedFileName_t)get_proc_address(hiPSAPI, "GetMappedFileNameW");
- if (! pfGMFN){
- return 0; // Failed: unexpected error
- }
+// void *hiPSAPI = load_library("PSAPI.DLL");
+// if (0 == hiPSAPI)
+// return 0;
+// library_unloader unloader(hiPSAPI);
+
+// Pointer to function getMappedFileName() in PSAPI.DLL
+// GetMappedFileName_t pfGMFN =
+// (GetMappedFileName_t)get_proc_address(hiPSAPI, "GetMappedFileNameW");
+// if (! pfGMFN){
+// return 0; // Failed: unexpected error
+// }
 
    bool bSuccess = false;
 
    // Create a file mapping object.
    void * hFileMap = create_file_mapping(hFile, page_readonly, 0, 1, 0, 0);
- if(hFileMap)
- {
+ if(hFileMap){
       // Create a file mapping to get the file name.
       void* pMem = map_view_of_file_ex(hFileMap, file_map_read, 0, 0, 1, 0);
 
       if (pMem){
- out_length = pfGMFN(get_current_process(), pMem, pszFilename, MaxPath);
+ //out_length = pfGMFN(get_current_process(), pMem, pszFilename, MaxPath);
+ out_length = get_mapped_file_name(get_current_process(), pMem, pszFilename, MaxPath);
          if(out_length){
             bSuccess = true;
          }
@@ -1182,7 +1281,8 @@
 inline bool get_system_time_of_day_information(system_timeofday_information &info)
 {
    NtQuerySystemInformation_t pNtQuerySystemInformation = (NtQuerySystemInformation_t)
- get_proc_address(get_module_handle("ntdll.dll"), "NtQuerySystemInformation");
+ //get_proc_address(get_module_handle("ntdll.dll"), "NtQuerySystemInformation");
+ dll_func::get(dll_func::NtQuerySystemInformation);
    unsigned long res;
    long status = pNtQuerySystemInformation(system_time_of_day_information, &info, sizeof(info), &res);
    if(status){
@@ -1275,181 +1375,204 @@
 
 inline bool unlink_file(const char *filename)
 {
- try{
- NtSetInformationFile_t pNtSetInformationFile =
- (NtSetInformationFile_t)get_proc_address(get_module_handle("ntdll.dll"), "NtSetInformationFile");
- if(!pNtSetInformationFile){
- return false;
- }
-
- NtQueryObject_t pNtQueryObject =
- (NtQueryObject_t)get_proc_address(get_module_handle("ntdll.dll"), "NtQueryObject");
+ if(!delete_file(filename)){
+ try{
+ NtSetInformationFile_t pNtSetInformationFile =
+ //(NtSetInformationFile_t)get_proc_address(get_module_handle("ntdll.dll"), "NtSetInformationFile");
+ (NtSetInformationFile_t)dll_func::get(dll_func::NtSetInformationFile);
+ if(!pNtSetInformationFile){
+ return false;
+ }
 
- //First step: Obtain a handle to the file using Win32 rules. This resolves relative paths
- void *fh = create_file(filename, generic_read | delete_access, open_existing,
- file_flag_backup_semantics | file_flag_delete_on_close, 0);
- if(fh == invalid_handle_value){
- return false;
- }
+ NtQueryObject_t pNtQueryObject =
+ //(NtQueryObject_t)get_proc_address(get_module_handle("ntdll.dll"), "NtQueryObject");
+ (NtQueryObject_t)dll_func::get(dll_func::NtQueryObject);
+
+ //First step: Obtain a handle to the file using Win32 rules. This resolves relative paths
+ void *fh = create_file(filename, generic_read | delete_access, open_existing,
+ file_flag_backup_semantics | file_flag_delete_on_close, 0);
+ if(fh == invalid_handle_value){
+ return false;
+ }
 
- handle_closer h_closer(fh);
+ handle_closer h_closer(fh);
 
- std::auto_ptr<ntquery_mem_t> pmem(new ntquery_mem_t);
- file_rename_information_t *pfri = (file_rename_information_t*)&pmem->ren.info;
- const std::size_t RenMaxNumChars =
- ((char*)pmem.get() - (char*)&pmem->ren.info.FileName[0])/sizeof(wchar_t);
-
- //Obtain file name
- unsigned long size;
- if(pNtQueryObject(fh, object_name_information, pmem.get(), sizeof(ntquery_mem_t), &size)){
- return false;
- }
+ std::auto_ptr<ntquery_mem_t> pmem(new ntquery_mem_t);
+ file_rename_information_t *pfri = &pmem->ren.info;
+ const std::size_t RenMaxNumChars =
+ ((char*)pmem.get() - (char*)&pmem->ren.info.FileName[0])/sizeof(wchar_t);
+
+ //Obtain file name
+ unsigned long size;
+ if(pNtQueryObject(fh, object_name_information, pmem.get(), sizeof(ntquery_mem_t), &size)){
+ return false;
+ }
 
- //Copy filename to the rename member
- std::memmove(pmem->ren.info.FileName, pmem->name.Name.Buffer, pmem->name.Name.Length);
- std::size_t filename_string_length = pmem->name.Name.Length/sizeof(wchar_t);
-
- //Second step: obtain the complete native-nt filename
- //if(!get_file_name_from_handle_function(fh, pfri->FileName, RenMaxNumChars, filename_string_length)){
- //return 0;
- //}
+ //Copy filename to the rename member
+ std::memmove(pmem->ren.info.FileName, pmem->name.Name.Buffer, pmem->name.Name.Length);
+ std::size_t filename_string_length = pmem->name.Name.Length/sizeof(wchar_t);
+
+ //Second step: obtain the complete native-nt filename
+ //if(!get_file_name_from_handle_function(fh, pfri->FileName, RenMaxNumChars, filename_string_length)){
+ //return 0;
+ //}
+
+ //Add trailing mark
+ if((RenMaxNumChars-filename_string_length) < (SystemTimeOfDayInfoLength*2)){
+ return false;
+ }
 
- //Add trailing mark
- if((RenMaxNumChars-filename_string_length) < (SystemTimeOfDayInfoLength*2)){
- return false;
- }
+ //Search '\\' character to replace it
+ for(std::size_t i = filename_string_length; i != 0; --filename_string_length){
+ if(pmem->ren.info.FileName[--i] == L'\\')
+ break;
+ }
 
- //Search '\\' character to replace it
- for(std::size_t i = filename_string_length; i != 0; --filename_string_length){
- if(pmem->ren.info.FileName[--i] == L'\\')
- break;
- }
+ //Add random number
+ std::size_t s = RenMaxNumChars - filename_string_length;
+ if(!get_boot_and_system_time_wstr(&pfri->FileName[filename_string_length], s)){
+ return false;
+ }
+ filename_string_length += s;
 
- //Add random number
- std::size_t s = RenMaxNumChars - filename_string_length;
- if(!get_boot_and_system_time_wstr(&pfri->FileName[filename_string_length], s)){
- return false;
+ //Fill rename information (FileNameLength is in bytes)
+ pfri->FileNameLength = static_cast<unsigned long>(sizeof(wchar_t)*(filename_string_length));
+ pfri->Replace = 1;
+ pfri->RootDir = 0;
+
+ //Final step: change the name of the in-use file:
+ io_status_block_t io;
+ if(0 != pNtSetInformationFile(fh, &io, pfri, sizeof(ntquery_mem_t::ren_t), file_rename_information)){
+ return false;
+ }
+ return true;
       }
- filename_string_length += s;
-
- //Fill rename information (FileNameLength is in bytes)
- pfri->FileNameLength = static_cast<unsigned long>(sizeof(wchar_t)*(filename_string_length));
- pfri->Replace = 1;
- pfri->RootDir = 0;
-
- //Final step: change the name of the in-use file:
- io_status_block_t io;
- if(0 != pNtSetInformationFile(fh, &io, pfri, sizeof(ntquery_mem_t::ren_t), file_rename_information)){
+ catch(...){
          return false;
       }
- return true;
- }
- catch(...){
- return false;
    }
+ return true;
 }
 
 struct reg_closer
 {
- RegCloseKey_t func_;
+ //reg_closer(RegCloseKey_t func, void *key) : func_(func), key_(key){}
+ //~reg_closer(){ (*func_)(key_); }
+ //RegCloseKey_t func_;
    void *key_;
- reg_closer(RegCloseKey_t func, void *key) : func_(func), key_(key){}
- ~reg_closer(){ (*func_)(key_); }
+ reg_closer(void *key) : key_(key){}
+ ~reg_closer(){ reg_close_key(key_); }
 };
 
 inline void get_shared_documents_folder(std::string &s)
 {
    s.clear();
- void *hAdvapi = load_library("Advapi32.dll");
- if (hAdvapi){
- library_unloader unloader(hAdvapi);
+ //void *hAdvapi = load_library("Advapi32.dll");
+ //if (hAdvapi){
+ //library_unloader unloader(hAdvapi);
       // Pointer to function RegOpenKeyA
- RegOpenKeyEx_t pRegOpenKey =
- (RegOpenKeyEx_t)get_proc_address(hAdvapi, "RegOpenKeyExA");
- if (pRegOpenKey){
+ //RegOpenKeyEx_t pRegOpenKey =
+ //(RegOpenKeyEx_t)get_proc_address(hAdvapi, "RegOpenKeyExA");
+ //if (pRegOpenKey){
          // Pointer to function RegCloseKey
- RegCloseKey_t pRegCloseKey =
- (RegCloseKey_t)get_proc_address(hAdvapi, "RegCloseKey");
- if (pRegCloseKey){
+ //RegCloseKey_t pRegCloseKey =
+ //(RegCloseKey_t)get_proc_address(hAdvapi, "RegCloseKey");
+ //if (pRegCloseKey){
             // Pointer to function RegQueryValueA
- RegQueryValueEx_t pRegQueryValue =
- (RegQueryValueEx_t)get_proc_address(hAdvapi, "RegQueryValueExA");
- if (pRegQueryValue){
+ //RegQueryValueEx_t pRegQueryValue =
+ //(RegQueryValueEx_t)get_proc_address(hAdvapi, "RegQueryValueExA");
+ //if (pRegQueryValue){
                //Open the key
                void *key;
- if ((*pRegOpenKey)( hkey_local_machine
+ //if ((*pRegOpenKey)( hkey_local_machine
+ //, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
+ //, 0
+ //, key_query_value
+ //, &key) == 0){
+ //reg_closer key_closer(pRegCloseKey, key);
+ if (reg_open_key_ex( hkey_local_machine
                                  , "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
                                  , 0
                                  , key_query_value
                                  , &key) == 0){
- reg_closer key_closer(pRegCloseKey, key);
+ reg_closer key_closer(key);
 
                   //Obtain the value
                   unsigned long size;
                   unsigned long type;
                   const char *const reg_value = "Common AppData";
- long err = (*pRegQueryValue)( key, reg_value, 0, &type, 0, &size);
+ //long err = (*pRegQueryValue)( key, reg_value, 0, &type, 0, &size);
+ long err = reg_query_value_ex( key, reg_value, 0, &type, 0, &size);
                   if(!err){
                      //Size includes terminating NULL
                      s.resize(size);
- err = (*pRegQueryValue)( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size);
+ //err = (*pRegQueryValue)( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size);
+ err = reg_query_value_ex( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size);
                      if(!err)
                         s.erase(s.end()-1);
                      (void)err;
                   }
                }
- }
- }
- }
- }
+ //}
+ //}
+ //}
+ //}
 }
 
 
 inline void get_registry_value(const char *folder, const char *value_key, std::vector<unsigned char> &s)
 {
    s.clear();
- void *hAdvapi = load_library("Advapi32.dll");
- if (hAdvapi){
- library_unloader unloader(hAdvapi);
+ //void *hAdvapi = load_library("Advapi32.dll");
+ //if (hAdvapi){
+ //library_unloader unloader(hAdvapi);
       // Pointer to function RegOpenKeyA
- RegOpenKeyEx_t pRegOpenKey =
- (RegOpenKeyEx_t)get_proc_address(hAdvapi, "RegOpenKeyExA");
- if (pRegOpenKey){
+ //RegOpenKeyEx_t pRegOpenKey =
+ //(RegOpenKeyEx_t)get_proc_address(hAdvapi, "RegOpenKeyExA");
+ //if (pRegOpenKey){
          // Pointer to function RegCloseKey
- RegCloseKey_t pRegCloseKey =
- (RegCloseKey_t)get_proc_address(hAdvapi, "RegCloseKey");
- if (pRegCloseKey){
+ //RegCloseKey_t pRegCloseKey =
+ //(RegCloseKey_t)get_proc_address(hAdvapi, "RegCloseKey");
+ //if (pRegCloseKey){
             // Pointer to function RegQueryValueA
- RegQueryValueEx_t pRegQueryValue =
- (RegQueryValueEx_t)get_proc_address(hAdvapi, "RegQueryValueExA");
- if (pRegQueryValue){
+ //RegQueryValueEx_t pRegQueryValue =
+ //(RegQueryValueEx_t)get_proc_address(hAdvapi, "RegQueryValueExA");
+ //if (pRegQueryValue){
                //Open the key
                void *key;
- if ((*pRegOpenKey)( hkey_local_machine
+ //if ((*pRegOpenKey)( hkey_local_machine
+ //, folder
+ //, 0
+ //, key_query_value
+ //, &key) == 0){
+ //reg_closer key_closer(pRegCloseKey, key);
+ if (reg_open_key_ex( hkey_local_machine
                                  , folder
                                  , 0
                                  , key_query_value
                                  , &key) == 0){
- reg_closer key_closer(pRegCloseKey, key);
+ reg_closer key_closer(key);
 
                   //Obtain the value
                   unsigned long size;
                   unsigned long type;
                   const char *const reg_value = value_key;
- long err = (*pRegQueryValue)( key, reg_value, 0, &type, 0, &size);
+ //long err = (*pRegQueryValue)( key, reg_value, 0, &type, 0, &size);
+ long err = reg_query_value_ex( key, reg_value, 0, &type, 0, &size);
                   if(!err){
                      //Size includes terminating NULL
                      s.resize(size);
- err = (*pRegQueryValue)( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size);
+ //err = (*pRegQueryValue)( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size);
+ err = reg_query_value_ex( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size);
                      if(!err)
                         s.erase(s.end()-1);
                      (void)err;
                   }
                }
- }
- }
- }
- }
+ //}
+ //}
+ //}
+ //}
 }
 
 struct co_uninitializer
@@ -1470,6 +1593,7 @@
    if(co_init_ret != S_OK_IG && co_init_ret != S_FALSE_IG)
       return false;
    co_uninitializer co_initialize_end;
+ (void)co_initialize_end;
 
    bool bRet = false;
    long sec_init_ret = CoInitializeSecurity
@@ -1527,7 +1651,8 @@
       if ( 0 != pWbemServices->ExecQuery(
             L"WQL",
             strValue.c_str(),
- WBEM_FLAG_RETURN_IMMEDIATELY_IG,
+ //WBEM_FLAG_RETURN_IMMEDIATELY_IG,
+ WBEM_FLAG_RETURN_WHEN_COMPLETE_IG | WBEM_FLAG_FORWARD_ONLY_IG,
             0,
             &pEnumObject
             )
@@ -1537,9 +1662,10 @@
 
       com_releaser<IEnumWbemClassObject_IG> IEnumWbemClassObject_releaser(pEnumObject);
 
- if ( 0 != pEnumObject->Reset() ){
- return false;
- }
+ //WBEM_FLAG_FORWARD_ONLY_IG incompatible with Reset
+ //if ( 0 != pEnumObject->Reset() ){
+ //return false;
+ //}
 
       wchar_variant vwchar;
       unsigned long uCount = 1, uReturned;
@@ -1583,6 +1709,13 @@
    return ret;
 }
 
+inline bool is_directory(const char *path)
+{
+ unsigned long attrib = GetFileAttributesA(path);
+
+ return (attrib != invalid_file_attributes &&
+ (attrib & file_attribute_directory));
+}
 
 } //namespace winapi
 } //namespace interprocess

Modified: branches/release/boost/interprocess/detail/xsi_shared_memory_device.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/xsi_shared_memory_device.hpp (original)
+++ branches/release/boost/interprocess/detail/xsi_shared_memory_device.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -45,7 +45,7 @@
 class xsi_shared_memory_device
 {
    /// @cond
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(xsi_shared_memory_file_wrapper)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(xsi_shared_memory_file_wrapper)
    /// @endcond
 
    public:
@@ -70,10 +70,10 @@
    xsi_shared_memory_device(open_only_t, const char *filepath, boost::uint8_t id, mode_t mode)
    { this->priv_open_or_create_name_id(detail::DoOpen, name, id, mode, 0); }
 
- xsi_shared_memory_device(BOOST_INTERPROCESS_RV_REF(xsi_shared_memory_device) moved)
+ xsi_shared_memory_device(BOOST_RV_REF(xsi_shared_memory_device) moved)
    { this->swap(moved); }
 
- xsi_shared_memory_device &operator=(BOOST_INTERPROCESS_RV_REF(xsi_shared_memory_device) moved)
+ xsi_shared_memory_device &operator=(BOOST_RV_REF(xsi_shared_memory_device) moved)
    {
       xsi_shared_memory_device tmp(boost::interprocess::move(moved));
       this->swap(tmp);

Modified: branches/release/boost/interprocess/errors.hpp
==============================================================================
--- branches/release/boost/interprocess/errors.hpp (original)
+++ branches/release/boost/interprocess/errors.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -157,7 +157,8 @@
    { /*ERROR_DISK_FULL*/112L, out_of_space_error },
    { /*ERROR_OUTOFMEMORY*/14L, out_of_memory_error },
    { /*ERROR_NOT_ENOUGH_MEMORY*/8L, out_of_memory_error },
- { /*ERROR_TOO_MANY_OPEN_FILES*/4L, out_of_resource_error }
+ { /*ERROR_TOO_MANY_OPEN_FILES*/4L, out_of_resource_error },
+ { /*ERROR_INVALID_ADDRESS*/487L, busy_error }
    #else //#if (defined BOOST_INTERPROCESS_WINDOWS)
    { EACCES, security_error },
    { EROFS, read_only_error },

Modified: branches/release/boost/interprocess/file_mapping.hpp
==============================================================================
--- branches/release/boost/interprocess/file_mapping.hpp (original)
+++ branches/release/boost/interprocess/file_mapping.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -33,7 +33,7 @@
 class file_mapping
 {
    /// @cond
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(file_mapping)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(file_mapping)
    /// @endcond
 
    public:
@@ -50,14 +50,14 @@
    //!Moves the ownership of "moved"'s file mapping object to *this.
    //!After the call, "moved" does not represent any file mapping object.
    //!Does not throw
- file_mapping(BOOST_INTERPROCESS_RV_REF(file_mapping) moved)
+ file_mapping(BOOST_RV_REF(file_mapping) moved)
       : m_handle(file_handle_t(detail::invalid_file()))
    { this->swap(moved); }
 
    //!Moves the ownership of "moved"'s file mapping to *this.
    //!After the call, "moved" does not represent any file mapping.
    //!Does not throw
- file_mapping &operator=(BOOST_INTERPROCESS_RV_REF(file_mapping) moved)
+ file_mapping &operator=(BOOST_RV_REF(file_mapping) moved)
    {
       file_mapping tmp(boost::interprocess::move(moved));
       this->swap(tmp);

Modified: branches/release/boost/interprocess/indexes/flat_map_index.hpp
==============================================================================
--- branches/release/boost/interprocess/indexes/flat_map_index.hpp (original)
+++ branches/release/boost/interprocess/indexes/flat_map_index.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -63,7 +63,7 @@
    {}
 
    //!This reserves memory to optimize the insertion of n elements in the index
- void reserve(std::size_t n)
+ void reserve(typename segment_manager_base::size_type n)
    { base_type::reserve(n); }
 
    //!This frees all unnecessary memory

Modified: branches/release/boost/interprocess/indexes/iset_index.hpp
==============================================================================
--- branches/release/boost/interprocess/indexes/iset_index.hpp (original)
+++ branches/release/boost/interprocess/indexes/iset_index.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -112,7 +112,7 @@
 
    //!This reserves memory to optimize the insertion of n
    //!elements in the index
- void reserve(std::size_t)
+ void reserve(typename MapConfig::segment_manager_base::size_type)
    { /*Does nothing, map has not reserve or rehash*/ }
 
    //!This frees all unnecessary memory

Modified: branches/release/boost/interprocess/indexes/iunordered_set_index.hpp
==============================================================================
--- branches/release/boost/interprocess/indexes/iunordered_set_index.hpp (original)
+++ branches/release/boost/interprocess/indexes/iunordered_set_index.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -101,6 +101,7 @@
       < value_type
       , bi::hash<hash_function>
       , bi::equal<equal_function>
+ , bi::size_type<typename segment_manager_base::size_type>
>::type index_t;
    typedef typename index_t::bucket_type bucket_type;
    typedef allocator
@@ -157,24 +158,24 @@
 
    enum { InitBufferSize = 64};
 
- static bucket_ptr create_buckets(allocator_type &alloc, std::size_t num)
+ static bucket_ptr create_buckets(allocator_type &alloc, size_type num)
    {
       num = index_type::suggested_upper_bucket_count(num);
       bucket_ptr buckets = alloc.allocate(num);
       bucket_ptr buckets_init = buckets;
- for(std::size_t i = 0; i < num; ++i){
+ for(size_type i = 0; i < num; ++i){
          new(get_pointer(buckets_init++))bucket_type();
       }
       return buckets;
    }
 
- static std::size_t shrink_buckets
- ( bucket_ptr buckets, std::size_t old_size
- , allocator_type &alloc, std::size_t new_size)
+ static size_type shrink_buckets
+ ( bucket_ptr buckets, size_type old_size
+ , allocator_type &alloc, size_type new_size)
    {
       if(old_size <= new_size )
          return old_size;
- std::size_t received_size;
+ size_type received_size;
       if(!alloc.allocation_command
          (boost::interprocess::try_shrink_in_place | boost::interprocess::nothrow_allocation, old_size, new_size, received_size, buckets).first){
          return old_size;
@@ -192,29 +193,29 @@
       BOOST_ASSERT(buckets == shunk_p);
 
       bucket_ptr buckets_init = buckets + received_size;
- for(std::size_t i = 0; i < (old_size - received_size); ++i){
+ for(size_type i = 0; i < (old_size - received_size); ++i){
          get_pointer(buckets_init++)->~bucket_type();
       }
       return received_size;
    }
 
    static bucket_ptr expand_or_create_buckets
- ( bucket_ptr old_buckets, const std::size_t old_num
- , allocator_type &alloc, const std::size_t new_num)
+ ( bucket_ptr old_buckets, const size_type old_num
+ , allocator_type &alloc, const size_type new_num)
    {
- std::size_t received_size;
+ size_type received_size;
       std::pair<bucket_ptr, bool> ret =
          alloc.allocation_command
             (boost::interprocess::expand_fwd | boost::interprocess::allocate_new, new_num, new_num, received_size, old_buckets);
       if(ret.first == old_buckets){
          bucket_ptr buckets_init = old_buckets + old_num;
- for(std::size_t i = 0; i < (new_num - old_num); ++i){
+ for(size_type i = 0; i < (new_num - old_num); ++i){
             new(get_pointer(buckets_init++))bucket_type();
          }
       }
       else{
          bucket_ptr buckets_init = ret.first;
- for(std::size_t i = 0; i < new_num; ++i){
+ for(size_type i = 0; i < new_num; ++i){
             new(get_pointer(buckets_init++))bucket_type();
          }
       }
@@ -223,10 +224,10 @@
    }
 
    static void destroy_buckets
- (allocator_type &alloc, bucket_ptr buckets, std::size_t num)
+ (allocator_type &alloc, bucket_ptr buckets, size_type num)
    {
       bucket_ptr buckets_destroy = buckets;
- for(std::size_t i = 0; i < num; ++i){
+ for(size_type i = 0; i < num; ++i){
          get_pointer(buckets_destroy++)->~bucket_type();
       }
       alloc.deallocate(buckets, num);
@@ -255,7 +256,7 @@
 
    //!This reserves memory to optimize the insertion of n
    //!elements in the index
- void reserve(std::size_t new_n)
+ void reserve(size_type new_n)
    {
       //Let's maintain a 1.0f load factor
       size_type old_n = this->bucket_count();

Modified: branches/release/boost/interprocess/indexes/map_index.hpp
==============================================================================
--- branches/release/boost/interprocess/indexes/map_index.hpp (original)
+++ branches/release/boost/interprocess/indexes/map_index.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -71,7 +71,7 @@
 
    //!This reserves memory to optimize the insertion of n
    //!elements in the index
- void reserve(std::size_t)
+ void reserve(typename segment_manager_base::size_type)
       { /*Does nothing, map has not reserve or rehash*/ }
 
    //!This tries to free previously allocate

Modified: branches/release/boost/interprocess/indexes/unordered_map_index.hpp
==============================================================================
--- branches/release/boost/interprocess/indexes/unordered_map_index.hpp (original)
+++ branches/release/boost/interprocess/indexes/unordered_map_index.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -84,7 +84,7 @@
 
    //!This reserves memory to optimize the insertion of n
    //!elements in the index
- void reserve(std::size_t n)
+ void reserve(typename segment_manager_base::size_type n)
    { base_type::rehash(n); }
 
    //!This tries to free previously allocate

Modified: branches/release/boost/interprocess/interprocess_fwd.hpp
==============================================================================
--- branches/release/boost/interprocess/interprocess_fwd.hpp (original)
+++ branches/release/boost/interprocess/interprocess_fwd.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -35,6 +35,8 @@
 namespace bi = boost::intrusive;
 }}
 
+#ifndef _LIBCPP_VERSION
+
 namespace std {
 
 template <class T>
@@ -51,6 +53,15 @@
 
 } //namespace std {
 
+#else
+
+#include <utility>
+#include <memory>
+#include <functional>
+#include <iosfwd>
+
+#endif
+
 /// @endcond
 
 namespace boost { namespace interprocess {
@@ -158,7 +169,9 @@
 // offset_ptr
 //////////////////////////////////////////////////////////////////////////////
 
-template <class T>
+static const std::size_t offset_type_alignment = 0;
+
+template <class T, class DifferenceType = std::ptrdiff_t, class OffsetType = std::size_t, std::size_t Alignment = offset_type_alignment>
 class offset_ptr;
 
 //////////////////////////////////////////////////////////////////////////////
@@ -410,7 +423,10 @@
 // IPC
 //////////////////////////////////////////////////////////////////////////////
 
-class message_queue;
+template<class VoidPointer>
+class message_queue_t;
+
+typedef message_queue_t<offset_ptr<void> > message_queue;
 
 }} //namespace boost { namespace interprocess {
 

Modified: branches/release/boost/interprocess/ipc/message_queue.hpp
==============================================================================
--- branches/release/boost/interprocess/ipc/message_queue.hpp (original)
+++ branches/release/boost/interprocess/ipc/message_queue.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -25,7 +25,9 @@
 #include <boost/interprocess/permissions.hpp>
 #include <boost/detail/no_exceptions_support.hpp>
 #include <boost/interprocess/detail/type_traits.hpp>
-
+#include <boost/pointer_to_other.hpp>
+#include <boost/type_traits/make_unsigned.hpp>
+#include <boost/type_traits/alignment_of.hpp>
 #include <algorithm> //std::lower_bound
 #include <cstddef> //std::size_t
 #include <cstring> //memcpy
@@ -40,24 +42,29 @@
 
 //!A class that allows sending messages
 //!between processes.
-class message_queue
+template<class VoidPointer>
+class message_queue_t
 {
    /// @cond
    //Blocking modes
    enum block_t { blocking, timed, non_blocking };
 
- message_queue();
+ message_queue_t();
    /// @endcond
 
    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::make_unsigned<difference_type>::type size_type;
 
    //!Creates a process shared message queue with name "name". For this message queue,
    //!the maximum number of messages will be "max_num_msg" and the maximum message size
    //!will be "max_msg_size". Throws on error and if the queue was previously created.
- message_queue(create_only_t create_only,
+ message_queue_t(create_only_t create_only,
                  const char *name,
- std::size_t max_num_msg,
- std::size_t max_msg_size,
+ size_type max_num_msg,
+ size_type max_msg_size,
                  const permissions &perm = permissions());
 
    //!Opens or creates a process shared message queue with name "name".
@@ -65,16 +72,16 @@
    //!and the maximum message size will be "max_msg_size". If queue was previously
    //!created the queue will be opened and "max_num_msg" and "max_msg_size" parameters
    //!are ignored. Throws on error.
- message_queue(open_or_create_t open_or_create,
+ message_queue_t(open_or_create_t open_or_create,
                  const char *name,
- std::size_t max_num_msg,
- std::size_t max_msg_size,
+ size_type max_num_msg,
+ size_type max_msg_size,
                  const permissions &perm = permissions());
 
    //!Opens a previously created process shared message queue with name "name".
    //!If the was not previously created or there are no free resources,
    //!throws an error.
- message_queue(open_only_t open_only,
+ message_queue_t(open_only_t open_only,
                  const char *name);
 
    //!Destroys *this and indicates that the calling process is finished using
@@ -84,19 +91,19 @@
    //!this resource. The resource can still be opened again calling
    //!the open constructor overload. To erase the message queue from the system
    //!use remove().
- ~message_queue();
+ ~message_queue_t();
 
    //!Sends a message stored in buffer "buffer" with size "buffer_size" in the
    //!message queue with priority "priority". If the message queue is full
    //!the sender is blocked. Throws interprocess_error on error.*/
- void send (const void *buffer, std::size_t buffer_size,
+ void send (const void *buffer, size_type buffer_size,
               unsigned int priority);
 
    //!Sends a message stored in buffer "buffer" with size "buffer_size" through the
    //!message queue with priority "priority". If the message queue is full
    //!the sender is not blocked and returns false, otherwise returns true.
    //!Throws interprocess_error on error.
- bool try_send (const void *buffer, std::size_t buffer_size,
+ bool try_send (const void *buffer, size_type buffer_size,
                          unsigned int priority);
 
    //!Sends a message stored in buffer "buffer" with size "buffer_size" in the
@@ -104,23 +111,23 @@
    //!the sender retries until time "abs_time" is reached. Returns true if
    //!the message has been successfully sent. Returns false if timeout is reached.
    //!Throws interprocess_error on error.
- bool timed_send (const void *buffer, std::size_t buffer_size,
+ bool timed_send (const void *buffer, size_type buffer_size,
                            unsigned int priority, const boost::posix_time::ptime& abs_time);
 
    //!Receives a message from the message queue. The message is stored in buffer
    //!"buffer", which has size "buffer_size". The received message has size
    //!"recvd_size" and priority "priority". If the message queue is empty
    //!the receiver is blocked. Throws interprocess_error on error.
- void receive (void *buffer, std::size_t buffer_size,
- std::size_t &recvd_size,unsigned int &priority);
+ void receive (void *buffer, size_type buffer_size,
+ size_type &recvd_size,unsigned int &priority);
 
    //!Receives a message from the message queue. The message is stored in buffer
    //!"buffer", which has size "buffer_size". The received message has size
    //!"recvd_size" and priority "priority". If the message queue is empty
    //!the receiver is not blocked and returns false, otherwise returns true.
    //!Throws interprocess_error on error.
- bool try_receive (void *buffer, std::size_t buffer_size,
- std::size_t &recvd_size,unsigned int &priority);
+ bool try_receive (void *buffer, size_type buffer_size,
+ size_type &recvd_size,unsigned int &priority);
 
    //!Receives a message from the message queue. The message is stored in buffer
    //!"buffer", which has size "buffer_size". The received message has size
@@ -128,23 +135,23 @@
    //!the receiver retries until time "abs_time" is reached. Returns true if
    //!the message has been successfully sent. Returns false if timeout is reached.
    //!Throws interprocess_error on error.
- bool timed_receive (void *buffer, std::size_t buffer_size,
- std::size_t &recvd_size,unsigned int &priority,
+ bool timed_receive (void *buffer, size_type buffer_size,
+ size_type &recvd_size,unsigned int &priority,
                        const boost::posix_time::ptime &abs_time);
 
    //!Returns the maximum number of messages allowed by the queue. The message
    //!queue must be opened or created previously. Otherwise, returns 0.
    //!Never throws
- std::size_t get_max_msg() const;
+ size_type get_max_msg() const;
 
    //!Returns the maximum size of message allowed by the queue. The message
    //!queue must be opened or created previously. Otherwise, returns 0.
    //!Never throws
- std::size_t get_max_msg_size() const;
+ size_type get_max_msg_size() const;
 
    //!Returns the number of messages currently stored.
    //!Never throws
- std::size_t get_num_msg();
+ size_type get_num_msg();
 
    //!Removes the message queue from the system.
    //!Returns false on error. Never throws
@@ -154,17 +161,17 @@
    private:
    typedef boost::posix_time::ptime ptime;
    bool do_receive(block_t block,
- void *buffer, std::size_t buffer_size,
- std::size_t &recvd_size, unsigned int &priority,
+ void *buffer, size_type buffer_size,
+ size_type &recvd_size, unsigned int &priority,
                    const ptime &abs_time);
 
    bool do_send(block_t block,
- const void *buffer, std::size_t buffer_size,
+ const void *buffer, size_type buffer_size,
                 unsigned int priority, const ptime &abs_time);
 
    //!Returns the needed memory size for the shared message queue.
    //!Never throws
- static std::size_t get_mem_size(std::size_t max_msg_size, std::size_t max_num_msg);
+ static size_type get_mem_size(size_type max_msg_size, size_type max_num_msg);
 
    detail::managed_open_or_create_impl<shared_memory_object> m_shmem;
    /// @endcond
@@ -175,21 +182,32 @@
 namespace detail {
 
 //!This header is the prefix of each message in the queue
+template<class VoidPointer>
 class msg_hdr_t
 {
+ 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;
+
    public:
- std::size_t len; // Message length
+ size_type len; // Message length
    unsigned int priority;// Message priority
    //!Returns the data buffer associated with this this message
    void * data(){ return this+1; } //
 };
 
 //!This functor is the predicate to order stored messages by priority
+template<class VoidPointer>
 class priority_functor
 {
+ typedef typename boost::
+ pointer_to_other<VoidPointer, msg_hdr_t<VoidPointer> >::type msg_hdr_ptr_t;
+
    public:
- bool operator()(const offset_ptr<msg_hdr_t> &msg1,
- const offset_ptr<msg_hdr_t> &msg2) const
+ bool operator()(const msg_hdr_ptr_t &msg1,
+ const msg_hdr_ptr_t &msg2) const
       { return msg1->priority < msg2->priority; }
 };
 
@@ -225,23 +243,32 @@
 //! An array of buffers of preallocated messages, each one prefixed with the
 //! msg_hdr_t structure. Each of this message is pointed by one pointer of
 //! the index structure.
+template<class VoidPointer>
 class mq_hdr_t
- : public detail::priority_functor
+ : public detail::priority_functor<VoidPointer>
 {
- typedef offset_ptr<msg_hdr_t> msg_hdr_ptr_t;
+ 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;
+ typedef typename boost::
+ pointer_to_other<void_pointer, msg_hdr_ptr_t>::type msg_hdr_ptr_ptr_t;
+
    public:
    //!Constructor. This object must be constructed in the beginning of the
    //!shared memory of the size returned by the function "get_mem_size".
    //!This constructor initializes the needed resources and creates
    //!the internal structures like the priority index. This can throw.*/
- mq_hdr_t(std::size_t max_num_msg, std::size_t max_msg_size)
+ mq_hdr_t(size_type max_num_msg, size_type max_msg_size)
       : m_max_num_msg(max_num_msg),
          m_max_msg_size(max_msg_size),
          m_cur_num_msg(0)
       { this->initialize_memory(); }
 
    //!Returns the inserted message with top priority
- msg_hdr_t * top_msg()
+ msg_header * top_msg()
       { return mp_index[m_cur_num_msg-1].get(); }
 
    //!Returns true if the message queue is full
@@ -257,7 +284,7 @@
       { --m_cur_num_msg; }
 
    //!Returns the first free msg of the free message queue
- msg_hdr_t * free_msg()
+ msg_header * free_msg()
       { return mp_index[m_cur_num_msg].get(); }
 
    //!Inserts the first free message in the priority queue
@@ -268,7 +295,7 @@
       //Get priority queue's range
       msg_hdr_ptr_t *it = &mp_index[0], *it_end = &mp_index[m_cur_num_msg];
       //Check where the free message should be placed
- it = std::lower_bound(it, it_end, free, static_cast<priority_functor&>(*this));
+ it = std::lower_bound(it, it_end, free, static_cast<priority_functor<VoidPointer>&>(*this));
       //Make room in that position
       std::copy_backward(it, it_end, it_end+1);
       //Insert the free message in the correct position
@@ -279,15 +306,15 @@
    //!Returns the number of bytes needed to construct a message queue with
    //!"max_num_size" maximum number of messages and "max_msg_size" maximum
    //!message size. Never throws.
- static std::size_t get_mem_size
- (std::size_t max_msg_size, std::size_t max_num_msg)
+ static size_type get_mem_size
+ (size_type max_msg_size, size_type max_num_msg)
    {
- const std::size_t
- msg_hdr_align = detail::alignment_of<detail::msg_hdr_t>::value,
- index_align = detail::alignment_of<msg_hdr_ptr_t>::value,
+ const size_type
+ msg_hdr_align = ::boost::alignment_of<msg_header>::value,
+ index_align = ::boost::alignment_of<msg_hdr_ptr_t>::value,
          r_hdr_size = detail::ct_rounded_size<sizeof(mq_hdr_t), index_align>::value,
          r_index_size = detail::get_rounded_size(sizeof(msg_hdr_ptr_t)*max_num_msg, msg_hdr_align),
- r_max_msg_size = detail::get_rounded_size(max_msg_size, msg_hdr_align) + sizeof(detail::msg_hdr_t);
+ r_max_msg_size = detail::get_rounded_size(max_msg_size, msg_hdr_align) + sizeof(msg_header);
       return r_hdr_size + r_index_size + (max_num_msg*r_max_msg_size) +
          detail::managed_open_or_create_impl<shared_memory_object>::ManagedOpenOrCreateUserOffset;
    }
@@ -296,41 +323,41 @@
    //!message index. Never throws.
    void initialize_memory()
    {
- const std::size_t
- msg_hdr_align = detail::alignment_of<detail::msg_hdr_t>::value,
- index_align = detail::alignment_of<msg_hdr_ptr_t>::value,
+ const size_type
+ msg_hdr_align = ::boost::alignment_of<msg_header>::value,
+ index_align = ::boost::alignment_of<msg_hdr_ptr_t>::value,
          r_hdr_size = detail::ct_rounded_size<sizeof(mq_hdr_t), index_align>::value,
          r_index_size = detail::get_rounded_size(sizeof(msg_hdr_ptr_t)*m_max_num_msg, msg_hdr_align),
- r_max_msg_size = detail::get_rounded_size(m_max_msg_size, msg_hdr_align) + sizeof(detail::msg_hdr_t);
+ r_max_msg_size = detail::get_rounded_size(m_max_msg_size, msg_hdr_align) + sizeof(msg_header);
 
       //Pointer to the index
       msg_hdr_ptr_t *index = reinterpret_cast<msg_hdr_ptr_t*>
                                  (reinterpret_cast<char*>(this)+r_hdr_size);
 
       //Pointer to the first message header
- detail::msg_hdr_t *msg_hdr = reinterpret_cast<detail::msg_hdr_t*>
+ msg_header *msg_hdr = reinterpret_cast<msg_header*>
                                  (reinterpret_cast<char*>(this)+r_hdr_size+r_index_size);
 
       //Initialize the pointer to the index
       mp_index = index;
 
       //Initialize the index so each slot points to a preallocated message
- for(std::size_t i = 0; i < m_max_num_msg; ++i){
+ for(size_type i = 0; i < m_max_num_msg; ++i){
          index[i] = msg_hdr;
- msg_hdr = reinterpret_cast<detail::msg_hdr_t*>
+ msg_hdr = reinterpret_cast<msg_header*>
                         (reinterpret_cast<char*>(msg_hdr)+r_max_msg_size);
       }
    }
 
    public:
    //Pointer to the index
- offset_ptr<msg_hdr_ptr_t> mp_index;
+ msg_hdr_ptr_ptr_t mp_index;
    //Maximum number of messages of the queue
- const std::size_t m_max_num_msg;
+ const size_type m_max_num_msg;
    //Maximum size of messages of the queue
- const std::size_t m_max_msg_size;
+ const size_type m_max_msg_size;
    //Current number of messages
- std::size_t m_cur_num_msg;
+ size_type m_cur_num_msg;
    //Mutex to protect data structures
    interprocess_mutex m_mutex;
    //Condition block receivers when there are no messages
@@ -342,14 +369,19 @@
 
 //!This is the atomic functor to be executed when creating or opening
 //!shared memory. Never throws
+template<class VoidPointer>
 class initialization_func_t
 {
    public:
- initialization_func_t(std::size_t maxmsg = 0,
- std::size_t maxmsgsize = 0)
+ 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;
+
+ initialization_func_t(size_type maxmsg = 0,
+ size_type maxmsgsize = 0)
       : m_maxmsg (maxmsg), m_maxmsgsize(maxmsgsize) {}
 
- bool operator()(void *address, std::size_t, bool created)
+ bool operator()(void *address, size_type, bool created)
    {
       char *mptr;
 
@@ -357,7 +389,7 @@
          mptr = reinterpret_cast<char*>(address);
          //Construct the message queue header at the beginning
          BOOST_TRY{
- new (mptr) mq_hdr_t(m_maxmsg, m_maxmsgsize);
+ new (mptr) mq_hdr_t<VoidPointer>(m_maxmsg, m_maxmsgsize);
          }
          BOOST_CATCH(...){
             return false;
@@ -366,39 +398,43 @@
       }
       return true;
    }
- const std::size_t m_maxmsg;
- const std::size_t m_maxmsgsize;
+ const size_type m_maxmsg;
+ const size_type m_maxmsgsize;
 };
 
 } //namespace detail {
 
-inline message_queue::~message_queue()
+template<class VoidPointer>
+inline message_queue_t<VoidPointer>::~message_queue_t()
 {}
 
-inline std::size_t message_queue::get_mem_size
- (std::size_t max_msg_size, std::size_t max_num_msg)
-{ return detail::mq_hdr_t::get_mem_size(max_msg_size, max_num_msg); }
+template<class VoidPointer>
+inline typename message_queue_t<VoidPointer>::size_type message_queue_t<VoidPointer>::get_mem_size
+ (size_type max_msg_size, size_type max_num_msg)
+{ return detail::mq_hdr_t<VoidPointer>::get_mem_size(max_msg_size, max_num_msg); }
 
-inline message_queue::message_queue(create_only_t create_only,
+template<class VoidPointer>
+inline message_queue_t<VoidPointer>::message_queue_t(create_only_t create_only,
                                     const char *name,
- std::size_t max_num_msg,
- std::size_t max_msg_size,
+ size_type max_num_msg,
+ size_type max_msg_size,
                                     const permissions &perm)
       //Create shared memory and execute functor atomically
    : m_shmem(create_only,
               name,
- get_mem_size(max_msg_size, max_num_msg),
+ get_mem_size(max_msg_size, max_num_msg),
               read_write,
               static_cast<void*>(0),
               //Prepare initialization functor
- detail::initialization_func_t (max_num_msg, max_msg_size),
+ detail::initialization_func_t<VoidPointer> (max_num_msg, max_msg_size),
               perm)
 {}
 
-inline message_queue::message_queue(open_or_create_t open_or_create,
+template<class VoidPointer>
+inline message_queue_t<VoidPointer>::message_queue_t(open_or_create_t open_or_create,
                                     const char *name,
- std::size_t max_num_msg,
- std::size_t max_msg_size,
+ size_type max_num_msg,
+ size_type max_msg_size,
                                     const permissions &perm)
       //Create shared memory and execute functor atomically
    : m_shmem(open_or_create,
@@ -407,11 +443,12 @@
               read_write,
               static_cast<void*>(0),
               //Prepare initialization functor
- detail::initialization_func_t (max_num_msg, max_msg_size),
+ detail::initialization_func_t<VoidPointer> (max_num_msg, max_msg_size),
               perm)
 {}
 
-inline message_queue::message_queue(open_only_t open_only,
+template<class VoidPointer>
+inline message_queue_t<VoidPointer>::message_queue_t(open_only_t open_only,
                                     const char *name)
    //Create shared memory and execute functor atomically
    : m_shmem(open_only,
@@ -419,19 +456,22 @@
               read_write,
               static_cast<void*>(0),
               //Prepare initialization functor
- detail::initialization_func_t ())
+ detail::initialization_func_t<VoidPointer> ())
 {}
 
-inline void message_queue::send
- (const void *buffer, std::size_t buffer_size, unsigned int priority)
+template<class VoidPointer>
+inline void message_queue_t<VoidPointer>::send
+ (const void *buffer, size_type buffer_size, unsigned int priority)
 { this->do_send(blocking, buffer, buffer_size, priority, ptime()); }
 
-inline bool message_queue::try_send
- (const void *buffer, std::size_t buffer_size, unsigned int priority)
+template<class VoidPointer>
+inline bool message_queue_t<VoidPointer>::try_send
+ (const void *buffer, size_type buffer_size, unsigned int priority)
 { return this->do_send(non_blocking, buffer, buffer_size, priority, ptime()); }
 
-inline bool message_queue::timed_send
- (const void *buffer, std::size_t buffer_size
+template<class VoidPointer>
+inline bool message_queue_t<VoidPointer>::timed_send
+ (const void *buffer, size_type buffer_size
    ,unsigned int priority, const boost::posix_time::ptime &abs_time)
 {
    if(abs_time == boost::posix_time::pos_infin){
@@ -441,11 +481,12 @@
    return this->do_send(timed, buffer, buffer_size, priority, abs_time);
 }
 
-inline bool message_queue::do_send(block_t block,
- const void *buffer, std::size_t buffer_size,
+template<class VoidPointer>
+inline bool message_queue_t<VoidPointer>::do_send(block_t block,
+ const void *buffer, size_type buffer_size,
                                 unsigned int priority, const boost::posix_time::ptime &abs_time)
 {
- detail::mq_hdr_t *p_hdr = static_cast<detail::mq_hdr_t*>(m_shmem.get_user_address());
+ detail::mq_hdr_t<VoidPointer> *p_hdr = static_cast<detail::mq_hdr_t<VoidPointer>*>(m_shmem.get_user_address());
    //Check if buffer is smaller than maximum allowed
    if (buffer_size > p_hdr->m_max_msg_size) {
       throw interprocess_exception(size_error);
@@ -486,7 +527,7 @@
       }
       
       //Get the first free message from free message queue
- detail::msg_hdr_t *free_msg = p_hdr->free_msg();
+ detail::msg_hdr_t<VoidPointer> *free_msg = p_hdr->free_msg();
       if (free_msg == 0) {
          throw interprocess_exception("boost::interprocess::message_queue corrupted");
       }
@@ -511,18 +552,21 @@
    return true;
 }
 
-inline void message_queue::receive(void *buffer, std::size_t buffer_size,
- std::size_t &recvd_size, unsigned int &priority)
+template<class VoidPointer>
+inline void message_queue_t<VoidPointer>::receive(void *buffer, size_type buffer_size,
+ size_type &recvd_size, unsigned int &priority)
 { this->do_receive(blocking, buffer, buffer_size, recvd_size, priority, ptime()); }
 
+template<class VoidPointer>
 inline bool
- message_queue::try_receive(void *buffer, std::size_t buffer_size,
- std::size_t &recvd_size, unsigned int &priority)
+ message_queue_t<VoidPointer>::try_receive(void *buffer, size_type buffer_size,
+ size_type &recvd_size, unsigned int &priority)
 { return this->do_receive(non_blocking, buffer, buffer_size, recvd_size, priority, ptime()); }
 
+template<class VoidPointer>
 inline bool
- message_queue::timed_receive(void *buffer, std::size_t buffer_size,
- std::size_t &recvd_size, unsigned int &priority,
+ message_queue_t<VoidPointer>::timed_receive(void *buffer, size_type buffer_size,
+ size_type &recvd_size, unsigned int &priority,
                                 const boost::posix_time::ptime &abs_time)
 {
    if(abs_time == boost::posix_time::pos_infin){
@@ -532,13 +576,14 @@
    return this->do_receive(timed, buffer, buffer_size, recvd_size, priority, abs_time);
 }
 
+template<class VoidPointer>
 inline bool
- message_queue::do_receive(block_t block,
- void *buffer, std::size_t buffer_size,
- std::size_t &recvd_size, unsigned int &priority,
+ message_queue_t<VoidPointer>::do_receive(block_t block,
+ void *buffer, size_type buffer_size,
+ size_type &recvd_size, unsigned int &priority,
                           const boost::posix_time::ptime &abs_time)
 {
- detail::mq_hdr_t *p_hdr = static_cast<detail::mq_hdr_t*>(m_shmem.get_user_address());
+ detail::mq_hdr_t<VoidPointer> *p_hdr = static_cast<detail::mq_hdr_t<VoidPointer>*>(m_shmem.get_user_address());
    //Check if buffer is big enough for any message
    if (buffer_size < p_hdr->m_max_msg_size) {
       throw interprocess_exception(size_error);
@@ -580,7 +625,7 @@
       }
 
       //Thre is at least message ready to pick, get the top one
- detail::msg_hdr_t *top_msg = p_hdr->top_msg();
+ detail::msg_hdr_t<VoidPointer> *top_msg = p_hdr->top_msg();
 
       //Paranoia check
       if (top_msg == 0) {
@@ -592,7 +637,7 @@
       priority = top_msg->priority;
 
       //Copy data to receiver's bufers
- std::memcpy(buffer, top_msg->data(), recvd_size);
+ std::memcpy(buffer, top_msg->data(), recvd_size);
 
 // bool was_full = p_hdr->is_full();
 
@@ -608,20 +653,23 @@
    return true;
 }
 
-inline std::size_t message_queue::get_max_msg() const
+template<class VoidPointer>
+inline typename message_queue_t<VoidPointer>::size_type message_queue_t<VoidPointer>::get_max_msg() const
 {
- detail::mq_hdr_t *p_hdr = static_cast<detail::mq_hdr_t*>(m_shmem.get_user_address());
+ detail::mq_hdr_t<VoidPointer> *p_hdr = static_cast<detail::mq_hdr_t<VoidPointer>*>(m_shmem.get_user_address());
    return p_hdr ? p_hdr->m_max_num_msg : 0; }
 
-inline std::size_t message_queue::get_max_msg_size() const
+template<class VoidPointer>
+inline typename message_queue_t<VoidPointer>::size_type message_queue_t<VoidPointer>::get_max_msg_size() const
 {
- detail::mq_hdr_t *p_hdr = static_cast<detail::mq_hdr_t*>(m_shmem.get_user_address());
+ detail::mq_hdr_t<VoidPointer> *p_hdr = static_cast<detail::mq_hdr_t<VoidPointer>*>(m_shmem.get_user_address());
    return p_hdr ? p_hdr->m_max_msg_size : 0;
 }
 
-inline std::size_t message_queue::get_num_msg()
+template<class VoidPointer>
+inline typename message_queue_t<VoidPointer>::size_type message_queue_t<VoidPointer>::get_num_msg()
 {
- detail::mq_hdr_t *p_hdr = static_cast<detail::mq_hdr_t*>(m_shmem.get_user_address());
+ detail::mq_hdr_t<VoidPointer> *p_hdr = static_cast<detail::mq_hdr_t<VoidPointer>*>(m_shmem.get_user_address());
    if(p_hdr){
       //---------------------------------------------
       scoped_lock<interprocess_mutex> lock(p_hdr->m_mutex);
@@ -632,7 +680,8 @@
    return 0;
 }
 
-inline bool message_queue::remove(const char *name)
+template<class VoidPointer>
+inline bool message_queue_t<VoidPointer>::remove(const char *name)
 { return shared_memory_object::remove(name); }
 
 /// @endcond

Modified: branches/release/boost/interprocess/managed_external_buffer.hpp
==============================================================================
--- branches/release/boost/interprocess/managed_external_buffer.hpp (original)
+++ branches/release/boost/interprocess/managed_external_buffer.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -43,10 +43,11 @@
    /// @cond
    typedef detail::basic_managed_memory_impl
       <CharType, AllocationAlgorithm, IndexType> base_t;
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(basic_managed_external_buffer)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_managed_external_buffer)
    /// @endcond
    
    public:
+ typedef typename base_t::size_type size_type;
 
    //!Default constructor. Does nothing.
    //!Useful in combination with move semantics
@@ -55,10 +56,10 @@
 
    //!Creates and places the segment manager. This can throw
    basic_managed_external_buffer
- (create_only_t, void *addr, std::size_t size)
+ (create_only_t, void *addr, size_type size)
    {
       //Check if alignment is correct
- BOOST_ASSERT((0 == (((std::size_t)addr) & (AllocationAlgorithm::Alignment - std::size_t(1u)))));
+ BOOST_ASSERT((0 == (((std::size_t)addr) & (AllocationAlgorithm::Alignment - size_type(1u)))));
       if(!base_t::create_impl(addr, size)){
          throw interprocess_exception("Could not initialize buffer in basic_managed_external_buffer constructor");
       }
@@ -66,30 +67,30 @@
 
    //!Creates and places the segment manager. This can throw
    basic_managed_external_buffer
- (open_only_t, void *addr, std::size_t size)
+ (open_only_t, void *addr, size_type size)
    {
       //Check if alignment is correct
- BOOST_ASSERT((0 == (((std::size_t)addr) & (AllocationAlgorithm::Alignment - std::size_t(1u)))));
+ BOOST_ASSERT((0 == (((std::size_t)addr) & (AllocationAlgorithm::Alignment - size_type(1u)))));
       if(!base_t::open_impl(addr, size)){
          throw interprocess_exception("Could not initialize buffer in basic_managed_external_buffer constructor");
       }
    }
 
    //!Moves the ownership of "moved"'s managed memory to *this. Does not throw
- basic_managed_external_buffer(BOOST_INTERPROCESS_RV_REF(basic_managed_external_buffer) moved)
+ basic_managed_external_buffer(BOOST_RV_REF(basic_managed_external_buffer) moved)
    {
       this->swap(moved);
    }
 
    //!Moves the ownership of "moved"'s managed memory to *this. Does not throw
- basic_managed_external_buffer &operator=(BOOST_INTERPROCESS_RV_REF(basic_managed_external_buffer) moved)
+ basic_managed_external_buffer &operator=(BOOST_RV_REF(basic_managed_external_buffer) moved)
    {
       basic_managed_external_buffer tmp(boost::interprocess::move(moved));
       this->swap(tmp);
       return *this;
    }
 
- void grow(std::size_t extra_bytes)
+ void grow(size_type extra_bytes)
    { base_t::grow(extra_bytes); }
 
    //!Swaps the ownership of the managed heap memories managed by *this and other.

Modified: branches/release/boost/interprocess/managed_heap_memory.hpp
==============================================================================
--- branches/release/boost/interprocess/managed_heap_memory.hpp (original)
+++ branches/release/boost/interprocess/managed_heap_memory.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -46,10 +46,11 @@
 
    typedef detail::basic_managed_memory_impl
       <CharType, AllocationAlgorithm, IndexType> base_t;
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(basic_managed_heap_memory)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_managed_heap_memory)
    /// @endcond
 
    public: //functions
+ typedef typename base_t::size_type size_type;
 
    //!Default constructor. Does nothing.
    //!Useful in combination with move semantics
@@ -62,7 +63,7 @@
 
    //!Creates heap memory and initializes the segment manager.
    //!This can throw.
- basic_managed_heap_memory(std::size_t size)
+ basic_managed_heap_memory(size_type size)
       : m_heapmem(size, char(0))
    {
       if(!base_t::create_impl(&m_heapmem[0], size)){
@@ -72,11 +73,11 @@
    }
 
    //!Moves the ownership of "moved"'s managed memory to *this. Does not throw
- basic_managed_heap_memory(BOOST_INTERPROCESS_RV_REF(basic_managed_heap_memory) moved)
+ basic_managed_heap_memory(BOOST_RV_REF(basic_managed_heap_memory) moved)
    { this->swap(moved); }
 
    //!Moves the ownership of "moved"'s managed memory to *this. Does not throw
- basic_managed_heap_memory &operator=(BOOST_INTERPROCESS_RV_REF(basic_managed_heap_memory) moved)
+ basic_managed_heap_memory &operator=(BOOST_RV_REF(basic_managed_heap_memory) moved)
    {
       basic_managed_heap_memory tmp(boost::interprocess::move(moved));
       this->swap(tmp);
@@ -92,12 +93,12 @@
    //!Returns true if the growth has been successful, so you will
    //!have some extra bytes to allocate new objects. If returns
    //!false, the heap allocation has failed.
- bool grow(std::size_t extra_bytes)
+ bool grow(size_type extra_bytes)
    {
       //If memory is reallocated, data will
       //be automatically copied
       BOOST_TRY{
- m_heapmem.resize(m_heapmem.size()+extra_bytes);
+ m_heapmem.resize(m_heapmem.size()+extra_bytes);
       }
       BOOST_CATCH(...){
          return false;

Modified: branches/release/boost/interprocess/managed_mapped_file.hpp
==============================================================================
--- branches/release/boost/interprocess/managed_mapped_file.hpp (original)
+++ branches/release/boost/interprocess/managed_mapped_file.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -48,6 +48,7 @@
       <CharType, AllocationAlgorithm, IndexType,
       detail::managed_open_or_create_impl<detail::file_wrapper>::ManagedOpenOrCreateUserOffset> base_t;
    typedef detail::file_wrapper device_type;
+ typedef typename base_t::size_type size_type;
 
    private:
 
@@ -59,7 +60,7 @@
 
    private:
    typedef typename base_t::char_ptr_holder_t char_ptr_holder_t;
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(basic_managed_mapped_file)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_managed_mapped_file)
    /// @endcond
 
    public: //functions
@@ -72,7 +73,7 @@
    //!Creates mapped file and creates and places the segment manager.
    //!This can throw.
    basic_managed_mapped_file(create_only_t create_only, const char *name,
- std::size_t size, const void *addr = 0, const permissions &perm = permissions())
+ size_type size, const void *addr = 0, const permissions &perm = permissions())
       : m_mfile(create_only, name, size, read_write, addr,
                 create_open_func_t(get_this_pointer(), detail::DoCreate), perm)
    {}
@@ -82,7 +83,7 @@
    //!segment.
    //!This can throw.
    basic_managed_mapped_file (open_or_create_t open_or_create,
- const char *name, std::size_t size,
+ const char *name, size_type size,
                               const void *addr = 0, const permissions &perm = permissions())
       : m_mfile(open_or_create, name, size, read_write, addr,
                 create_open_func_t(get_this_pointer(),
@@ -120,14 +121,14 @@
 
    //!Moves the ownership of "moved"'s managed memory to *this.
    //!Does not throw
- basic_managed_mapped_file(BOOST_INTERPROCESS_RV_REF(basic_managed_mapped_file) moved)
+ basic_managed_mapped_file(BOOST_RV_REF(basic_managed_mapped_file) moved)
    {
       this->swap(moved);
    }
 
    //!Moves the ownership of "moved"'s managed memory to *this.
    //!Does not throw
- basic_managed_mapped_file &operator=(BOOST_INTERPROCESS_RV_REF(basic_managed_mapped_file) moved)
+ basic_managed_mapped_file &operator=(BOOST_RV_REF(basic_managed_mapped_file) moved)
    {
       basic_managed_mapped_file tmp(boost::interprocess::move(moved));
       this->swap(tmp);
@@ -161,7 +162,7 @@
    //!
    //!This function is not synchronized so no other thread or process should
    //!be reading or writing the file
- static bool grow(const char *filename, std::size_t extra_bytes)
+ static bool grow(const char *filename, size_type extra_bytes)
    {
       return base_t::template grow
          <basic_managed_mapped_file>(filename, extra_bytes);
@@ -183,7 +184,7 @@
    //!buffer and the object count. If not found returned pointer is 0.
    //!Never throws.
    template <class T>
- std::pair<T*, std::size_t> find (char_ptr_holder_t name)
+ std::pair<T*, size_type> find (char_ptr_holder_t name)
    {
       if(m_mfile.get_mapped_region().get_mode() == read_only){
          return base_t::template find_no_lock<T>(name);

Modified: branches/release/boost/interprocess/managed_shared_memory.hpp
==============================================================================
--- branches/release/boost/interprocess/managed_shared_memory.hpp (original)
+++ branches/release/boost/interprocess/managed_shared_memory.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -45,10 +45,6 @@
    , private detail::managed_open_or_create_impl<shared_memory_object>
 {
    /// @cond
- public:
- typedef shared_memory_object device_type;
-
- private:
    typedef detail::basic_managed_memory_impl
       <CharType, AllocationAlgorithm, IndexType,
       detail::managed_open_or_create_impl<shared_memory_object>::ManagedOpenOrCreateUserOffset> base_t;
@@ -60,9 +56,13 @@
    basic_managed_shared_memory *get_this_pointer()
    { return this; }
 
+ public:
+ typedef shared_memory_object device_type;
+ typedef typename base_t::size_type size_type;
+
    private:
    typedef typename base_t::char_ptr_holder_t char_ptr_holder_t;
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(basic_managed_shared_memory)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_managed_shared_memory)
    /// @endcond
 
    public: //functions
@@ -84,7 +84,7 @@
    //!Creates shared memory and creates and places the segment manager.
    //!This can throw.
    basic_managed_shared_memory(create_only_t create_only, const char *name,
- std::size_t size, const void *addr = 0, const permissions& perm = permissions())
+ 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(), detail::DoCreate), perm)
@@ -95,7 +95,7 @@
    //!segment.
    //!This can throw.
    basic_managed_shared_memory (open_or_create_t open_or_create,
- const char *name, std::size_t size,
+ 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,
@@ -137,7 +137,7 @@
 
    //!Moves the ownership of "moved"'s managed memory to *this.
    //!Does not throw
- basic_managed_shared_memory(BOOST_INTERPROCESS_RV_REF(basic_managed_shared_memory) moved)
+ basic_managed_shared_memory(BOOST_RV_REF(basic_managed_shared_memory) moved)
    {
       basic_managed_shared_memory tmp;
       this->swap(moved);
@@ -146,7 +146,7 @@
 
    //!Moves the ownership of "moved"'s managed memory to *this.
    //!Does not throw
- basic_managed_shared_memory &operator=(BOOST_INTERPROCESS_RV_REF(basic_managed_shared_memory) moved)
+ basic_managed_shared_memory &operator=(BOOST_RV_REF(basic_managed_shared_memory) moved)
    {
       basic_managed_shared_memory tmp(boost::interprocess::move(moved));
       this->swap(tmp);
@@ -166,7 +166,7 @@
    //!
    //!This function is not synchronized so no other thread or process should
    //!be reading or writing the file
- static bool grow(const char *shmname, std::size_t extra_bytes)
+ static bool grow(const char *shmname, size_type extra_bytes)
    {
       return base_t::template grow
          <basic_managed_shared_memory>(shmname, extra_bytes);
@@ -193,7 +193,7 @@
    //!buffer and the object count. If not found returned pointer is 0.
    //!Never throws.
    template <class T>
- std::pair<T*, std::size_t> find (char_ptr_holder_t name)
+ std::pair<T*, size_type> find (char_ptr_holder_t name)
    {
       if(base2_t::get_mapped_region().get_mode() == read_only){
          return base_t::template find_no_lock<T>(name);

Modified: branches/release/boost/interprocess/managed_windows_shared_memory.hpp
==============================================================================
--- branches/release/boost/interprocess/managed_windows_shared_memory.hpp (original)
+++ branches/release/boost/interprocess/managed_windows_shared_memory.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -61,10 +61,11 @@
 
    private:
    typedef typename base_t::char_ptr_holder_t char_ptr_holder_t;
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(basic_managed_windows_shared_memory)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_managed_windows_shared_memory)
    /// @endcond
 
    public: //functions
+ typedef typename base_t::size_type size_type;
 
    //!Default constructor. Does nothing.
    //!Useful in combination with move semantics
@@ -75,7 +76,7 @@
    //!This can throw.
    basic_managed_windows_shared_memory
       (create_only_t create_only, const char *name,
- std::size_t size, const void *addr = 0, const permissions &perm = permissions())
+ size_type size, const void *addr = 0, const permissions &perm = permissions())
       : m_wshm(create_only, name, size, read_write, addr,
                 create_open_func_t(get_this_pointer(), detail::DoCreate), perm)
    {}
@@ -86,7 +87,7 @@
    //!This can throw.
    basic_managed_windows_shared_memory
       (open_or_create_t open_or_create,
- const char *name, std::size_t size,
+ const char *name, size_type size,
       const void *addr = 0,
       const permissions &perm = permissions())
       : m_wshm(open_or_create, name, size, read_write, addr,
@@ -125,12 +126,12 @@
    //!Moves the ownership of "moved"'s managed memory to *this.
    //!Does not throw
    basic_managed_windows_shared_memory
- (BOOST_INTERPROCESS_RV_REF(basic_managed_windows_shared_memory) moved)
+ (BOOST_RV_REF(basic_managed_windows_shared_memory) moved)
    { this->swap(moved); }
 
    //!Moves the ownership of "moved"'s managed memory to *this.
    //!Does not throw
- basic_managed_windows_shared_memory &operator=(BOOST_INTERPROCESS_RV_REF(basic_managed_windows_shared_memory) moved)
+ 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));
       this->swap(tmp);
@@ -159,7 +160,7 @@
    //!buffer and the object count. If not found returned pointer is 0.
    //!Never throws.
    template <class T>
- std::pair<T*, std::size_t> find (char_ptr_holder_t name)
+ std::pair<T*, size_type> find (char_ptr_holder_t name)
    {
       if(m_wshm.get_mapped_region().get_mode() == read_only){
          return base_t::template find_no_lock<T>(name);

Modified: branches/release/boost/interprocess/managed_xsi_shared_memory.hpp
==============================================================================
--- branches/release/boost/interprocess/managed_xsi_shared_memory.hpp (original)
+++ branches/release/boost/interprocess/managed_xsi_shared_memory.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -64,10 +64,11 @@
 
    private:
    typedef typename base_t::char_ptr_holder_t char_ptr_holder_t;
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(basic_managed_xsi_shared_memory)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_managed_xsi_shared_memory)
    /// @endcond
 
    public: //functions
+ typedef typename base_t::size_type size_type;
 
    //!Destroys *this and indicates that the calling process is finished using
    //!the resource. The destructor function will deallocate
@@ -128,7 +129,7 @@
 
    //!Moves the ownership of "moved"'s managed memory to *this.
    //!Does not throw
- basic_managed_xsi_shared_memory(BOOST_INTERPROCESS_RV_REF(basic_managed_xsi_shared_memory) moved)
+ basic_managed_xsi_shared_memory(BOOST_RV_REF(basic_managed_xsi_shared_memory) moved)
    {
       basic_managed_xsi_shared_memory tmp;
       this->swap(moved);
@@ -137,7 +138,7 @@
 
    //!Moves the ownership of "moved"'s managed memory to *this.
    //!Does not throw
- basic_managed_xsi_shared_memory &operator=(BOOST_INTERPROCESS_RV_REF(basic_managed_xsi_shared_memory) moved)
+ 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));
       this->swap(tmp);

Modified: branches/release/boost/interprocess/mapped_region.hpp
==============================================================================
--- branches/release/boost/interprocess/mapped_region.hpp (original)
+++ branches/release/boost/interprocess/mapped_region.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -59,7 +59,7 @@
 {
    /// @cond
    //Non-copyable
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(mapped_region)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(mapped_region)
    /// @endcond
 
    public:
@@ -81,7 +81,7 @@
 
    //!Move constructor. *this will be constructed taking ownership of "other"'s
    //!region and "other" will be left in default constructor state.
- mapped_region(BOOST_INTERPROCESS_RV_REF(mapped_region) other)
+ mapped_region(BOOST_RV_REF(mapped_region) other)
    #if defined (BOOST_INTERPROCESS_WINDOWS)
    : m_base(0), m_size(0), m_offset(0)
    , m_extra_offset(0)
@@ -99,7 +99,7 @@
 
    //!Move assignment. If *this owns a memory mapped region, it will be
    //!destroyed and it will take ownership of "other"'s memory mapped region.
- mapped_region &operator=(BOOST_INTERPROCESS_RV_REF(mapped_region) other)
+ mapped_region &operator=(BOOST_RV_REF(mapped_region) other)
    {
       mapped_region tmp(boost::interprocess::move(other));
       this->swap(tmp);
@@ -524,7 +524,7 @@
 
    //Check for fixed mapping error
    if(address && (old_base != address)){
- error_info err = system_error_code();
+ error_info err(busy_error);
       this->priv_close();
       throw interprocess_exception(err);
    }

Modified: branches/release/boost/interprocess/mem_algo/detail/mem_algo_common.hpp
==============================================================================
--- branches/release/boost/interprocess/mem_algo/detail/mem_algo_common.hpp (original)
+++ branches/release/boost/interprocess/mem_algo/detail/mem_algo_common.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -50,19 +50,20 @@
    typedef typename MemoryAlgorithm::block_ctrl block_ctrl;
    typedef typename MemoryAlgorithm::multiallocation_chain multiallocation_chain;
    typedef memory_algorithm_common<MemoryAlgorithm> this_type;
+ typedef typename MemoryAlgorithm::size_type size_type;
 
- static const std::size_t Alignment = MemoryAlgorithm::Alignment;
- static const std::size_t MinBlockUnits = MemoryAlgorithm::MinBlockUnits;
- static const std::size_t AllocatedCtrlBytes = MemoryAlgorithm::AllocatedCtrlBytes;
- static const std::size_t AllocatedCtrlUnits = MemoryAlgorithm::AllocatedCtrlUnits;
- static const std::size_t BlockCtrlBytes = MemoryAlgorithm::BlockCtrlBytes;
- static const std::size_t BlockCtrlUnits = MemoryAlgorithm::BlockCtrlUnits;
- static const std::size_t UsableByPreviousChunk = MemoryAlgorithm::UsableByPreviousChunk;
+ static const size_type Alignment = MemoryAlgorithm::Alignment;
+ static const size_type MinBlockUnits = MemoryAlgorithm::MinBlockUnits;
+ static const size_type AllocatedCtrlBytes = MemoryAlgorithm::AllocatedCtrlBytes;
+ static const size_type AllocatedCtrlUnits = MemoryAlgorithm::AllocatedCtrlUnits;
+ static const size_type BlockCtrlBytes = MemoryAlgorithm::BlockCtrlBytes;
+ static const size_type BlockCtrlUnits = MemoryAlgorithm::BlockCtrlUnits;
+ static const size_type UsableByPreviousChunk = MemoryAlgorithm::UsableByPreviousChunk;
 
    static void assert_alignment(const void *ptr)
    { assert_alignment((std::size_t)ptr); }
 
- static void assert_alignment(std::size_t uint_ptr)
+ static void assert_alignment(size_type uint_ptr)
    {
       (void)uint_ptr;
       BOOST_ASSERT(uint_ptr % Alignment == 0);
@@ -71,17 +72,17 @@
    static bool check_alignment(const void *ptr)
    { return (((std::size_t)ptr) % Alignment == 0); }
 
- static std::size_t ceil_units(std::size_t size)
+ static size_type ceil_units(size_type size)
    { return detail::get_rounded_size(size, Alignment)/Alignment; }
 
- static std::size_t floor_units(std::size_t size)
+ static size_type floor_units(size_type size)
    { return size/Alignment; }
 
- static std::size_t multiple_of_units(std::size_t size)
+ static size_type multiple_of_units(size_type size)
    { return detail::get_rounded_size(size, Alignment); }
 
    static multiallocation_chain allocate_many
- (MemoryAlgorithm *memory_algo, std::size_t elem_bytes, std::size_t n_elements)
+ (MemoryAlgorithm *memory_algo, size_type elem_bytes, size_type n_elements)
    {
       return this_type::priv_allocate_many(memory_algo, &elem_bytes, n_elements, 0);
    }
@@ -92,19 +93,19 @@
    }
 
    static bool calculate_lcm_and_needs_backwards_lcmed
- (std::size_t backwards_multiple, std::size_t received_size, std::size_t size_to_achieve,
- std::size_t &lcm_out, std::size_t &needs_backwards_lcmed_out)
+ (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
- std::size_t max = backwards_multiple;
- std::size_t min = Alignment;
- std::size_t needs_backwards;
- std::size_t needs_backwards_lcmed;
- std::size_t lcm;
- std::size_t current_forward;
+ size_type max = backwards_multiple;
+ size_type min = Alignment;
+ size_type needs_backwards;
+ size_type needs_backwards_lcmed;
+ size_type lcm;
+ size_type current_forward;
       //Swap if necessary
       if(max < min){
- std::size_t tmp = min;
+ size_type tmp = min;
          min = max;
          max = tmp;
       }
@@ -152,7 +153,7 @@
       }
       //Check if it's multiple of the half of the alignmment
       else if((backwards_multiple & ((Alignment/4u) - 1u)) == 0){
- std::size_t remainder;
+ size_type remainder;
          lcm = backwards_multiple*4u;
          current_forward = detail::get_truncated_size(received_size, backwards_multiple);
          needs_backwards_lcmed = needs_backwards = size_to_achieve - current_forward;
@@ -188,25 +189,25 @@
 
    static multiallocation_chain allocate_many
       ( MemoryAlgorithm *memory_algo
- , const std::size_t *elem_sizes
- , std::size_t n_elements
- , std::size_t sizeof_element)
+ , const size_type *elem_sizes
+ , size_type n_elements
+ , size_type sizeof_element)
    {
       return this_type::priv_allocate_many(memory_algo, elem_sizes, n_elements, sizeof_element);
    }
 
    static void* allocate_aligned
- (MemoryAlgorithm *memory_algo, std::size_t nbytes, std::size_t alignment)
+ (MemoryAlgorithm *memory_algo, size_type nbytes, size_type alignment)
    {
       
       //Ensure power of 2
- if ((alignment & (alignment - std::size_t(1u))) != 0){
+ if ((alignment & (alignment - size_type(1u))) != 0){
          //Alignment is not power of two
- BOOST_ASSERT((alignment & (alignment - std::size_t(1u))) == 0);
+ BOOST_ASSERT((alignment & (alignment - size_type(1u))) == 0);
          return 0;
       }
 
- std::size_t real_size;
+ size_type real_size;
       if(alignment <= Alignment){
          return memory_algo->priv_allocate
             (boost::interprocess::allocate_new, nbytes, nbytes, real_size).first;
@@ -217,8 +218,8 @@
       
       //We can find a aligned portion if we allocate a block that has alignment
       //nbytes + alignment bytes or more.
- std::size_t minimum_allocation = max_value
- (nbytes + alignment, std::size_t(MinBlockUnits*Alignment));
+ size_type minimum_allocation = max_value
+ (nbytes + alignment, size_type(MinBlockUnits*Alignment));
       //Since we will split that block, we must request a bit more memory
       //if the alignment is near the beginning of the buffer, because otherwise,
       //there is no space for a new block before the alignment.
@@ -228,7 +229,7 @@
       // -----------------------------------------------------
       // | MBU |
       // -----------------------------------------------------
- std::size_t request =
+ size_type request =
          minimum_allocation + (2*MinBlockUnits*Alignment - AllocatedCtrlBytes
          //prevsize - UsableByPreviousChunk
          );
@@ -243,9 +244,9 @@
          //If we are lucky and the buffer is aligned, just split it and
          //return the high part
          block_ctrl *first = memory_algo->priv_get_block(buffer);
- std::size_t old_size = first->m_size;
- const std::size_t first_min_units =
- max_value(ceil_units(nbytes) + AllocatedCtrlUnits, std::size_t(MinBlockUnits));
+ size_type old_size = first->m_size;
+ const size_type first_min_units =
+ max_value(ceil_units(nbytes) + AllocatedCtrlUnits, size_type(MinBlockUnits));
          //We can create a new block in the end of the segment
          if(old_size >= (first_min_units + MinBlockUnits)){
             block_ctrl *second = reinterpret_cast<block_ctrl *>
@@ -285,8 +286,8 @@
       BOOST_ASSERT((pos + MinBlockUnits*Alignment - AllocatedCtrlBytes + nbytes*Alignment/Alignment) <=
              (reinterpret_cast<char*>(first) + first->m_size*Alignment));
       //Set the new size of the first block
- std::size_t old_size = first->m_size;
- first->m_size = (reinterpret_cast<char*>(second) - reinterpret_cast<char*>(first))/Alignment;
+ size_type old_size = first->m_size;
+ first->m_size = (size_type)(reinterpret_cast<char*>(second) - reinterpret_cast<char*>(first))/Alignment;
       memory_algo->priv_mark_new_allocated_block(first);
 
       //Now check if we can create a new buffer in the end
@@ -299,7 +300,7 @@
       // -----------------------------------------------------
       //This size will be the minimum size to be able to create a
       //new block in the end.
- const std::size_t second_min_units = max_value(std::size_t(MinBlockUnits),
+ const size_type second_min_units = max_value(size_type(MinBlockUnits),
                         ceil_units(nbytes) + AllocatedCtrlUnits );
 
       //Check if we can create a new block (of size MinBlockUnits) in the end of the segment
@@ -325,13 +326,13 @@
 
    static bool try_shrink
       (MemoryAlgorithm *memory_algo, void *ptr
- ,const std::size_t max_size, const std::size_t preferred_size
- ,std::size_t &received_size)
+ ,const size_type max_size, const size_type preferred_size
+ ,size_type &received_size)
    {
       (void)memory_algo;
       //Obtain the real block
       block_ctrl *block = memory_algo->priv_get_block(ptr);
- std::size_t old_block_units = block->m_size;
+ size_type old_block_units = (size_type)block->m_size;
 
       //The block must be marked as allocated
       BOOST_ASSERT(memory_algo->priv_is_allocated_block(block));
@@ -343,15 +344,15 @@
       received_size = (old_block_units - AllocatedCtrlUnits)*Alignment + UsableByPreviousChunk;
 
       //Now translate it to Alignment units
- const std::size_t max_user_units = floor_units(max_size - UsableByPreviousChunk);
- const std::size_t preferred_user_units = ceil_units(preferred_size - UsableByPreviousChunk);
+ const size_type max_user_units = floor_units(max_size - UsableByPreviousChunk);
+ const size_type preferred_user_units = ceil_units(preferred_size - UsableByPreviousChunk);
 
       //Check if rounded max and preferred are possible correct
       if(max_user_units < preferred_user_units)
          return false;
 
       //Check if the block is smaller than the requested minimum
- std::size_t old_user_units = old_block_units - AllocatedCtrlUnits;
+ size_type old_user_units = old_block_units - AllocatedCtrlUnits;
 
       if(old_user_units < preferred_user_units)
          return false;
@@ -360,7 +361,7 @@
       if(old_user_units == preferred_user_units)
          return true;
 
- std::size_t shrunk_user_units =
+ size_type shrunk_user_units =
          ((BlockCtrlUnits - AllocatedCtrlUnits) > preferred_user_units)
          ? (BlockCtrlUnits - AllocatedCtrlUnits)
          : preferred_user_units;
@@ -381,12 +382,12 @@
 
    static bool shrink
       (MemoryAlgorithm *memory_algo, void *ptr
- ,const std::size_t max_size, const std::size_t preferred_size
- ,std::size_t &received_size)
+ ,const size_type max_size, const size_type preferred_size
+ ,size_type &received_size)
    {
       //Obtain the real block
       block_ctrl *block = memory_algo->priv_get_block(ptr);
- std::size_t old_block_units = block->m_size;
+ size_type old_block_units = (size_type)block->m_size;
 
       if(!try_shrink
          (memory_algo, ptr, max_size, preferred_size, received_size)){
@@ -417,24 +418,24 @@
    private:
    static multiallocation_chain priv_allocate_many
       ( MemoryAlgorithm *memory_algo
- , const std::size_t *elem_sizes
- , std::size_t n_elements
- , std::size_t sizeof_element)
+ , const size_type *elem_sizes
+ , size_type n_elements
+ , size_type sizeof_element)
    {
       //Note: sizeof_element == 0 indicates that we want to
       //allocate n_elements of the same size "*elem_sizes"
 
       //Calculate the total size of all requests
- std::size_t total_request_units = 0;
- std::size_t elem_units = 0;
- const std::size_t ptr_size_units = memory_algo->priv_get_total_units(sizeof(void_pointer));
+ size_type total_request_units = 0;
+ size_type elem_units = 0;
+ const size_type ptr_size_units = memory_algo->priv_get_total_units(sizeof(void_pointer));
       if(!sizeof_element){
          elem_units = memory_algo->priv_get_total_units(*elem_sizes);
          elem_units = ptr_size_units > elem_units ? ptr_size_units : elem_units;
          total_request_units = n_elements*elem_units;
       }
       else{
- for(std::size_t i = 0; i < n_elements; ++i){
+ for(size_type i = 0; i < n_elements; ++i){
             elem_units = memory_algo->priv_get_total_units(elem_sizes[i]*sizeof_element);
             elem_units = ptr_size_units > elem_units ? ptr_size_units : elem_units;
             total_request_units += elem_units;
@@ -443,15 +444,15 @@
 
       multiallocation_chain chain;
 
- std::size_t low_idx = 0;
+ size_type low_idx = 0;
       while(low_idx < n_elements){
- std::size_t total_bytes = total_request_units*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk;
- std::size_t min_allocation = (!sizeof_element)
+ size_type total_bytes = total_request_units*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk;
+ size_type min_allocation = (!sizeof_element)
             ? elem_units
             : memory_algo->priv_get_total_units(elem_sizes[low_idx]*sizeof_element);
          min_allocation = min_allocation*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk;
 
- std::size_t received_size;
+ size_type received_size;
          std::pair<void *, bool> ret = memory_algo->priv_allocate
             (boost::interprocess::allocate_new, min_allocation, total_bytes, received_size, 0);
          if(!ret.first){
@@ -459,10 +460,10 @@
          }
 
          block_ctrl *block = memory_algo->priv_get_block(ret.first);
- std::size_t received_units = block->m_size;
+ size_type received_units = (size_type)block->m_size;
          char *block_address = reinterpret_cast<char*>(block);
 
- std::size_t total_used_units = 0;
+ size_type total_used_units = 0;
 // block_ctrl *prev_block = 0;
          while(total_used_units < received_units){
             if(sizeof_element){
@@ -481,7 +482,7 @@
                (total_used_units + elem_units +
                ((!sizeof_element)
                   ? elem_units
- : memory_algo->priv_get_total_units(elem_sizes[low_idx+1]*sizeof_element))
+ : std::max(memory_algo->priv_get_total_units(elem_sizes[low_idx+1]*sizeof_element), ptr_size_units))
                ) > received_units){
                //By default, the new block will use the rest of the buffer
                new_block->m_size = received_units - total_used_units;
@@ -490,8 +491,8 @@
                //If the remaining units are bigger than needed and we can
                //split it obtaining a new free memory block do it.
                if((received_units - total_used_units) >= (elem_units + MemoryAlgorithm::BlockCtrlUnits)){
- std::size_t shrunk_received;
- std::size_t shrunk_request = elem_units*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk;
+ size_type shrunk_received;
+ size_type shrunk_request = elem_units*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk;
                   bool shrink_ok = shrink
                         (memory_algo
                         ,memory_algo->priv_get_user_buffer(new_block)
@@ -516,7 +517,7 @@
             }
 
             block_address += new_block->m_size*Alignment;
- total_used_units += new_block->m_size;
+ total_used_units += (size_type)new_block->m_size;
             //Check we have enough room to overwrite the intrusive pointer
             BOOST_ASSERT((new_block->m_size*Alignment - AllocatedCtrlUnits) >= sizeof(void_pointer));
             void_pointer p = new(memory_algo->priv_get_user_buffer(new_block))void_pointer(0);

Modified: branches/release/boost/interprocess/mem_algo/detail/multi_simple_seq_fit.hpp
==============================================================================
--- branches/release/boost/interprocess/mem_algo/detail/multi_simple_seq_fit.hpp (original)
+++ branches/release/boost/interprocess/mem_algo/detail/multi_simple_seq_fit.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -41,13 +41,13 @@
    /*!Constructor. "size" is the total size of the managed memory segment,
       "extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(multi_simple_seq_fit)
       offset that the allocator should not use at all.*/
- multi_simple_seq_fit (std::size_t size, std::size_t extra_hdr_bytes)
+ multi_simple_seq_fit (size_type size, size_type extra_hdr_bytes)
       : base_t(size, extra_hdr_bytes){}
 
    /*!Allocates bytes from existing segments. If there is no memory, it uses
       the growing functor associated with the group to allocate a new segment.
       If this fails, returns 0.*/
- void* allocate (std::size_t nbytes)
+ void* allocate (size_type nbytes)
       { return base_t::multi_allocate(nbytes); }
 };
 

Modified: branches/release/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp
==============================================================================
--- branches/release/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp (original)
+++ branches/release/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -68,6 +68,10 @@
    /*!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::make_unsigned<difference_type>::type size_type;
+
+
    private:
    struct block_ctrl;
    typedef typename boost::
@@ -80,12 +84,12 @@
       block_ctrl_ptr m_next;
       /*!This block's memory size (including block_ctrl
          header) in BasicSize units*/
- std::size_t m_size;
+ size_type m_size;
    
- std::size_t get_user_bytes() const
+ size_type get_user_bytes() const
       { return this->m_size*Alignment - BlockCtrlBytes; }
 
- std::size_t get_total_bytes() const
+ size_type get_total_bytes() const
       { return this->m_size*Alignment; }
 
       static block_ctrl *get_block_from_addr(void *addr)
@@ -112,34 +116,34 @@
       /*!Pointer to the first free block*/
       block_ctrl m_root;
       /*!Allocated bytes for internal checking*/
- std::size_t m_allocated;
+ size_type m_allocated;
       /*!The size of the memory segment*/
- std::size_t m_size;
+ size_type m_size;
    } m_header;
 
    public:
    /*!Constructor. "size" is the total size of the managed memory segment,
       "extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(simple_seq_fit_impl)
       offset that the allocator should not use at all.*/
- simple_seq_fit_impl (std::size_t size, std::size_t extra_hdr_bytes);
+ simple_seq_fit_impl (size_type size, size_type extra_hdr_bytes);
    /*!Destructor.*/
    ~simple_seq_fit_impl();
    /*!Obtains the minimum size needed by the algorithm*/
- static std::size_t get_min_size (std::size_t extra_hdr_bytes);
+ static size_type get_min_size (size_type extra_hdr_bytes);
 
    //Functions for single segment management
 
    /*!Allocates bytes, returns 0 if there is not more memory*/
- void* allocate (std::size_t nbytes);
+ void* allocate (size_type nbytes);
 
    /*!Deallocates previously allocated bytes*/
    void deallocate (void *addr);
 
    /*!Returns the size of the memory segment*/
- std::size_t get_size() const;
+ size_type get_size() const;
 
    /*!Increases managed memory in extra_size bytes more*/
- void grow(std::size_t extra_size);
+ void grow(size_type extra_size);
 
    /*!Returns true if all allocated memory has been deallocated*/
    bool all_memory_deallocated();
@@ -152,30 +156,30 @@
    void clear_free_memory();
 
    std::pair<void *, bool>
- allocation_command (boost::interprocess::allocation_type command, std::size_t limit_size,
- std::size_t preferred_size,std::size_t &received_size,
- void *reuse_ptr = 0, std::size_t backwards_multiple = 1);
+ allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
+ size_type preferred_size,size_type &received_size,
+ void *reuse_ptr = 0, size_type backwards_multiple = 1);
 
    /*!Returns the size of the buffer previously allocated pointed by ptr*/
- std::size_t size(void *ptr) const;
+ size_type size(void *ptr) const;
 
    /*!Allocates aligned bytes, returns 0 if there is not more memory.
       Alignment must be power of 2*/
- void* allocate_aligned (std::size_t nbytes, std::size_t alignment);
+ void* allocate_aligned (size_type nbytes, size_type alignment);
 
    /*!Allocates bytes, if there is no more memory, it executes functor
- f(std::size_t) to allocate a new segment to manage. The functor returns
- std::pair<void*, std::size_t> indicating the base address and size of
+ f(size_type) to allocate a new segment to manage. The functor returns
+ std::pair<void*, size_type> indicating the base address and size of
       the new segment. If the new segment can't be allocated, allocate
       it will return 0.*/
- void* multi_allocate(std::size_t nbytes);
+ void* multi_allocate(size_type nbytes);
 
    private:
    /*!Real allocation algorithm with min allocation option*/
    std::pair<void *, bool> priv_allocate(boost::interprocess::allocation_type command
- ,std::size_t min_size
- ,std::size_t preferred_size
- ,std::size_t &received_size
+ ,size_type min_size
+ ,size_type preferred_size
+ ,size_type &received_size
                                         ,void *reuse_ptr = 0);
    /*!Returns next block if it's free.
       Returns 0 if next block is not free.*/
@@ -187,38 +191,38 @@
 
    /*!Real expand function implementation*/
    bool priv_expand(void *ptr
- ,std::size_t min_size, std::size_t preferred_size
- ,std::size_t &received_size);
+ ,size_type min_size, size_type preferred_size
+ ,size_type &received_size);
 
    /*!Real expand to both sides implementation*/
    void* priv_expand_both_sides(boost::interprocess::allocation_type command
- ,std::size_t min_size
- ,std::size_t preferred_size
- ,std::size_t &received_size
+ ,size_type min_size
+ ,size_type preferred_size
+ ,size_type &received_size
                                ,void *reuse_ptr
                                ,bool only_preferred_backwards);
 
    /*!Real shrink function implementation*/
    bool priv_shrink(void *ptr
- ,std::size_t max_size, std::size_t preferred_size
- ,std::size_t &received_size);
+ ,size_type max_size, size_type preferred_size
+ ,size_type &received_size);
 
    //!Real private aligned allocation function
- void* priv_allocate_aligned (std::size_t nbytes, std::size_t alignment);
+ void* priv_allocate_aligned (size_type nbytes, size_type alignment);
 
    /*!Checks if block has enough memory and splits/unlinks the block
       returning the address to the users*/
- void* priv_check_and_allocate(std::size_t units
+ void* priv_check_and_allocate(size_type units
                                 ,block_ctrl* prev
                                 ,block_ctrl* block
- ,std::size_t &received_size);
+ ,size_type &received_size);
    /*!Real deallocation algorithm*/
    void priv_deallocate(void *addr);
 
    /*!Makes a new memory portion available for allocation*/
- void priv_add_segment(void *addr, std::size_t size);
+ void priv_add_segment(void *addr, size_type size);
 
- enum { Alignment = boost::alignment_of<boost::detail::max_align>::value };
+ enum { Alignment = ::boost::alignment_of<boost::detail::max_align>::value };
    enum { BlockCtrlBytes = detail::ct_rounded_size<sizeof(block_ctrl), Alignment>::value };
    enum { BlockCtrlSize = BlockCtrlBytes/Alignment };
    enum { MinBlockSize = BlockCtrlSize + Alignment };
@@ -229,14 +233,14 @@
 
 template<class MutexFamily, class VoidPointer>
 inline simple_seq_fit_impl<MutexFamily, VoidPointer>::
- simple_seq_fit_impl(std::size_t size, std::size_t extra_hdr_bytes)
+ simple_seq_fit_impl(size_type size, size_type extra_hdr_bytes)
 {
    //Initialize sizes and counters
    m_header.m_allocated = 0;
    m_header.m_size = size;
 
    //Initialize pointers
- std::size_t block1_off = detail::get_rounded_size(sizeof(*this)+extra_hdr_bytes, Alignment);
+ size_type block1_off = detail::get_rounded_size(sizeof(*this)+extra_hdr_bytes, Alignment);
    m_header.m_root.m_next = reinterpret_cast<block_ctrl*>
                               (reinterpret_cast<char*>(this) + block1_off);
    m_header.m_root.m_next->m_size = (size - block1_off)/Alignment;
@@ -252,10 +256,10 @@
 }
 
 template<class MutexFamily, class VoidPointer>
-inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::grow(std::size_t extra_size)
+inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::grow(size_type extra_size)
 {
    //Old highest address block's end offset
- std::size_t old_end = m_header.m_size/Alignment*Alignment;
+ size_type old_end = m_header.m_size/Alignment*Alignment;
 
    //Update managed buffer's size
    m_header.m_size += extra_size;
@@ -276,7 +280,7 @@
 }
 
 template<class MutexFamily, class VoidPointer>
-inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_add_segment(void *addr, std::size_t size)
+inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_add_segment(void *addr, size_type size)
 {
    //Check size
    BOOST_ASSERT(!(size < MinBlockSize));
@@ -293,12 +297,14 @@
 }
 
 template<class MutexFamily, class VoidPointer>
-inline std::size_t simple_seq_fit_impl<MutexFamily, VoidPointer>::get_size() const
+inline typename simple_seq_fit_impl<MutexFamily, VoidPointer>::size_type
+simple_seq_fit_impl<MutexFamily, VoidPointer>::get_size() const
    { return m_header.m_size; }
 
 template<class MutexFamily, class VoidPointer>
-inline std::size_t simple_seq_fit_impl<MutexFamily, VoidPointer>::
- get_min_size (std::size_t extra_hdr_bytes)
+inline typename simple_seq_fit_impl<MutexFamily, VoidPointer>::size_type
+simple_seq_fit_impl<MutexFamily, VoidPointer>::
+ get_min_size (size_type extra_hdr_bytes)
 {
    return detail::get_rounded_size(sizeof(simple_seq_fit_impl)+extra_hdr_bytes
                                   ,Alignment)
@@ -344,7 +350,7 @@
    //-----------------------
    block_ctrl *block = detail::get_pointer(m_header.m_root.m_next);
 
- std::size_t free_memory = 0;
+ size_type free_memory = 0;
 
    //Iterate through all blocks obtaining their size
    do{
@@ -372,18 +378,18 @@
 
 template<class MutexFamily, class VoidPointer>
 inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
- allocate(std::size_t nbytes)
+ allocate(size_type nbytes)
 {
    //-----------------------
    boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
    //-----------------------
- std::size_t ignore;
+ size_type ignore;
    return priv_allocate(boost::interprocess::allocate_new, nbytes, nbytes, ignore).first;
 }
 
 template<class MutexFamily, class VoidPointer>
 inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
- allocate_aligned(std::size_t nbytes, std::size_t alignment)
+ allocate_aligned(size_type nbytes, size_type alignment)
 {
    //-----------------------
    boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
@@ -393,9 +399,9 @@
 
 template<class MutexFamily, class VoidPointer>
 inline std::pair<void *, bool> simple_seq_fit_impl<MutexFamily, VoidPointer>::
- allocation_command (boost::interprocess::allocation_type command, std::size_t min_size,
- std::size_t preferred_size,std::size_t &received_size,
- void *reuse_ptr, std::size_t backwards_multiple)
+ allocation_command (boost::interprocess::allocation_type command, size_type min_size,
+ size_type preferred_size,size_type &received_size,
+ void *reuse_ptr, size_type backwards_multiple)
 {
    //-----------------------
    boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
@@ -408,7 +414,8 @@
 }
 
 template<class MutexFamily, class VoidPointer>
-inline std::size_t simple_seq_fit_impl<MutexFamily, VoidPointer>::
+inline typename simple_seq_fit_impl<MutexFamily, VoidPointer>::size_type
+simple_seq_fit_impl<MutexFamily, VoidPointer>::
    size(void *ptr) const
 {
    //We need no synchronization since this block is not going
@@ -421,19 +428,19 @@
 
 template<class MutexFamily, class VoidPointer>
 inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
- multi_allocate(std::size_t nbytes)
+ multi_allocate(size_type nbytes)
 {
    //-----------------------
    boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
    //-----------------------
    //Multisegment pointer. Let's try first the normal allocation
    //since it's faster.
- std::size_t ignore;
+ size_type ignore;
    void *addr = this->priv_allocate(boost::interprocess::allocate_new, nbytes, nbytes, ignore).first;
    if(!addr){
       //If this fails we will try the allocation through the segment
       //creator.
- std::size_t group, id;
+ size_type group, id;
       //Obtain the segment group of this segment
       void_pointer::get_group_and_id(this, group, id);
       if(group == 0){
@@ -446,7 +453,7 @@
          static_cast<boost::interprocess::multi_segment_services*>
                      (void_pointer::find_group_data(group));
       BOOST_ASSERT(p_services);
- std::pair<void *, std::size_t> ret =
+ std::pair<void *, std::size_t> ret =
          p_services->create_new_segment(MinBlockSize > nbytes ? MinBlockSize : nbytes);
       if(ret.first){
          priv_add_segment(ret.first, ret.second);
@@ -459,9 +466,9 @@
 template<class MutexFamily, class VoidPointer>
 void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
    priv_expand_both_sides(boost::interprocess::allocation_type command
- ,std::size_t min_size
- ,std::size_t preferred_size
- ,std::size_t &received_size
+ ,size_type min_size
+ ,size_type preferred_size
+ ,size_type &received_size
                          ,void *reuse_ptr
                          ,bool only_preferred_backwards)
 {
@@ -482,14 +489,14 @@
       received_size = this->size(reuse_ptr);
    }
    if(command & boost::interprocess::expand_bwd){
- std::size_t extra_forward = !received_size ? 0 : received_size + BlockCtrlBytes;
+ size_type extra_forward = !received_size ? 0 : received_size + BlockCtrlBytes;
       prev_block_t prev_pair = priv_prev_block_if_free(reuse);
       block_ctrl *prev = prev_pair.second;
       if(!prev){
          return 0;
       }
 
- std::size_t needs_backwards =
+ size_type needs_backwards =
          detail::get_rounded_size(preferred_size - extra_forward, Alignment);
    
       if(!only_preferred_backwards){
@@ -538,9 +545,9 @@
 template<class MutexFamily, class VoidPointer>
 std::pair<void *, bool> simple_seq_fit_impl<MutexFamily, VoidPointer>::
    priv_allocate(boost::interprocess::allocation_type command
- ,std::size_t limit_size
- ,std::size_t preferred_size
- ,std::size_t &received_size
+ ,size_type limit_size
+ ,size_type preferred_size
+ ,size_type &received_size
                 ,void *reuse_ptr)
 {
    if(command & boost::interprocess::shrink_in_place){
@@ -555,7 +562,7 @@
       return return_type(0, false);
 
    //Number of units to request (including block_ctrl header)
- std::size_t nunits = detail::get_rounded_size(preferred_size, Alignment)/Alignment + BlockCtrlSize;
+ size_type nunits = detail::get_rounded_size(preferred_size, Alignment)/Alignment + BlockCtrlSize;
 
    //Get the root and the first memory block
    block_ctrl *prev = &m_header.m_root;
@@ -563,7 +570,7 @@
    block_ctrl *root = &m_header.m_root;
    block_ctrl *biggest_block = 0;
    block_ctrl *prev_biggest_block = 0;
- std::size_t biggest_size = limit_size;
+ size_type biggest_size = limit_size;
 
    //Expand in place
    //reuse_ptr, limit_size, preferred_size, received_size
@@ -621,7 +628,7 @@
       (reinterpret_cast<char*>(ptr) + ptr->m_size*Alignment);
 
    //Check if the adjacent block is in the managed segment
- std::size_t distance = (reinterpret_cast<char*>(next_block) - reinterpret_cast<char*>(this))/Alignment;
+ size_type distance = (reinterpret_cast<char*>(next_block) - reinterpret_cast<char*>(this))/Alignment;
    if(distance >= (m_header.m_size/Alignment)){
       //"next_block" does not exist so we can't expand "block"
       return 0;
@@ -657,7 +664,7 @@
       return prev_pair_t(0, 0);
 
    //Check if the previous block is in the managed segment
- std::size_t distance = (reinterpret_cast<char*>(prev_block) - reinterpret_cast<char*>(this))/Alignment;
+ size_type distance = (reinterpret_cast<char*>(prev_block) - reinterpret_cast<char*>(this))/Alignment;
    if(distance >= (m_header.m_size/Alignment)){
       //"previous_block" does not exist so we can't expand "block"
       return prev_pair_t(0, 0);
@@ -669,14 +676,14 @@
 template<class MutexFamily, class VoidPointer>
 inline bool simple_seq_fit_impl<MutexFamily, VoidPointer>::
    priv_expand (void *ptr
- ,std::size_t min_size
- ,std::size_t preferred_size
- ,std::size_t &received_size)
+ ,size_type min_size
+ ,size_type preferred_size
+ ,size_type &received_size)
 {
    //Obtain the real size of the block
    block_ctrl *block = reinterpret_cast<block_ctrl*>
                         (reinterpret_cast<char*>(ptr) - BlockCtrlBytes);
- std::size_t old_block_size = block->m_size;
+ size_type old_block_size = block->m_size;
 
    //All used blocks' next is marked with 0 so check it
    BOOST_ASSERT(block->m_next == 0);
@@ -692,7 +699,7 @@
    if(min_size > preferred_size)
       return false;
 
- std::size_t data_size = old_block_size - BlockCtrlSize;
+ size_type data_size = old_block_size - BlockCtrlSize;
 
    if(data_size >= min_size)
       return true;
@@ -703,7 +710,7 @@
    }
 
    //Is "block" + "next_block" big enough?
- std::size_t merged_size = old_block_size + next_block->m_size;
+ size_type merged_size = old_block_size + next_block->m_size;
 
    //Now we can expand this block further than before
    received_size = merged_size*Alignment - BlockCtrlBytes;
@@ -729,7 +736,7 @@
 
    //Now use check and allocate to do the allocation logic
    preferred_size += BlockCtrlSize;
- std::size_t nunits = preferred_size < merged_size ? preferred_size : merged_size;
+ size_type nunits = preferred_size < merged_size ? preferred_size : merged_size;
 
    //This must success since nunits is less than merged_size!
    if(!this->priv_check_and_allocate (nunits, prev, block, received_size)){
@@ -744,14 +751,14 @@
 template<class MutexFamily, class VoidPointer>
 inline bool simple_seq_fit_impl<MutexFamily, VoidPointer>::
    priv_shrink (void *ptr
- ,std::size_t max_size
- ,std::size_t preferred_size
- ,std::size_t &received_size)
+ ,size_type max_size
+ ,size_type preferred_size
+ ,size_type &received_size)
 {
    //Obtain the real size of the block
    block_ctrl *block = reinterpret_cast<block_ctrl*>
                         (reinterpret_cast<char*>(ptr) - BlockCtrlBytes);
- std::size_t block_size = block->m_size;
+ size_type block_size = block->m_size;
 
    //All used blocks' next is marked with 0 so check it
    BOOST_ASSERT(block->m_next == 0);
@@ -767,7 +774,7 @@
    if(max_size < preferred_size)
       return false;
 
- std::size_t data_size = block_size - BlockCtrlSize;
+ size_type data_size = block_size - BlockCtrlSize;
 
    if(data_size < preferred_size)
       return false;
@@ -801,21 +808,21 @@
 
 template<class MutexFamily, class VoidPointer>
 inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
- priv_allocate_aligned(std::size_t nbytes, std::size_t alignment)
+ priv_allocate_aligned(size_type nbytes, size_type alignment)
 {
    //Ensure power of 2
- if ((alignment & (alignment - std::size_t(1u))) != 0){
+ if ((alignment & (alignment - size_type(1u))) != 0){
       //Alignment is not power of two
- BOOST_ASSERT((alignment & (alignment - std::size_t(1u))) != 0);
+ BOOST_ASSERT((alignment & (alignment - size_type(1u))) != 0);
       return 0;
    }
 
- std::size_t ignore;
+ size_type ignore;
    if(alignment <= Alignment){
       return priv_allocate(boost::interprocess::allocate_new, nbytes, nbytes, ignore).first;
    }
    
- std::size_t request =
+ size_type request =
       nbytes + alignment + MinBlockSize*Alignment - BlockCtrlBytes;
    void *buffer = priv_allocate(boost::interprocess::allocate_new, request, request, ignore).first;
    if(!buffer)
@@ -824,7 +831,7 @@
       return buffer;
 
    char *aligned_portion = reinterpret_cast<char*>
- (reinterpret_cast<std::size_t>(static_cast<char*>(buffer) + alignment - 1) & -alignment);
+ (reinterpret_cast<size_type>(static_cast<char*>(buffer) + alignment - 1) & -alignment);
 
    char *pos = ((aligned_portion - reinterpret_cast<char*>(buffer)) >= (MinBlockSize*Alignment)) ?
       aligned_portion : (aligned_portion + alignment);
@@ -834,7 +841,7 @@
 
    block_ctrl *second = reinterpret_cast<block_ctrl*>(pos - BlockCtrlBytes);
 
- std::size_t old_size = first->m_size;
+ size_type old_size = first->m_size;
 
    first->m_size = (reinterpret_cast<char*>(second) - reinterpret_cast<char*>(first))/Alignment;
    second->m_size = old_size - first->m_size;
@@ -849,19 +856,19 @@
 
 template<class MutexFamily, class VoidPointer> inline
 void* simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_check_and_allocate
- (std::size_t nunits
+ (size_type nunits
    ,typename simple_seq_fit_impl<MutexFamily, VoidPointer>::block_ctrl* prev
    ,typename simple_seq_fit_impl<MutexFamily, VoidPointer>::block_ctrl* block
- ,std::size_t &received_size)
+ ,size_type &received_size)
 {
- std::size_t upper_nunits = nunits + BlockCtrlSize;
+ size_type upper_nunits = nunits + BlockCtrlSize;
    bool found = false;
 
    if (block->m_size > upper_nunits){
       //This block is bigger than needed, split it in
       //two blocks, the first's size will be (block->m_size-units)
       //the second's size (units)
- std::size_t total_size = block->m_size;
+ size_type total_size = block->m_size;
       block->m_size = nunits;
       block_ctrl *new_block = reinterpret_cast<block_ctrl*>
                      (reinterpret_cast<char*>(block) + Alignment*nunits);
@@ -923,7 +930,7 @@
    BOOST_ASSERT((reinterpret_cast<char*>(addr) - reinterpret_cast<char*>(this))
             % Alignment == 0 );
 
- std::size_t total_size = Alignment*block->m_size;
+ size_type total_size = Alignment*block->m_size;
    BOOST_ASSERT(m_header.m_allocated >= total_size);
   
    //Update used memory count

Modified: branches/release/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp
==============================================================================
--- branches/release/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp (original)
+++ branches/release/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -31,6 +31,8 @@
 #include <boost/interprocess/detail/type_traits.hpp>
 #include <boost/interprocess/sync/scoped_lock.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>
 #include <algorithm>
 #include <utility>
 #include <cstring>
@@ -57,6 +59,8 @@
    simple_seq_fit_impl();
    simple_seq_fit_impl(const simple_seq_fit_impl &);
    simple_seq_fit_impl &operator=(const simple_seq_fit_impl &);
+
+ typedef typename boost::pointer_to_other<VoidPointer, char>::type char_ptr;
 
    public:
 
@@ -67,6 +71,10 @@
    typedef boost::container::containers_detail::
       basic_multiallocation_chain<VoidPointer> multiallocation_chain;
 
+ typedef typename std::iterator_traits<char_ptr>::difference_type difference_type;
+ typedef typename boost::make_unsigned<difference_type>::type size_type;
+
+
    private:
    class block_ctrl;
    typedef typename boost::
@@ -83,12 +91,12 @@
       block_ctrl_ptr m_next;
       //!This block's memory size (including block_ctrl
       //!header) in BasicSize units
- std::size_t m_size;
+ size_type m_size;
    
- std::size_t get_user_bytes() const
+ size_type get_user_bytes() const
       { return this->m_size*Alignment - BlockCtrlBytes; }
 
- std::size_t get_total_bytes() const
+ size_type get_total_bytes() const
       { return this->m_size*Alignment; }
    };
 
@@ -102,11 +110,11 @@
       //!Pointer to the first free block
       block_ctrl m_root;
       //!Allocated bytes for internal checking
- std::size_t m_allocated;
+ size_type m_allocated;
       //!The size of the memory segment
- std::size_t m_size;
+ size_type m_size;
       //!The extra size required by the segment
- std::size_t m_extra_hdr_bytes;
+ size_type m_extra_hdr_bytes;
    } m_header;
 
    friend class detail::memory_algorithm_common<simple_seq_fit_impl>;
@@ -117,24 +125,24 @@
    //!Constructor. "size" is the total size of the managed memory segment,
    //!"extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(simple_seq_fit_impl)
    //!offset that the allocator should not use at all.
- simple_seq_fit_impl (std::size_t size, std::size_t extra_hdr_bytes);
+ simple_seq_fit_impl (size_type size, size_type extra_hdr_bytes);
 
    //!Destructor
    ~simple_seq_fit_impl();
 
    //!Obtains the minimum size needed by the algorithm
- static std::size_t get_min_size (std::size_t extra_hdr_bytes);
+ static size_type get_min_size (size_type extra_hdr_bytes);
 
    //Functions for single segment management
 
    //!Allocates bytes, returns 0 if there is not more memory
- void* allocate (std::size_t nbytes);
+ void* allocate (size_type nbytes);
 
    /// @cond
 
    //!Multiple element allocation, same size
    multiallocation_chain
- allocate_many(std::size_t elem_bytes, std::size_t num_elements)
+ allocate_many(size_type elem_bytes, size_type num_elements)
    {
       //-----------------------
       boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
@@ -144,7 +152,7 @@
 
    //!Multiple element allocation, different size
    multiallocation_chain
- allocate_many(const std::size_t *elem_sizes, std::size_t n_elements, std::size_t sizeof_element)
+ allocate_many(const size_type *elem_sizes, size_type n_elements, size_type sizeof_element)
    {
       //-----------------------
       boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
@@ -161,13 +169,13 @@
    void deallocate (void *addr);
 
    //!Returns the size of the memory segment
- std::size_t get_size() const;
+ size_type get_size() const;
 
    //!Returns the number of free bytes of the memory segment
- std::size_t get_free_memory() const;
+ size_type get_free_memory() const;
 
    //!Increases managed memory in extra_size bytes more
- void grow(std::size_t extra_size);
+ void grow(size_type extra_size);
 
    //!Decreases managed memory as much as possible
    void shrink_to_fit();
@@ -184,21 +192,21 @@
 
    template<class T>
    std::pair<T *, bool>
- allocation_command (boost::interprocess::allocation_type command, std::size_t limit_size,
- std::size_t preferred_size,std::size_t &received_size,
+ allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
+ size_type preferred_size,size_type &received_size,
                            T *reuse_ptr = 0);
 
    std::pair<void *, bool>
- raw_allocation_command (boost::interprocess::allocation_type command, std::size_t limit_size,
- std::size_t preferred_size,std::size_t &received_size,
- void *reuse_ptr = 0, std::size_t sizeof_object = 1);
+ raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
+ size_type preferred_size,size_type &received_size,
+ void *reuse_ptr = 0, size_type sizeof_object = 1);
 
    //!Returns the size of the buffer previously allocated pointed by ptr
- std::size_t size(const void *ptr) const;
+ size_type size(const void *ptr) const;
 
    //!Allocates aligned bytes, returns 0 if there is not more memory.
    //!Alignment must be power of 2
- void* allocate_aligned (std::size_t nbytes, std::size_t alignment);
+ void* allocate_aligned (size_type nbytes, size_type alignment);
 
    private:
 
@@ -210,24 +218,24 @@
 
    //!Real allocation algorithm with min allocation option
    std::pair<void *, bool> priv_allocate(boost::interprocess::allocation_type command
- ,std::size_t min_size
- ,std::size_t preferred_size
- ,std::size_t &received_size
+ ,size_type min_size
+ ,size_type preferred_size
+ ,size_type &received_size
                                         ,void *reuse_ptr = 0);
 
    std::pair<void *, bool> priv_allocation_command(boost::interprocess::allocation_type command
- ,std::size_t min_size
- ,std::size_t preferred_size
- ,std::size_t &received_size
+ ,size_type min_size
+ ,size_type preferred_size
+ ,size_type &received_size
                                         ,void *reuse_ptr
- ,std::size_t sizeof_object);
+ ,size_type sizeof_object);
 
    //!Returns the number of total units that a user buffer
    //!of "userbytes" bytes really occupies (including header)
- static std::size_t priv_get_total_units(std::size_t userbytes);
+ static size_type priv_get_total_units(size_type userbytes);
 
- static std::size_t priv_first_block_offset(const void *this_ptr, std::size_t extra_hdr_bytes);
- std::size_t priv_block_end_offset() const;
+ static size_type priv_first_block_offset(const void *this_ptr, size_type extra_hdr_bytes);
+ size_type priv_block_end_offset() const;
 
    //!Returns next block if it's free.
    //!Returns 0 if next block is not free.
@@ -242,58 +250,59 @@
 
    //!Real expand function implementation
    bool priv_expand(void *ptr
- ,std::size_t min_size, std::size_t preferred_size
- ,std::size_t &received_size);
+ ,size_type min_size, size_type preferred_size
+ ,size_type &received_size);
 
    //!Real expand to both sides implementation
    void* priv_expand_both_sides(boost::interprocess::allocation_type command
- ,std::size_t min_size
- ,std::size_t preferred_size
- ,std::size_t &received_size
+ ,size_type min_size
+ ,size_type preferred_size
+ ,size_type &received_size
                                ,void *reuse_ptr
                                ,bool only_preferred_backwards);
 
    //!Real private aligned allocation function
- //void* priv_allocate_aligned (std::size_t nbytes, std::size_t alignment);
+ //void* priv_allocate_aligned (size_type nbytes, size_type alignment);
 
    //!Checks if block has enough memory and splits/unlinks the block
    //!returning the address to the users
- void* priv_check_and_allocate(std::size_t units
+ void* priv_check_and_allocate(size_type units
                                 ,block_ctrl* prev
                                 ,block_ctrl* block
- ,std::size_t &received_size);
+ ,size_type &received_size);
    //!Real deallocation algorithm
    void priv_deallocate(void *addr);
 
    //!Makes a new memory portion available for allocation
- void priv_add_segment(void *addr, std::size_t size);
+ void priv_add_segment(void *addr, size_type size);
 
    void priv_mark_new_allocated_block(block_ctrl *block);
 
    public:
- static const std::size_t Alignment = detail::alignment_of<detail::max_align>::value;
+ static const size_type Alignment = ::boost::alignment_of< ::boost::detail::max_align>::value;
    private:
- static const std::size_t BlockCtrlBytes = detail::ct_rounded_size<sizeof(block_ctrl), Alignment>::value;
- static const std::size_t BlockCtrlUnits = BlockCtrlBytes/Alignment;
- static const std::size_t MinBlockUnits = BlockCtrlUnits;
- static const std::size_t MinBlockSize = MinBlockUnits*Alignment;
- static const std::size_t AllocatedCtrlBytes = BlockCtrlBytes;
- static const std::size_t AllocatedCtrlUnits = BlockCtrlUnits;
- static const std::size_t UsableByPreviousChunk = 0;
+ static const size_type BlockCtrlBytes = detail::ct_rounded_size<sizeof(block_ctrl), Alignment>::value;
+ static const size_type BlockCtrlUnits = BlockCtrlBytes/Alignment;
+ static const size_type MinBlockUnits = BlockCtrlUnits;
+ static const size_type MinBlockSize = MinBlockUnits*Alignment;
+ static const size_type AllocatedCtrlBytes = BlockCtrlBytes;
+ static const size_type AllocatedCtrlUnits = BlockCtrlUnits;
+ static const size_type UsableByPreviousChunk = 0;
 
    public:
- static const std::size_t PayloadPerAllocation = BlockCtrlBytes;
+ static const size_type PayloadPerAllocation = BlockCtrlBytes;
 };
 
 template<class MutexFamily, class VoidPointer>
-inline std::size_t simple_seq_fit_impl<MutexFamily, VoidPointer>
- ::priv_first_block_offset(const void *this_ptr, std::size_t extra_hdr_bytes)
+inline typename simple_seq_fit_impl<MutexFamily, VoidPointer>::size_type
+simple_seq_fit_impl<MutexFamily, VoidPointer>
+ ::priv_first_block_offset(const void *this_ptr, size_type extra_hdr_bytes)
 {
    //First align "this" pointer
- std::size_t uint_this = (std::size_t)this_ptr;
- std::size_t uint_aligned_this = uint_this/Alignment*Alignment;
- std::size_t this_disalignment = (uint_this - uint_aligned_this);
- std::size_t block1_off =
+ size_type uint_this = (std::size_t)this_ptr;
+ size_type uint_aligned_this = uint_this/Alignment*Alignment;
+ size_type this_disalignment = (uint_this - uint_aligned_this);
+ size_type block1_off =
       detail::get_rounded_size(sizeof(simple_seq_fit_impl) + extra_hdr_bytes + this_disalignment, Alignment)
       - this_disalignment;
    algo_impl_t::assert_alignment(this_disalignment + block1_off);
@@ -301,14 +310,15 @@
 }
 
 template<class MutexFamily, class VoidPointer>
-inline std::size_t simple_seq_fit_impl<MutexFamily, VoidPointer>
+inline typename simple_seq_fit_impl<MutexFamily, VoidPointer>::size_type
+simple_seq_fit_impl<MutexFamily, VoidPointer>
    ::priv_block_end_offset() const
 {
    //First align "this" pointer
- std::size_t uint_this = (std::size_t)this;
- std::size_t uint_aligned_this = uint_this/Alignment*Alignment;
- std::size_t this_disalignment = (uint_this - uint_aligned_this);
- std::size_t old_end =
+ size_type uint_this = (std::size_t)this;
+ size_type uint_aligned_this = uint_this/Alignment*Alignment;
+ size_type this_disalignment = (uint_this - uint_aligned_this);
+ size_type old_end =
       detail::get_truncated_size(m_header.m_size + this_disalignment, Alignment)
       - this_disalignment;
    algo_impl_t::assert_alignment(old_end + this_disalignment);
@@ -317,7 +327,7 @@
 
 template<class MutexFamily, class VoidPointer>
 inline simple_seq_fit_impl<MutexFamily, VoidPointer>::
- simple_seq_fit_impl(std::size_t size, std::size_t extra_hdr_bytes)
+ simple_seq_fit_impl(size_type size, size_type extra_hdr_bytes)
 {
    //Initialize sizes and counters
    m_header.m_allocated = 0;
@@ -325,7 +335,7 @@
    m_header.m_extra_hdr_bytes = extra_hdr_bytes;
 
    //Initialize pointers
- std::size_t block1_off = priv_first_block_offset(this, extra_hdr_bytes);
+ size_type block1_off = priv_first_block_offset(this, extra_hdr_bytes);
 
    m_header.m_root.m_next = reinterpret_cast<block_ctrl*>
       ((reinterpret_cast<char*>(this) + block1_off));
@@ -343,10 +353,10 @@
 }
 
 template<class MutexFamily, class VoidPointer>
-inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::grow(std::size_t extra_size)
+inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::grow(size_type extra_size)
 {
    //Old highest address block's end offset
- std::size_t old_end = this->priv_block_end_offset();
+ size_type old_end = this->priv_block_end_offset();
 
    //Update managed buffer's size
    m_header.m_size += extra_size;
@@ -398,16 +408,16 @@
    void *unique_block = 0;
    if(!m_header.m_allocated){
       BOOST_ASSERT(prev == root);
- std::size_t ignore;
+ size_type ignore;
       unique_block = priv_allocate(boost::interprocess::allocate_new, 0, 0, ignore).first;
       if(!unique_block)
          return;
       last = detail::get_pointer(m_header.m_root.m_next);
       BOOST_ASSERT(last_free_end_address == (reinterpret_cast<char*>(last) + last->m_size*Alignment));
    }
- std::size_t last_units = last->m_size;
+ size_type last_units = last->m_size;
 
- std::size_t received_size;
+ size_type received_size;
    void *addr = priv_check_and_allocate(last_units, prev, last, received_size);
    (void)addr;
    BOOST_ASSERT(addr);
@@ -448,7 +458,7 @@
 }
 
 template<class MutexFamily, class VoidPointer>
-inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_add_segment(void *addr, std::size_t size)
+inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_add_segment(void *addr, size_type size)
 {
    algo_impl_t::assert_alignment(addr);
    //Check size
@@ -466,21 +476,24 @@
 }
 
 template<class MutexFamily, class VoidPointer>
-inline std::size_t simple_seq_fit_impl<MutexFamily, VoidPointer>::get_size() const
+inline typename simple_seq_fit_impl<MutexFamily, VoidPointer>::size_type
+simple_seq_fit_impl<MutexFamily, VoidPointer>::get_size() const
    { return m_header.m_size; }
 
 template<class MutexFamily, class VoidPointer>
-inline std::size_t simple_seq_fit_impl<MutexFamily, VoidPointer>::get_free_memory() const
+inline typename simple_seq_fit_impl<MutexFamily, VoidPointer>::size_type
+simple_seq_fit_impl<MutexFamily, VoidPointer>::get_free_memory() const
 {
    return m_header.m_size - m_header.m_allocated -
       algo_impl_t::multiple_of_units(sizeof(*this) + m_header.m_extra_hdr_bytes);
 }
 
 template<class MutexFamily, class VoidPointer>
-inline std::size_t simple_seq_fit_impl<MutexFamily, VoidPointer>::
- get_min_size (std::size_t extra_hdr_bytes)
+inline typename simple_seq_fit_impl<MutexFamily, VoidPointer>::size_type
+simple_seq_fit_impl<MutexFamily, VoidPointer>::
+ get_min_size (size_type extra_hdr_bytes)
 {
- return detail::get_rounded_size(sizeof(simple_seq_fit_impl),Alignment) +
+ return detail::get_rounded_size((size_type)sizeof(simple_seq_fit_impl),Alignment) +
           detail::get_rounded_size(extra_hdr_bytes,Alignment)
           + MinBlockSize;
 }
@@ -509,7 +522,7 @@
       //Just clear user the memory part reserved for the user
       std::memset( priv_get_user_buffer(block)
                  , 0
- , block->get_user_bytes());
+ , block->get_user_bytes());
       block = detail::get_pointer(block->m_next);
    }
    while(block != &m_header.m_root);
@@ -524,7 +537,7 @@
    //-----------------------
    block_ctrl *block = detail::get_pointer(m_header.m_root.m_next);
 
- std::size_t free_memory = 0;
+ size_type free_memory = 0;
 
    //Iterate through all blocks obtaining their size
    while(block != &m_header.m_root){
@@ -554,18 +567,18 @@
 
 template<class MutexFamily, class VoidPointer>
 inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
- allocate(std::size_t nbytes)
+ allocate(size_type nbytes)
 {
    //-----------------------
    boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
    //-----------------------
- std::size_t ignore;
+ size_type ignore;
    return priv_allocate(boost::interprocess::allocate_new, nbytes, nbytes, ignore).first;
 }
 
 template<class MutexFamily, class VoidPointer>
 inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
- allocate_aligned(std::size_t nbytes, std::size_t alignment)
+ allocate_aligned(size_type nbytes, size_type alignment)
 {
    //-----------------------
    boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
@@ -577,22 +590,22 @@
 template<class MutexFamily, class VoidPointer>
 template<class T>
 inline std::pair<T*, bool> simple_seq_fit_impl<MutexFamily, VoidPointer>::
- allocation_command (boost::interprocess::allocation_type command, std::size_t limit_size,
- std::size_t preferred_size,std::size_t &received_size,
+ allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
+ size_type preferred_size,size_type &received_size,
                         T *reuse_ptr)
 {
    std::pair<void*, bool> ret = priv_allocation_command
       (command, limit_size, preferred_size, received_size, static_cast<void*>(reuse_ptr), sizeof(T));
 
- BOOST_ASSERT(0 == ((std::size_t)ret.first % detail::alignment_of<T>::value));
+ BOOST_ASSERT(0 == ((std::size_t)ret.first % ::boost::alignment_of<T>::value));
    return std::pair<T *, bool>(static_cast<T*>(ret.first), ret.second);
 }
 
 template<class MutexFamily, class VoidPointer>
 inline std::pair<void*, bool> simple_seq_fit_impl<MutexFamily, VoidPointer>::
- raw_allocation_command (boost::interprocess::allocation_type command, std::size_t limit_objects,
- std::size_t preferred_objects,std::size_t &received_objects,
- void *reuse_ptr, std::size_t sizeof_object)
+ raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_objects,
+ size_type preferred_objects,size_type &received_objects,
+ void *reuse_ptr, size_type sizeof_object)
 {
    if(!sizeof_object)
       return std::pair<void *, bool>(static_cast<void*>(0), false);
@@ -609,21 +622,21 @@
 
 template<class MutexFamily, class VoidPointer>
 inline std::pair<void*, bool> simple_seq_fit_impl<MutexFamily, VoidPointer>::
- priv_allocation_command (boost::interprocess::allocation_type command, std::size_t limit_size,
- std::size_t preferred_size, std::size_t &received_size,
- void *reuse_ptr, std::size_t sizeof_object)
+ priv_allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
+ size_type preferred_size, size_type &received_size,
+ void *reuse_ptr, size_type sizeof_object)
 {
    command &= ~boost::interprocess::expand_bwd;
    if(!command) return std::pair<void *, bool>(static_cast<void*>(0), false);
 
    std::pair<void*, bool> ret;
- std::size_t max_count = m_header.m_size/sizeof_object;
+ size_type max_count = m_header.m_size/sizeof_object;
    if(limit_size > max_count || preferred_size > max_count){
       ret.first = 0; return ret;
    }
- std::size_t l_size = limit_size*sizeof_object;
- std::size_t p_size = preferred_size*sizeof_object;
- std::size_t r_size;
+ size_type l_size = limit_size*sizeof_object;
+ size_type p_size = preferred_size*sizeof_object;
+ size_type r_size;
    {
       //-----------------------
       boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
@@ -635,7 +648,8 @@
 }
 
 template<class MutexFamily, class VoidPointer>
-inline std::size_t simple_seq_fit_impl<MutexFamily, VoidPointer>::
+inline typename simple_seq_fit_impl<MutexFamily, VoidPointer>::size_type
+simple_seq_fit_impl<MutexFamily, VoidPointer>::
    size(const void *ptr) const
 {
    //We need no synchronization since this block is not going
@@ -648,9 +662,9 @@
 template<class MutexFamily, class VoidPointer>
 void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
    priv_expand_both_sides(boost::interprocess::allocation_type command
- ,std::size_t min_size
- ,std::size_t preferred_size
- ,std::size_t &received_size
+ ,size_type min_size
+ ,size_type preferred_size
+ ,size_type &received_size
                          ,void *reuse_ptr
                          ,bool only_preferred_backwards)
 {
@@ -671,14 +685,14 @@
       received_size = this->size(reuse_ptr);
    }
    if(command & boost::interprocess::expand_bwd){
- std::size_t extra_forward = !received_size ? 0 : received_size + BlockCtrlBytes;
+ size_type extra_forward = !received_size ? 0 : received_size + BlockCtrlBytes;
       prev_block_t prev_pair = priv_prev_block_if_free(reuse);
       block_ctrl *prev = prev_pair.second;
       if(!prev){
          return 0;
       }
 
- std::size_t needs_backwards =
+ size_type needs_backwards =
          detail::get_rounded_size(preferred_size - extra_forward, Alignment);
    
       if(!only_preferred_backwards){
@@ -739,10 +753,11 @@
 }
 
 template<class MutexFamily, class VoidPointer>
-inline std::size_t simple_seq_fit_impl<MutexFamily, VoidPointer>::
- priv_get_total_units(std::size_t userbytes)
+inline typename simple_seq_fit_impl<MutexFamily, VoidPointer>::size_type
+simple_seq_fit_impl<MutexFamily, VoidPointer>::
+ priv_get_total_units(size_type userbytes)
 {
- std::size_t s = detail::get_rounded_size(userbytes, Alignment)/Alignment;
+ size_type s = detail::get_rounded_size(userbytes, Alignment)/Alignment;
    if(!s) ++s;
    return BlockCtrlUnits + s;
 }
@@ -750,9 +765,9 @@
 template<class MutexFamily, class VoidPointer>
 std::pair<void *, bool> simple_seq_fit_impl<MutexFamily, VoidPointer>::
    priv_allocate(boost::interprocess::allocation_type command
- ,std::size_t limit_size
- ,std::size_t preferred_size
- ,std::size_t &received_size
+ ,size_type limit_size
+ ,size_type preferred_size
+ ,size_type &received_size
                 ,void *reuse_ptr)
 {
    if(command & boost::interprocess::shrink_in_place){
@@ -767,7 +782,7 @@
       return return_type(static_cast<void*>(0), false);
 
    //Number of units to request (including block_ctrl header)
- std::size_t nunits = detail::get_rounded_size(preferred_size, Alignment)/Alignment + BlockCtrlUnits;
+ size_type nunits = detail::get_rounded_size(preferred_size, Alignment)/Alignment + BlockCtrlUnits;
 
    //Get the root and the first memory block
    block_ctrl *prev = &m_header.m_root;
@@ -775,7 +790,7 @@
    block_ctrl *root = &m_header.m_root;
    block_ctrl *biggest_block = 0;
    block_ctrl *prev_biggest_block = 0;
- std::size_t biggest_size = 0;
+ size_type biggest_size = 0;
 
    //Expand in place
    //reuse_ptr, limit_size, preferred_size, received_size
@@ -812,7 +827,7 @@
       //Bad luck finding preferred_size, now if we have any biggest_block
       //try with this block
       if(biggest_block){
- std::size_t limit_units = detail::get_rounded_size(limit_size, Alignment)/Alignment + BlockCtrlUnits;
+ size_type limit_units = detail::get_rounded_size(limit_size, Alignment)/Alignment + BlockCtrlUnits;
          if(biggest_block->m_size < limit_units)
             return return_type(static_cast<void*>(0), false);
 
@@ -852,7 +867,7 @@
    //Check if the adjacent block is in the managed segment
    char *this_char_ptr = reinterpret_cast<char*>(this);
    char *next_char_ptr = reinterpret_cast<char*>(next_block);
- std::size_t distance = (next_char_ptr - this_char_ptr)/Alignment;
+ size_type distance = (size_type)(next_char_ptr - this_char_ptr)/Alignment;
 
    if(distance >= (m_header.m_size/Alignment)){
       //"next_block" does not exist so we can't expand "block"
@@ -892,7 +907,7 @@
    //Check if the previous block is in the managed segment
    char *this_char_ptr = reinterpret_cast<char*>(this);
    char *prev_char_ptr = reinterpret_cast<char*>(prev_block);
- std::size_t distance = (prev_char_ptr - this_char_ptr)/Alignment;
+ size_type distance = (size_type)(prev_char_ptr - this_char_ptr)/Alignment;
 
    if(distance >= (m_header.m_size/Alignment)){
       //"previous_block" does not exist so we can't expand "block"
@@ -905,13 +920,13 @@
 template<class MutexFamily, class VoidPointer>
 inline bool simple_seq_fit_impl<MutexFamily, VoidPointer>::
    priv_expand (void *ptr
- ,std::size_t min_size
- ,std::size_t preferred_size
- ,std::size_t &received_size)
+ ,size_type min_size
+ ,size_type preferred_size
+ ,size_type &received_size)
 {
    //Obtain the real size of the block
    block_ctrl *block = reinterpret_cast<block_ctrl*>(priv_get_block(ptr));
- std::size_t old_block_size = block->m_size;
+ size_type old_block_size = block->m_size;
 
    //All used blocks' next is marked with 0 so check it
    BOOST_ASSERT(block->m_next == 0);
@@ -927,7 +942,7 @@
    if(min_size > preferred_size)
       return false;
 
- std::size_t data_size = old_block_size - BlockCtrlUnits;
+ size_type data_size = old_block_size - BlockCtrlUnits;
 
    if(data_size >= min_size)
       return true;
@@ -938,7 +953,7 @@
    }
 
    //Is "block" + "next_block" big enough?
- std::size_t merged_size = old_block_size + next_block->m_size;
+ size_type merged_size = old_block_size + next_block->m_size;
 
    //Now we can expand this block further than before
    received_size = merged_size*Alignment - BlockCtrlBytes;
@@ -964,7 +979,7 @@
 
    //Now use check and allocate to do the allocation logic
    preferred_size += BlockCtrlUnits;
- std::size_t nunits = preferred_size < merged_size ? preferred_size : merged_size;
+ size_type nunits = preferred_size < merged_size ? preferred_size : merged_size;
 
    //This must success since nunits is less than merged_size!
    if(!this->priv_check_and_allocate (nunits, prev, block, received_size)){
@@ -978,19 +993,19 @@
 
 template<class MutexFamily, class VoidPointer> inline
 void* simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_check_and_allocate
- (std::size_t nunits
+ (size_type nunits
    ,typename simple_seq_fit_impl<MutexFamily, VoidPointer>::block_ctrl* prev
    ,typename simple_seq_fit_impl<MutexFamily, VoidPointer>::block_ctrl* block
- ,std::size_t &received_size)
+ ,size_type &received_size)
 {
- std::size_t upper_nunits = nunits + BlockCtrlUnits;
+ size_type upper_nunits = nunits + BlockCtrlUnits;
    bool found = false;
 
    if (block->m_size > upper_nunits){
       //This block is bigger than needed, split it in
       //two blocks, the first's size will be "units"
       //the second's size will be "block->m_size-units"
- std::size_t total_size = block->m_size;
+ size_type total_size = block->m_size;
       block->m_size = nunits;
 
       block_ctrl *new_block = reinterpret_cast<block_ctrl*>
@@ -1050,7 +1065,7 @@
    //Check if alignment and block size are right
    algo_impl_t::assert_alignment(addr);
 
- std::size_t total_size = Alignment*block->m_size;
+ size_type total_size = Alignment*block->m_size;
    BOOST_ASSERT(m_header.m_allocated >= total_size);
   
    //Update used memory count

Modified: branches/release/boost/interprocess/mem_algo/rbtree_best_fit.hpp
==============================================================================
--- branches/release/boost/interprocess/mem_algo/rbtree_best_fit.hpp (original)
+++ branches/release/boost/interprocess/mem_algo/rbtree_best_fit.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -32,12 +32,13 @@
 #include <boost/interprocess/detail/math_functions.hpp>
 #include <boost/interprocess/detail/type_traits.hpp>
 #include <boost/interprocess/sync/scoped_lock.hpp>
+#include <boost/type_traits/type_with_alignment.hpp>
 #include <boost/assert.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/type_traits.hpp>
 #include <algorithm>
 #include <utility>
 #include <climits>
-#include <boost/assert.hpp>
 #include <cstring>
 #include <iterator>
 
@@ -46,6 +47,11 @@
 
 #include <boost/intrusive/set.hpp>
 
+//#define BOOST_INTERPROCESS_RBTREE_BEST_FIT_ABI_V1_HPP
+//to maintain ABI compatible with the original version
+//ABI had to be updated to fix compatibility issues when
+//sharing shared memory between 32 adn 64 bit processes.
+
 //!\file
 //!Describes a best-fit algorithm based in an intrusive red-black tree used to allocate
 //!objects in shared memory. This class is intended as a base class for single segment
@@ -64,6 +70,14 @@
    rbtree_best_fit();
    rbtree_best_fit(const rbtree_best_fit &);
    rbtree_best_fit &operator=(const rbtree_best_fit &);
+
+ private:
+ struct block_ctrl;
+ typedef typename boost::
+ pointer_to_other<VoidPointer, block_ctrl>::type block_ctrl_ptr;
+ typedef typename boost::
+ pointer_to_other<VoidPointer, char>::type char_ptr;
+
    /// @endcond
 
    public:
@@ -74,14 +88,12 @@
    typedef boost::container::containers_detail::
       basic_multiallocation_chain<VoidPointer> multiallocation_chain;
 
+ typedef typename std::iterator_traits<char_ptr>::difference_type difference_type;
+ typedef typename boost::make_unsigned<difference_type>::type size_type;
+
    /// @cond
 
    private:
- struct block_ctrl;
- typedef typename boost::
- pointer_to_other<void_pointer, block_ctrl>::type block_ctrl_ptr;
- typedef typename boost::
- pointer_to_other<void_pointer, char>::type char_ptr;
 
    typedef typename bi::make_set_base_hook
       < bi::void_pointer<VoidPointer>
@@ -92,10 +104,10 @@
    {
       //!This block's memory size (including block_ctrl
       //!header) in Alignment units
- std::size_t m_prev_size : sizeof(std::size_t)*CHAR_BIT;
- std::size_t m_size : sizeof(std::size_t)*CHAR_BIT - 2;
- std::size_t m_prev_allocated : 1;
- std::size_t m_allocated : 1;
+ size_type m_prev_size : sizeof(size_type)*CHAR_BIT;
+ size_type m_size : sizeof(size_type)*CHAR_BIT - 2;
+ size_type m_prev_allocated : 1;
+ size_type m_allocated : 1;
    };
 
    //!Block control structure
@@ -113,10 +125,10 @@
 
    struct size_block_ctrl_compare
    {
- bool operator()(std::size_t size, const block_ctrl &block) const
+ bool operator()(size_type size, const block_ctrl &block) const
       { return size < block.m_size; }
 
- bool operator()(const block_ctrl &block, std::size_t size) const
+ bool operator()(const block_ctrl &block, size_type size) const
       { return block.m_size < size; }
    };
 
@@ -134,11 +146,11 @@
       Imultiset m_imultiset;
 
       //!The extra size required by the segment
- std::size_t m_extra_hdr_bytes;
+ size_type m_extra_hdr_bytes;
       //!Allocated bytes for internal checking
- std::size_t m_allocated;
+ size_type m_allocated;
       //!The size of the memory segment
- std::size_t m_size;
+ size_type m_size;
    } m_header;
 
    friend class detail::memory_algorithm_common<rbtree_best_fit>;
@@ -151,25 +163,25 @@
    //!Constructor. "size" is the total size of the managed memory segment,
    //!"extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(rbtree_best_fit)
    //!offset that the allocator should not use at all.
- rbtree_best_fit (std::size_t size, std::size_t extra_hdr_bytes);
+ rbtree_best_fit (size_type size, size_type extra_hdr_bytes);
 
    //!Destructor.
    ~rbtree_best_fit();
 
    //!Obtains the minimum size needed by the algorithm
- static std::size_t get_min_size (std::size_t extra_hdr_bytes);
+ static size_type get_min_size (size_type extra_hdr_bytes);
 
    //Functions for single segment management
 
    //!Allocates bytes, returns 0 if there is not more memory
- void* allocate (std::size_t nbytes);
+ void* allocate (size_type nbytes);
 
    /// @cond
 
    //Experimental. Dont' use
 
    //!Multiple element allocation, same size
- multiallocation_chain allocate_many(std::size_t elem_bytes, std::size_t num_elements)
+ multiallocation_chain allocate_many(size_type elem_bytes, size_type num_elements)
    {
 
       //-----------------------
@@ -179,7 +191,7 @@
    }
 
    //!Multiple element allocation, different size
- multiallocation_chain allocate_many(const std::size_t *elem_sizes, std::size_t n_elements, std::size_t sizeof_element)
+ multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements, size_type sizeof_element)
    {
 
       //-----------------------
@@ -197,10 +209,10 @@
    void deallocate (void *addr);
 
    //!Returns the size of the memory segment
- std::size_t get_size() const;
+ size_type get_size() const;
 
    //!Returns the number of free bytes of the segment
- std::size_t get_free_memory() const;
+ size_type get_free_memory() const;
 
    //!Initializes to zero all the memory that's not in use.
    //!This function is normally used for security reasons.
@@ -208,7 +220,7 @@
 
    //!Increases managed memory in
    //!extra_size bytes more
- void grow(std::size_t extra_size);
+ void grow(size_type extra_size);
 
    //!Decreases managed memory as much as possible
    void shrink_to_fit();
@@ -222,39 +234,43 @@
 
    template<class T>
    std::pair<T *, bool>
- allocation_command (boost::interprocess::allocation_type command, std::size_t limit_size,
- std::size_t preferred_size,std::size_t &received_size,
+ allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
+ size_type preferred_size,size_type &received_size,
                            T *reuse_ptr = 0);
 
    std::pair<void *, bool>
- raw_allocation_command (boost::interprocess::allocation_type command, std::size_t limit_object,
- std::size_t preferred_object,std::size_t &received_object,
- void *reuse_ptr = 0, std::size_t sizeof_object = 1);
+ raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_object,
+ size_type preferred_object,size_type &received_object,
+ void *reuse_ptr = 0, size_type sizeof_object = 1);
 
    //!Returns the size of the buffer previously allocated pointed by ptr
- std::size_t size(const void *ptr) const;
+ size_type size(const void *ptr) const;
 
    //!Allocates aligned bytes, returns 0 if there is not more memory.
    //!Alignment must be power of 2
- void* allocate_aligned (std::size_t nbytes, std::size_t alignment);
+ void* allocate_aligned (size_type nbytes, size_type alignment);
 
    /// @cond
    private:
- static std::size_t priv_first_block_offset(const void *this_ptr, std::size_t extra_hdr_bytes);
+ static size_type priv_first_block_offset_from_this(const void *this_ptr, size_type extra_hdr_bytes);
+
+ block_ctrl *priv_first_block();
+
+ block_ctrl *priv_end_block();
 
    std::pair<void*, bool>
- priv_allocation_command(boost::interprocess::allocation_type command, std::size_t limit_size,
- std::size_t preferred_size,std::size_t &received_size,
- void *reuse_ptr, std::size_t sizeof_object);
+ priv_allocation_command(boost::interprocess::allocation_type command, size_type limit_size,
+ size_type preferred_size,size_type &received_size,
+ void *reuse_ptr, size_type sizeof_object);
 
 
    //!Real allocation algorithm with min allocation option
    std::pair<void *, bool> priv_allocate(boost::interprocess::allocation_type command
- ,std::size_t limit_size
- ,std::size_t preferred_size
- ,std::size_t &received_size
+ ,size_type limit_size
+ ,size_type preferred_size
+ ,size_type &received_size
                                         ,void *reuse_ptr = 0
- ,std::size_t backwards_multiple = 1);
+ ,size_type backwards_multiple = 1);
 
    //!Obtains the block control structure of the user buffer
    static block_ctrl *priv_get_block(const void *ptr);
@@ -264,33 +280,36 @@
 
    //!Returns the number of total units that a user buffer
    //!of "userbytes" bytes really occupies (including header)
- static std::size_t priv_get_total_units(std::size_t userbytes);
+ static size_type priv_get_total_units(size_type userbytes);
 
    //!Real expand function implementation
    bool priv_expand(void *ptr
- ,const std::size_t min_size, const std::size_t preferred_size
- ,std::size_t &received_size);
+ ,const size_type min_size, const size_type preferred_size
+ ,size_type &received_size);
 
    //!Real expand to both sides implementation
    void* priv_expand_both_sides(boost::interprocess::allocation_type command
- ,std::size_t min_size
- ,std::size_t preferred_size
- ,std::size_t &received_size
+ ,size_type min_size
+ ,size_type preferred_size
+ ,size_type &received_size
                                ,void *reuse_ptr
                                ,bool only_preferred_backwards
- ,std::size_t backwards_multiple);
-
- //!Get poitner of the previous block (previous block must be free)
- block_ctrl * priv_prev_block(block_ctrl *ptr);
+ ,size_type backwards_multiple);
 
    //!Returns true if the previous block is allocated
    bool priv_is_prev_allocated(block_ctrl *ptr);
 
    //!Get a pointer of the "end" block from the first block of the segment
- block_ctrl * priv_end_block(block_ctrl *first_segment_block);
+ static block_ctrl * priv_end_block(block_ctrl *first_segment_block);
+
+ //!Get a pointer of the "first" block from the end block of the segment
+ static block_ctrl * priv_first_block(block_ctrl *end_segment_block);
+
+ //!Get poitner of the previous block (previous block must be free)
+ static block_ctrl * priv_prev_block(block_ctrl *ptr);
 
    //!Get the size in the tail of the previous block
- block_ctrl * priv_next_block(block_ctrl *ptr);
+ static block_ctrl * priv_next_block(block_ctrl *ptr);
 
    //!Check if this block is free (not allocated)
    bool priv_is_allocated_block(block_ctrl *ptr);
@@ -299,68 +318,137 @@
    void priv_mark_as_allocated_block(block_ctrl *ptr);
 
    //!Marks the block as allocated
+ void priv_mark_new_allocated_block(block_ctrl *ptr)
+ { return priv_mark_as_allocated_block(ptr); }
+
+ //!Marks the block as allocated
    void priv_mark_as_free_block(block_ctrl *ptr);
 
    //!Checks if block has enough memory and splits/unlinks the block
    //!returning the address to the users
- void* priv_check_and_allocate(std::size_t units
+ void* priv_check_and_allocate(size_type units
                                 ,block_ctrl* block
- ,std::size_t &received_size);
+ ,size_type &received_size);
    //!Real deallocation algorithm
    void priv_deallocate(void *addr);
 
    //!Makes a new memory portion available for allocation
- void priv_add_segment(void *addr, std::size_t size);
-
- void priv_mark_new_allocated_block(block_ctrl *block);
+ void priv_add_segment(void *addr, size_type size);
 
    public:
    
- static const std::size_t Alignment = !MemAlignment
- ? detail::alignment_of<detail::max_align>::value
- : MemAlignment
+ static const size_type Alignment = !MemAlignment
+ ? size_type(::boost::alignment_of< ::boost::detail::max_align>::value)
+ : size_type(MemAlignment)
       ;
 
    private:
    //Due to embedded bits in size, Alignment must be at least 4
    BOOST_STATIC_ASSERT((Alignment >= 4));
    //Due to rbtree size optimizations, Alignment must have at least pointer alignment
- BOOST_STATIC_ASSERT((Alignment >= detail::alignment_of<void_pointer>::value));
- static const std::size_t AlignmentMask = (Alignment - 1);
- static const std::size_t BlockCtrlBytes = detail::ct_rounded_size<sizeof(block_ctrl), Alignment>::value;
- static const std::size_t BlockCtrlUnits = BlockCtrlBytes/Alignment;
- static const std::size_t AllocatedCtrlBytes = detail::ct_rounded_size<sizeof(SizeHolder), Alignment>::value;
- static const std::size_t AllocatedCtrlUnits = AllocatedCtrlBytes/Alignment;
- static const std::size_t EndCtrlBlockBytes = detail::ct_rounded_size<sizeof(SizeHolder), Alignment>::value;
- static const std::size_t EndCtrlBlockUnits = EndCtrlBlockBytes/Alignment;
- static const std::size_t MinBlockUnits = BlockCtrlUnits;
- static const std::size_t UsableByPreviousChunk = sizeof(std::size_t);
+ BOOST_STATIC_ASSERT((Alignment >= ::boost::alignment_of<void_pointer>::value));
+ static const size_type AlignmentMask = (Alignment - 1);
+ static const size_type BlockCtrlBytes = detail::ct_rounded_size<sizeof(block_ctrl), Alignment>::value;
+ static const size_type BlockCtrlUnits = BlockCtrlBytes/Alignment;
+ static const size_type AllocatedCtrlBytes = detail::ct_rounded_size<sizeof(SizeHolder), Alignment>::value;
+ static const size_type AllocatedCtrlUnits = AllocatedCtrlBytes/Alignment;
+ static const size_type EndCtrlBlockBytes = detail::ct_rounded_size<sizeof(SizeHolder), Alignment>::value;
+ static const size_type EndCtrlBlockUnits = EndCtrlBlockBytes/Alignment;
+ static const size_type MinBlockUnits = BlockCtrlUnits;
+ static const size_type UsableByPreviousChunk = sizeof(size_type);
 
    //Make sure the maximum alignment is power of two
- BOOST_STATIC_ASSERT((0 == (Alignment & (Alignment - std::size_t(1u)))));
+ BOOST_STATIC_ASSERT((0 == (Alignment & (Alignment - size_type(1u)))));
    /// @endcond
    public:
- static const std::size_t PayloadPerAllocation = AllocatedCtrlBytes - UsableByPreviousChunk;
+ static const size_type PayloadPerAllocation = AllocatedCtrlBytes - UsableByPreviousChunk;
 };
 
 /// @cond
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
-inline std::size_t rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>
- ::priv_first_block_offset(const void *this_ptr, std::size_t extra_hdr_bytes)
-{
- std::size_t uint_this = (std::size_t)this_ptr;
- std::size_t main_hdr_end = uint_this + sizeof(rbtree_best_fit) + extra_hdr_bytes;
- std::size_t aligned_main_hdr_end = detail::get_rounded_size(main_hdr_end, Alignment);
- std::size_t block1_off = aligned_main_hdr_end - uint_this;
+inline typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::size_type
+ rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>
+ ::priv_first_block_offset_from_this(const void *this_ptr, size_type extra_hdr_bytes)
+{
+ size_type uint_this = (std::size_t)this_ptr;
+ size_type main_hdr_end = uint_this + sizeof(rbtree_best_fit) + extra_hdr_bytes;
+ size_type aligned_main_hdr_end = detail::get_rounded_size(main_hdr_end, Alignment);
+ size_type block1_off = aligned_main_hdr_end - uint_this;
    algo_impl_t::assert_alignment(aligned_main_hdr_end);
    algo_impl_t::assert_alignment(uint_this + block1_off);
    return block1_off;
 }
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
+void rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
+ priv_add_segment(void *addr, size_type size)
+{
+ //Check alignment
+ algo_impl_t::check_alignment(addr);
+ //Check size
+ BOOST_ASSERT(size >= (BlockCtrlBytes + EndCtrlBlockBytes));
+
+ //Initialize the first big block and the "end" node
+ block_ctrl *first_big_block = new(addr)block_ctrl;
+ first_big_block->m_size = size/Alignment - EndCtrlBlockUnits;
+ BOOST_ASSERT(first_big_block->m_size >= BlockCtrlUnits);
+
+ //The "end" node is just a node of size 0 with the "end" bit set
+ block_ctrl *end_block = static_cast<block_ctrl*>
+ (new (reinterpret_cast<char*>(addr) + first_big_block->m_size*Alignment)SizeHolder);
+
+ //This will overwrite the prev part of the "end" node
+ priv_mark_as_free_block (first_big_block);
+ #ifdef BOOST_INTERPROCESS_RBTREE_BEST_FIT_ABI_V1_HPP
+ first_big_block->m_prev_size = end_block->m_size =
+ (reinterpret_cast<char*>(first_big_block) - reinterpret_cast<char*>(end_block))/Alignment;
+ #else
+ first_big_block->m_prev_size = end_block->m_size =
+ (reinterpret_cast<char*>(end_block) - reinterpret_cast<char*>(first_big_block))/Alignment;
+ #endif
+ end_block->m_allocated = 1;
+ first_big_block->m_prev_allocated = 1;
+
+ BOOST_ASSERT(priv_next_block(first_big_block) == end_block);
+ BOOST_ASSERT(priv_prev_block(end_block) == first_big_block);
+ BOOST_ASSERT(priv_first_block() == first_big_block);
+ BOOST_ASSERT(priv_end_block() == end_block);
+
+ //Some check to validate the algorithm, since it makes some assumptions
+ //to optimize the space wasted in bookkeeping:
+
+ //Check that the sizes of the header are placed before the rbtree
+ BOOST_ASSERT(static_cast<void*>(static_cast<SizeHolder*>(first_big_block))
+ < static_cast<void*>(static_cast<TreeHook*>(first_big_block)));
+ //Insert it in the intrusive containers
+ m_header.m_imultiset.insert(*first_big_block);
+}
+
+template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
+inline typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::block_ctrl *
+ rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>
+ ::priv_first_block()
+{
+ size_type block1_off = priv_first_block_offset_from_this(this, m_header.m_extra_hdr_bytes);
+ return reinterpret_cast<block_ctrl *>(reinterpret_cast<char*>(this) + block1_off);
+}
+
+template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
+inline typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::block_ctrl *
+ rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>
+ ::priv_end_block()
+{
+ size_type block1_off = priv_first_block_offset_from_this(this, m_header.m_extra_hdr_bytes);
+ const size_type original_first_block_size = m_header.m_size/Alignment*Alignment - block1_off/Alignment*Alignment - EndCtrlBlockBytes;
+ block_ctrl *end_block = reinterpret_cast<block_ctrl*>
+ (reinterpret_cast<char*>(this) + block1_off + original_first_block_size);
+ return end_block;
+}
+
+template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
 inline rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
- rbtree_best_fit(std::size_t size, std::size_t extra_hdr_bytes)
+ rbtree_best_fit(size_type size, size_type extra_hdr_bytes)
 {
    //Initialize the header
    m_header.m_allocated = 0;
@@ -370,7 +458,7 @@
    //Now write calculate the offset of the first big block that will
    //cover the whole segment
    BOOST_ASSERT(get_min_size(extra_hdr_bytes) <= size);
- std::size_t block1_off = priv_first_block_offset(this, extra_hdr_bytes);
+ size_type block1_off = priv_first_block_offset_from_this(this, extra_hdr_bytes);
    priv_add_segment(reinterpret_cast<char*>(this) + block1_off, size - block1_off);
 }
 
@@ -383,49 +471,51 @@
 }
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
-void rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::grow(std::size_t extra_size)
+void rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::grow(size_type extra_size)
 {
    //Get the address of the first block
- std::size_t block1_off =
- priv_first_block_offset(this, m_header.m_extra_hdr_bytes);
-
- block_ctrl *first_block = reinterpret_cast<block_ctrl *>
- (reinterpret_cast<char*>(this) + block1_off);
- block_ctrl *old_end_block = priv_end_block(first_block);
- BOOST_ASSERT(priv_is_allocated_block(old_end_block));
- std::size_t old_border_offset = (reinterpret_cast<char*>(old_end_block) -
+ block_ctrl *first_block = priv_first_block();
+ block_ctrl *old_end_block = priv_end_block();
+ size_type old_border_offset = (size_type)(reinterpret_cast<char*>(old_end_block) -
                                     reinterpret_cast<char*>(this)) + EndCtrlBlockBytes;
 
    //Update managed buffer's size
    m_header.m_size += extra_size;
 
    //We need at least MinBlockUnits blocks to create a new block
-// BOOST_ASSERT((m_header.m_size - old_end) >= MinBlockUnits);
    if((m_header.m_size - old_border_offset) < MinBlockUnits){
       return;
    }
 
    //Now create a new block between the old end and the new end
- std::size_t align_offset = (m_header.m_size - old_border_offset)/Alignment;
+ size_type align_offset = (m_header.m_size - old_border_offset)/Alignment;
    block_ctrl *new_end_block = reinterpret_cast<block_ctrl*>
       (reinterpret_cast<char*>(old_end_block) + align_offset*Alignment);
+
+ //the last and first block are special:
+ //new_end_block->m_size & first_block->m_prev_size store the absolute value
+ //between them
+ new_end_block->m_allocated = 1;
+ #ifdef BOOST_INTERPROCESS_RBTREE_BEST_FIT_ABI_V1_HPP
    new_end_block->m_size = (reinterpret_cast<char*>(first_block) -
                                  reinterpret_cast<char*>(new_end_block))/Alignment;
+ #else
+ new_end_block->m_size = (reinterpret_cast<char*>(new_end_block) -
+ reinterpret_cast<char*>(first_block))/Alignment;
+ #endif
    first_block->m_prev_size = new_end_block->m_size;
- BOOST_ASSERT(first_block == priv_next_block(new_end_block));
- priv_mark_new_allocated_block(new_end_block);
-
- BOOST_ASSERT(new_end_block == priv_end_block(first_block));
+ first_block->m_prev_allocated = 1;
+ BOOST_ASSERT(new_end_block == priv_end_block());
 
    //The old end block is the new block
    block_ctrl *new_block = old_end_block;
    new_block->m_size = (reinterpret_cast<char*>(new_end_block) -
                         reinterpret_cast<char*>(new_block))/Alignment;
    BOOST_ASSERT(new_block->m_size >= BlockCtrlUnits);
- priv_mark_new_allocated_block(new_block);
+ priv_mark_as_allocated_block(new_block);
    BOOST_ASSERT(priv_next_block(new_block) == new_end_block);
 
- m_header.m_allocated += new_block->m_size*Alignment;
+ m_header.m_allocated += (size_type)new_block->m_size*Alignment;
 
    //Now deallocate the newly created block
    this->priv_deallocate(priv_get_user_buffer(new_block));
@@ -433,30 +523,27 @@
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
 void rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::shrink_to_fit()
-{
+{
    //Get the address of the first block
- std::size_t block1_off =
- priv_first_block_offset(this, m_header.m_extra_hdr_bytes);
-
- block_ctrl *first_block = reinterpret_cast<block_ctrl*>
- (reinterpret_cast<char*>(this) + block1_off);
+ block_ctrl *first_block = priv_first_block();
    algo_impl_t::assert_alignment(first_block);
 
- block_ctrl *old_end_block = priv_end_block(first_block);
- algo_impl_t::assert_alignment(old_end_block);
- BOOST_ASSERT(priv_is_allocated_block(old_end_block));
-
+ //block_ctrl *old_end_block = priv_end_block(first_block);
+ block_ctrl *old_end_block = priv_end_block();
    algo_impl_t::assert_alignment(old_end_block);
-
- std::size_t old_end_block_size = old_end_block->m_size;
+ size_type old_end_block_size = old_end_block->m_size;
 
    void *unique_buffer = 0;
    block_ctrl *last_block;
+ //Check if no memory is allocated between the first and last block
    if(priv_next_block(first_block) == old_end_block){
- std::size_t ignore;
+ //If so check if we can allocate memory
+ size_type ignore;
       unique_buffer = priv_allocate(boost::interprocess::allocate_new, 0, 0, ignore).first;
+ //If not, return, we can't shrink
       if(!unique_buffer)
          return;
+ //If we can, mark the position just after the new allocation as the new end
       algo_impl_t::assert_alignment(unique_buffer);
       block_ctrl *unique_block = priv_get_block(unique_buffer);
       BOOST_ASSERT(priv_is_allocated_block(unique_block));
@@ -466,97 +553,62 @@
       algo_impl_t::assert_alignment(last_block);
    }
    else{
+ //If memory is allocated, check if the last block is allocated
       if(priv_is_prev_allocated(old_end_block))
          return;
+ //If not, mark last block after the free block
       last_block = priv_prev_block(old_end_block);
    }
 
- std::size_t last_block_size = last_block->m_size;
+ size_type last_block_size = last_block->m_size;
 
    //Erase block from the free tree, since we will erase it
    m_header.m_imultiset.erase(Imultiset::s_iterator_to(*last_block));
 
- std::size_t shrunk_border_offset = (reinterpret_cast<char*>(last_block) -
+ size_type shrunk_border_offset = (size_type)(reinterpret_cast<char*>(last_block) -
                                        reinterpret_cast<char*>(this)) + EndCtrlBlockBytes;
    
    block_ctrl *new_end_block = last_block;
    algo_impl_t::assert_alignment(new_end_block);
- new_end_block->m_size = old_end_block_size + last_block_size;
- priv_mark_as_allocated_block(new_end_block);
 
- //Although the first block might be allocated, we'll
- //store the offset to the end block since in the previous
- //offset can't be overwritten by a previous block
- first_block->m_prev_size = new_end_block->m_size;
- BOOST_ASSERT(priv_end_block(first_block) == new_end_block);
+ //Write new end block attributes
+ #ifdef BOOST_INTERPROCESS_RBTREE_BEST_FIT_ABI_V1_HPP
+ new_end_block->m_size = first_block->m_prev_size =
+ (reinterpret_cast<char*>(first_block) - reinterpret_cast<char*>(new_end_block))/Alignment;
+ #else
+ new_end_block->m_size = first_block->m_prev_size =
+ (reinterpret_cast<char*>(new_end_block) - reinterpret_cast<char*>(first_block))/Alignment;
+ #endif
+
+ new_end_block->m_allocated = 1;
+ (void)last_block_size;
+ (void)old_end_block_size;
+ BOOST_ASSERT(new_end_block->m_size == (old_end_block_size - last_block_size));
 
    //Update managed buffer's size
    m_header.m_size = shrunk_border_offset;
+ BOOST_ASSERT(priv_end_block() == new_end_block);
    if(unique_buffer)
       priv_deallocate(unique_buffer);
 }
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
-void rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
- priv_add_segment(void *addr, std::size_t size)
-{
- //Check alignment
- algo_impl_t::check_alignment(addr);
- //Check size
- BOOST_ASSERT(size >= (BlockCtrlBytes + EndCtrlBlockBytes));
-
- //Initialize the first big block and the "end" node
- block_ctrl *first_big_block = new(addr)block_ctrl;
- first_big_block->m_size = size/Alignment - EndCtrlBlockUnits;
- BOOST_ASSERT(first_big_block->m_size >= BlockCtrlUnits);
-
- //The "end" node is just a node of size 0 with the "end" bit set
- block_ctrl *end_block = static_cast<block_ctrl*>
- (new (reinterpret_cast<char*>(addr) + first_big_block->m_size*Alignment)SizeHolder);
-
- //This will overwrite the prev part of the "end" node
- priv_mark_as_free_block (first_big_block);
- first_big_block->m_prev_size = end_block->m_size =
- (reinterpret_cast<char*>(first_big_block) - reinterpret_cast<char*>(end_block))/Alignment;
- priv_mark_as_allocated_block(end_block);
-
- BOOST_ASSERT(priv_next_block(first_big_block) == end_block);
- BOOST_ASSERT(priv_next_block(end_block) == first_big_block);
- BOOST_ASSERT(priv_end_block(first_big_block) == end_block);
- BOOST_ASSERT(priv_prev_block(end_block) == first_big_block);
-
- //Some check to validate the algorithm, since it makes some assumptions
- //to optimize the space wasted in bookkeeping:
-
- //Check that the sizes of the header are placed before the rbtree
- BOOST_ASSERT(static_cast<void*>(static_cast<SizeHolder*>(first_big_block))
- < static_cast<void*>(static_cast<TreeHook*>(first_big_block)));
-
- //Check that the alignment is power of two (we use some optimizations based on this)
- //BOOST_ASSERT((Alignment % 2) == 0);
- //Insert it in the intrusive containers
- m_header.m_imultiset.insert(*first_big_block);
-}
-
-template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
-inline void rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
- priv_mark_new_allocated_block(block_ctrl *new_block)
-{ priv_mark_as_allocated_block(new_block); }
-
-template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
-inline std::size_t rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::get_size() const
+inline typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::size_type
+rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::get_size() const
 { return m_header.m_size; }
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
-inline std::size_t rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::get_free_memory() const
+typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::size_type
+rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::get_free_memory() const
 {
    return m_header.m_size - m_header.m_allocated -
- priv_first_block_offset(this, m_header.m_extra_hdr_bytes);
+ priv_first_block_offset_from_this(this, m_header.m_extra_hdr_bytes);
 }
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
-inline std::size_t rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
- get_min_size (std::size_t extra_hdr_bytes)
+typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::size_type
+rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
+ get_min_size (size_type extra_hdr_bytes)
 {
    return (algo_impl_t::ceil_units(sizeof(rbtree_best_fit)) +
            algo_impl_t::ceil_units(extra_hdr_bytes) +
@@ -570,8 +622,8 @@
    //-----------------------
    boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
    //-----------------------
- std::size_t block1_off =
- priv_first_block_offset(this, m_header.m_extra_hdr_bytes);
+ size_type block1_off =
+ priv_first_block_offset_from_this(this, m_header.m_extra_hdr_bytes);
 
    return m_header.m_allocated == 0 &&
       m_header.m_imultiset.begin() != m_header.m_imultiset.end() &&
@@ -589,11 +641,11 @@
    //-----------------------
    imultiset_iterator ib(m_header.m_imultiset.begin()), ie(m_header.m_imultiset.end());
 
- std::size_t free_memory = 0;
+ size_type free_memory = 0;
 
    //Iterate through all blocks obtaining their size
    for(; ib != ie; ++ib){
- free_memory += ib->m_size*Alignment;
+ free_memory += (size_type)ib->m_size*Alignment;
       algo_impl_t::assert_alignment(&*ib);
       if(!algo_impl_t::check_alignment(&*ib))
          return false;
@@ -604,8 +656,8 @@
       return false;
    }
 
- std::size_t block1_off =
- priv_first_block_offset(this, m_header.m_extra_hdr_bytes);
+ size_type block1_off =
+ priv_first_block_offset_from_this(this, m_header.m_extra_hdr_bytes);
 
    //Check free bytes are less than size
    if(free_memory > (m_header.m_size - block1_off)){
@@ -616,19 +668,19 @@
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
 inline void* rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
- allocate(std::size_t nbytes)
+ allocate(size_type nbytes)
 {
    //-----------------------
    boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
    //-----------------------
- std::size_t ignore;
+ size_type ignore;
    void * ret = priv_allocate(boost::interprocess::allocate_new, nbytes, nbytes, ignore).first;
    return ret;
 }
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
 inline void* rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
- allocate_aligned(std::size_t nbytes, std::size_t alignment)
+ allocate_aligned(size_type nbytes, size_type alignment)
 {
    //-----------------------
    boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
@@ -639,22 +691,22 @@
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
 template<class T>
 inline std::pair<T*, bool> rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
- allocation_command (boost::interprocess::allocation_type command, std::size_t limit_size,
- std::size_t preferred_size,std::size_t &received_size,
+ allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
+ size_type preferred_size,size_type &received_size,
                         T *reuse_ptr)
 {
    std::pair<void*, bool> ret = priv_allocation_command
       (command, limit_size, preferred_size, received_size, static_cast<void*>(reuse_ptr), sizeof(T));
 
- BOOST_ASSERT(0 == ((std::size_t)ret.first % detail::alignment_of<T>::value));
+ BOOST_ASSERT(0 == ((std::size_t)ret.first % ::boost::alignment_of<T>::value));
    return std::pair<T *, bool>(static_cast<T*>(ret.first), ret.second);
 }
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
 inline std::pair<void*, bool> rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
- raw_allocation_command (boost::interprocess::allocation_type command, std::size_t limit_objects,
- std::size_t preferred_objects,std::size_t &received_objects,
- void *reuse_ptr, std::size_t sizeof_object)
+ raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_objects,
+ size_type preferred_objects,size_type &received_objects,
+ void *reuse_ptr, size_type sizeof_object)
 {
    if(!sizeof_object)
       return std::pair<void *, bool>(static_cast<void*>(0), false);
@@ -672,18 +724,18 @@
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
 inline std::pair<void*, bool> rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
- priv_allocation_command (boost::interprocess::allocation_type command, std::size_t limit_size,
- std::size_t preferred_size,std::size_t &received_size,
- void *reuse_ptr, std::size_t sizeof_object)
+ priv_allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
+ size_type preferred_size,size_type &received_size,
+ void *reuse_ptr, size_type sizeof_object)
 {
    std::pair<void*, bool> ret;
- std::size_t max_count = m_header.m_size/sizeof_object;
+ size_type max_count = m_header.m_size/sizeof_object;
    if(limit_size > max_count || preferred_size > max_count){
       ret.first = 0; return ret;
    }
- std::size_t l_size = limit_size*sizeof_object;
- std::size_t p_size = preferred_size*sizeof_object;
- std::size_t r_size;
+ size_type l_size = limit_size*sizeof_object;
+ size_type p_size = preferred_size*sizeof_object;
+ size_type r_size;
    {
       //-----------------------
       boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
@@ -695,13 +747,14 @@
 }
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
-inline std::size_t rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
+typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::size_type
+rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
    size(const void *ptr) const
 {
    //We need no synchronization since this block's size is not going
    //to be modified by anyone else
    //Obtain the real size of the block
- return (priv_get_block(ptr)->m_size - AllocatedCtrlUnits)*Alignment + UsableByPreviousChunk;
+ return ((size_type)priv_get_block(ptr)->m_size - AllocatedCtrlUnits)*Alignment + UsableByPreviousChunk;
 }
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
@@ -716,7 +769,7 @@
    while(ib != ie){
       //Just clear user the memory part reserved for the user
       volatile char *ptr = reinterpret_cast<char*>(&*ib) + BlockCtrlBytes;
- std::size_t s = ib->m_size*Alignment - BlockCtrlBytes;
+ size_type s = (size_type)ib->m_size*Alignment - BlockCtrlBytes;
       while(s--){
          *ptr++ = 0;
       }
@@ -732,12 +785,12 @@
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
 void* rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
    priv_expand_both_sides(boost::interprocess::allocation_type command
- ,std::size_t min_size
- ,std::size_t preferred_size
- ,std::size_t &received_size
+ ,size_type min_size
+ ,size_type preferred_size
+ ,size_type &received_size
                          ,void *reuse_ptr
                          ,bool only_preferred_backwards
- ,std::size_t backwards_multiple)
+ ,size_type backwards_multiple)
 {
    algo_impl_t::assert_alignment(reuse_ptr);
    if(command & boost::interprocess::expand_fwd){
@@ -777,8 +830,8 @@
       BOOST_ASSERT(prev_block->m_size == reuse->m_prev_size);
       algo_impl_t::assert_alignment(prev_block);
 
- std::size_t needs_backwards_aligned;
- std::size_t lcm;
+ size_type needs_backwards_aligned;
+ size_type lcm;
       if(!algo_impl_t::calculate_lcm_and_needs_backwards_lcmed
          ( backwards_multiple
          , received_size
@@ -788,10 +841,10 @@
       }
 
       //Check if previous block has enough size
- if(std::size_t(prev_block->m_size*Alignment) >= needs_backwards_aligned){
+ if(size_type(prev_block->m_size*Alignment) >= needs_backwards_aligned){
          //Now take all next space. This will succeed
          if(command & boost::interprocess::expand_fwd){
- std::size_t received_size2;
+ size_type received_size2;
             if(!priv_expand(reuse_ptr, received_size, received_size, received_size2)){
                BOOST_ASSERT(0);
             }
@@ -806,7 +859,7 @@
             new_block->m_size =
                AllocatedCtrlUnits + (needs_backwards_aligned + (received_size - UsableByPreviousChunk))/Alignment;
             BOOST_ASSERT(new_block->m_size >= BlockCtrlUnits);
- priv_mark_new_allocated_block(new_block);
+ priv_mark_as_allocated_block(new_block);
 
             prev_block->m_size = (reinterpret_cast<char*>(new_block) -
                                   reinterpret_cast<char*>(prev_block))/Alignment;
@@ -849,13 +902,13 @@
 
             //Just merge the whole previous block
             //prev_block->m_size*Alignment is multiple of lcm (and backwards_multiple)
- received_size = received_size + prev_block->m_size*Alignment;
+ received_size = received_size + (size_type)prev_block->m_size*Alignment;
 
- m_header.m_allocated += prev_block->m_size*Alignment;
+ m_header.m_allocated += (size_type)prev_block->m_size*Alignment;
             //Now update sizes
             prev_block->m_size = prev_block->m_size + reuse->m_size;
             BOOST_ASSERT(prev_block->m_size >= BlockCtrlUnits);
- priv_mark_new_allocated_block(prev_block);
+ priv_mark_as_allocated_block(prev_block);
 
             //If the backwards expansion has remaining bytes in the
             //first bytes, fill them with a pattern
@@ -885,11 +938,11 @@
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
 std::pair<void *, bool> rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
    priv_allocate(boost::interprocess::allocation_type command
- ,std::size_t limit_size
- ,std::size_t preferred_size
- ,std::size_t &received_size
+ ,size_type limit_size
+ ,size_type preferred_size
+ ,size_type &received_size
                 ,void *reuse_ptr
- ,std::size_t backwards_multiple)
+ ,size_type backwards_multiple)
 {
    //Remove me. Forbid backwards allocation
    //command &= (~boost::interprocess::expand_bwd);
@@ -907,10 +960,10 @@
       return return_type(static_cast<void*>(0), false);
 
    //Number of units to request (including block_ctrl header)
- std::size_t preferred_units = priv_get_total_units(preferred_size);
+ size_type preferred_units = priv_get_total_units(preferred_size);
 
    //Number of units to request (including block_ctrl header)
- std::size_t limit_units = priv_get_total_units(limit_size);
+ size_type limit_units = priv_get_total_units(limit_size);
 
    //Expand in place
    if(reuse_ptr && (command & (boost::interprocess::expand_fwd | boost::interprocess::expand_bwd))){
@@ -963,13 +1016,13 @@
 { return const_cast<char*>(reinterpret_cast<const char*>(block) + AllocatedCtrlBytes); }
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
-inline
-std::size_t rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
- priv_get_total_units(std::size_t userbytes)
+inline typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::size_type
+rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
+ priv_get_total_units(size_type userbytes)
 {
    if(userbytes < UsableByPreviousChunk)
       userbytes = UsableByPreviousChunk;
- std::size_t units = detail::get_rounded_size(userbytes - UsableByPreviousChunk, Alignment)/Alignment + AllocatedCtrlUnits;
+ size_type units = detail::get_rounded_size(userbytes - UsableByPreviousChunk, Alignment)/Alignment + AllocatedCtrlUnits;
    if(units < BlockCtrlUnits) units = BlockCtrlUnits;
    return units;
 }
@@ -977,13 +1030,13 @@
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
 bool rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
    priv_expand (void *ptr
- ,const std::size_t min_size
- ,const std::size_t preferred_size
- ,std::size_t &received_size)
+ ,const size_type min_size
+ ,const size_type preferred_size
+ ,size_type &received_size)
 {
    //Obtain the real size of the block
    block_ctrl *block = priv_get_block(ptr);
- std::size_t old_block_units = block->m_size;
+ size_type old_block_units = block->m_size;
 
    //The block must be marked as allocated and the sizes must be equal
    BOOST_ASSERT(priv_is_allocated_block(block));
@@ -995,8 +1048,8 @@
       return true;
 
    //Now translate it to Alignment units
- const std::size_t min_user_units = algo_impl_t::ceil_units(min_size - UsableByPreviousChunk);
- const std::size_t preferred_user_units = algo_impl_t::ceil_units(preferred_size - UsableByPreviousChunk);
+ const size_type min_user_units = algo_impl_t::ceil_units(min_size - UsableByPreviousChunk);
+ const size_type preferred_user_units = algo_impl_t::ceil_units(preferred_size - UsableByPreviousChunk);
 
    //Some parameter checks
    BOOST_ASSERT(min_user_units <= preferred_user_units);
@@ -1009,10 +1062,10 @@
    algo_impl_t::assert_alignment(next_block);
 
    //Is "block" + "next_block" big enough?
- const std::size_t merged_units = old_block_units + next_block->m_size;
+ const size_type merged_units = old_block_units + (size_type)next_block->m_size;
 
    //Now get the expansion size
- const std::size_t merged_user_units = merged_units - AllocatedCtrlUnits;
+ const size_type merged_user_units = merged_units - AllocatedCtrlUnits;
 
    if(merged_user_units < min_user_units){
       received_size = merged_units*Alignment - UsableByPreviousChunk;
@@ -1020,11 +1073,11 @@
    }
 
    //Now get the maximum size the user can allocate
- std::size_t intended_user_units = (merged_user_units < preferred_user_units) ?
+ size_type intended_user_units = (merged_user_units < preferred_user_units) ?
       merged_user_units : preferred_user_units;
 
    //These are total units of the merged block (supposing the next block can be split)
- const std::size_t intended_units = AllocatedCtrlUnits + intended_user_units;
+ const size_type intended_units = AllocatedCtrlUnits + intended_user_units;
 
    //Check if we can split the next one in two parts
    if((merged_units - intended_units) >= BlockCtrlUnits){
@@ -1032,7 +1085,7 @@
       //two blocks, the first one will be merged and
       //the second's size will be the remaining space
       BOOST_ASSERT(next_block->m_size == priv_next_block(next_block)->m_prev_size);
- const std::size_t rem_units = merged_units - intended_units;
+ const size_type rem_units = merged_units - intended_units;
 
       //Check if we we need to update the old next block in the free blocks tree
       //If the new size fulfills tree invariants, we just need to replace the node
@@ -1079,7 +1132,7 @@
       m_header.m_allocated += (merged_units - old_block_units)*Alignment;
    }
    priv_mark_as_allocated_block(block);
- received_size = (block->m_size - AllocatedCtrlUnits)*Alignment + UsableByPreviousChunk;
+ received_size = ((size_type)block->m_size - AllocatedCtrlUnits)*Alignment + UsableByPreviousChunk;
    return true;
 }
 
@@ -1093,37 +1146,45 @@
       (reinterpret_cast<char*>(ptr) - ptr->m_prev_size*Alignment);
 }
 
-template<class MutexFamily, class VoidPointer, std::size_t MemAlignment> inline
-bool rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::priv_is_prev_allocated
- (typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::block_ctrl *ptr)
-{
- if(ptr->m_prev_allocated){
- return true;
- }
- else{
- block_ctrl *prev = priv_prev_block(ptr);
- (void)prev;
- BOOST_ASSERT(!priv_is_allocated_block(prev));
- return false;
- }
-}
+
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment> inline
 typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::block_ctrl *
    rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::priv_end_block
       (typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::block_ctrl *first_segment_block)
 {
+ //The first block's logic is different from the rest of blocks: stores in m_prev_size the absolute
+ //distance with the end block
    BOOST_ASSERT(first_segment_block->m_prev_allocated);
    block_ctrl *end_block = reinterpret_cast<block_ctrl *>
- (reinterpret_cast<char*>(first_segment_block) - first_segment_block->m_prev_size*Alignment);
+ (reinterpret_cast<char*>(first_segment_block) + first_segment_block->m_prev_size*Alignment);
    (void)end_block;
- BOOST_ASSERT(priv_is_allocated_block(end_block));
+ BOOST_ASSERT(end_block->m_allocated == 1);
+ BOOST_ASSERT(end_block->m_size == first_segment_block->m_prev_size);
    BOOST_ASSERT(end_block > first_segment_block);
    return end_block;
 }
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment> inline
 typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::block_ctrl *
+ rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::priv_first_block
+ (typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::block_ctrl *end_segment_block)
+{
+ //The first block's logic is different from the rest of blocks: stores in m_prev_size the absolute
+ //distance with the end block
+ BOOST_ASSERT(end_segment_block->m_allocated);
+ block_ctrl *first_block = reinterpret_cast<block_ctrl *>
+ (reinterpret_cast<char*>(end_segment_block) - end_segment_block->m_size*Alignment);
+ (void)first_block;
+ BOOST_ASSERT(first_block->m_prev_allocated == 1);
+ BOOST_ASSERT(first_block->m_prev_size == end_segment_block->m_size);
+ BOOST_ASSERT(end_segment_block > first_block);
+ return first_block;
+}
+
+
+template<class MutexFamily, class VoidPointer, std::size_t MemAlignment> inline
+typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::block_ctrl *
    rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::priv_next_block
       (typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::block_ctrl *ptr)
 {
@@ -1136,19 +1197,47 @@
       (typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::block_ctrl *block)
 {
    bool allocated = block->m_allocated != 0;
- block_ctrl *next_block = reinterpret_cast<block_ctrl *>
- (reinterpret_cast<char*>(block) + block->m_size*Alignment);
- bool next_block_prev_allocated = next_block->m_prev_allocated != 0;
- (void)next_block_prev_allocated;
- BOOST_ASSERT(allocated == next_block_prev_allocated);
+ #ifndef NDEBUG
+ if(block != priv_end_block()){
+ block_ctrl *next_block = reinterpret_cast<block_ctrl *>
+ (reinterpret_cast<char*>(block) + block->m_size*Alignment);
+ bool next_block_prev_allocated = next_block->m_prev_allocated != 0;
+ (void)next_block_prev_allocated;
+ BOOST_ASSERT(allocated == next_block_prev_allocated);
+ }
+ else{
+ block = block;
+ }
+ #endif
    return allocated;
 }
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment> inline
+bool rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::priv_is_prev_allocated
+ (typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::block_ctrl *block)
+{
+ if(block->m_prev_allocated){
+ return true;
+ }
+ else{
+ #ifndef NDEBUG
+ if(block != priv_first_block()){
+ block_ctrl *prev = priv_prev_block(block);
+ (void)prev;
+ BOOST_ASSERT(!prev->m_allocated);
+ }
+ else{
+ block = block;
+ }
+ #endif
+ return false;
+ }
+}
+
+template<class MutexFamily, class VoidPointer, std::size_t MemAlignment> inline
 void rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::priv_mark_as_allocated_block
       (typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::block_ctrl *block)
 {
- //BOOST_ASSERT(!priv_is_allocated_block(block));
    block->m_allocated = 1;
    reinterpret_cast<block_ctrl *>
       (reinterpret_cast<char*>(block)+ block->m_size*Alignment)->m_prev_allocated = 1;
@@ -1159,19 +1248,18 @@
       (typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::block_ctrl *block)
 {
    block->m_allocated = 0;
- reinterpret_cast<block_ctrl *>
- (reinterpret_cast<char*>(block) + block->m_size*Alignment)->m_prev_allocated = 0;
- //BOOST_ASSERT(!priv_is_allocated_block(ptr));
- priv_next_block(block)->m_prev_size = block->m_size;
+ block_ctrl *next_block = priv_next_block(block);
+ next_block->m_prev_allocated = 0;
+ next_block->m_prev_size = block->m_size;
 }
 
 template<class MutexFamily, class VoidPointer, std::size_t MemAlignment> inline
 void* rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::priv_check_and_allocate
- (std::size_t nunits
+ (size_type nunits
    ,typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::block_ctrl* block
- ,std::size_t &received_size)
+ ,size_type &received_size)
 {
- std::size_t upper_nunits = nunits + BlockCtrlUnits;
+ size_type upper_nunits = nunits + BlockCtrlUnits;
    imultiset_iterator it_old = Imultiset::s_iterator_to(*block);
    algo_impl_t::assert_alignment(block);
 
@@ -1179,7 +1267,7 @@
       //This block is bigger than needed, split it in
       //two blocks, the first's size will be "units" and
       //the second's size "block->m_size-units"
- std::size_t block_old_size = block->m_size;
+ size_type block_old_size = block->m_size;
       block->m_size = nunits;
       BOOST_ASSERT(block->m_size >= BlockCtrlUnits);
 
@@ -1218,8 +1306,8 @@
    }
    //We need block_ctrl for deallocation stuff, so
    //return memory user can overwrite
- m_header.m_allocated += block->m_size*Alignment;
- received_size = (block->m_size - AllocatedCtrlUnits)*Alignment + UsableByPreviousChunk;
+ m_header.m_allocated += (size_type)block->m_size*Alignment;
+ received_size = ((size_type)block->m_size - AllocatedCtrlUnits)*Alignment + UsableByPreviousChunk;
 
    //Mark the block as allocated
    priv_mark_as_allocated_block(block);
@@ -1232,10 +1320,6 @@
    //volatile char *ptr =
    char *ptr = reinterpret_cast<char*>(block)+tree_hook_offset_in_block;
    const std::size_t s = BlockCtrlBytes - tree_hook_offset_in_block;
- /*
- while(s--){
- *ptr++ = 0;
- }*/
    std::memset(ptr, 0, s);
    this->priv_next_block(block)->m_prev_size = 0;
    return priv_get_user_buffer(block);
@@ -1265,7 +1349,7 @@
    //Check if alignment and block size are right
    algo_impl_t::assert_alignment(addr);
 
- std::size_t block_old_size = Alignment*block->m_size;
+ size_type block_old_size = Alignment*(size_type)block->m_size;
    BOOST_ASSERT(m_header.m_allocated >= block_old_size);
 
    //Update used memory count

Modified: branches/release/boost/interprocess/mem_algo/simple_seq_fit.hpp
==============================================================================
--- branches/release/boost/interprocess/mem_algo/simple_seq_fit.hpp (original)
+++ branches/release/boost/interprocess/mem_algo/simple_seq_fit.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -39,10 +39,12 @@
    /// @endcond
 
    public:
+ typedef typename base_t::size_type size_type;
+
    //!Constructor. "size" is the total size of the managed memory segment,
    //!"extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(simple_seq_fit)
    //!offset that the allocator should not use at all.*/
- simple_seq_fit (std::size_t size, std::size_t extra_hdr_bytes)
+ simple_seq_fit (size_type size, size_type extra_hdr_bytes)
       : base_t(size, extra_hdr_bytes){}
 };
 

Modified: branches/release/boost/interprocess/offset_ptr.hpp
==============================================================================
--- branches/release/boost/interprocess/offset_ptr.hpp (original)
+++ branches/release/boost/interprocess/offset_ptr.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -23,11 +23,13 @@
 #include <boost/interprocess/detail/cast_tags.hpp>
 #include <boost/interprocess/detail/mpl.hpp>
 #include <boost/pointer_cast.hpp>
-#include <boost/assert.hpp>
+#include <boost/pointer_to_other.hpp>
 #include <boost/assert.hpp>
 #include <ostream>
 #include <istream>
 #include <iterator>
+#include <boost/aligned_storage.hpp>
+#include <boost/type_traits/alignment_of.hpp>
 
 //!\file
 //!Describes a smart pointer that stores the offset between this pointer and
@@ -50,45 +52,70 @@
 //!pointer and the pointee are still separated by the same offset. This feature
 //!converts offset_ptr in a smart pointer that can be placed in shared memory and
 //!memory mapped files mapped in different addresses in every process.
-template <class PointedType>
+template <class PointedType, class DifferenceType, class OffsetType, std::size_t OffsetAlignment>
 class offset_ptr
 {
    /// @cond
- typedef offset_ptr<PointedType> self_t;
+ 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
+ __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 = (const char*)ptr - (const char*)(this);
+ 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) //this workaround is needed for msvc-8.0 and msvc-9.0
+ __declspec(noinline)
+ #elif defined (__GNUC__)
+ __attribute__((noinline))
    #endif
- void* get_pointer() const
- { return (internal.m_offset == 1) ? 0 : (const_cast<char*>(reinterpret_cast<const char*>(this)) + internal.m_offset); }
+ 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(std::ptrdiff_t bytes)
+ void inc_offset(DifferenceType bytes)
    { internal.m_offset += bytes; }
 
- void dec_offset(std::ptrdiff_t bytes)
+ void dec_offset(DifferenceType bytes)
    { internal.m_offset -= bytes; }
 
    union internal_type{
- std::ptrdiff_t m_offset; //Distance between this object and pointed address
- PointedType *aliasing_helper;
+ 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
 
@@ -97,8 +124,9 @@
    typedef typename detail::
       add_reference<PointedType>::type reference;
    typedef PointedType value_type;
- typedef std::ptrdiff_t difference_type;
+ typedef DifferenceType difference_type;
    typedef std::random_access_iterator_tag iterator_category;
+ typedef OffsetType offset_type;
 
    public: //Public Functions
 
@@ -119,40 +147,40 @@
 
    //!Constructor from other offset_ptr. If pointers of pointee types are
    //!convertible, offset_ptrs will be convertibles. Never throws.
- template<class T2>
- offset_ptr(const offset_ptr<T2> &ptr)
+ 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); }
 
    //!Emulates static_cast operator.
    //!Never throws.
- template<class Y>
- offset_ptr(const offset_ptr<Y> & r, detail::static_cast_tag)
+ template<class T2, class P2, class O2, std::size_t A2>
+ offset_ptr(const offset_ptr<T2, P2, O2, A2> & r, detail::static_cast_tag)
    { this->set_offset(static_cast<PointedType*>(r.get())); }
 
    //!Emulates const_cast operator.
    //!Never throws.
- template<class Y>
- offset_ptr(const offset_ptr<Y> & r, detail::const_cast_tag)
+ template<class T2, class P2, class O2, std::size_t A2>
+ offset_ptr(const offset_ptr<T2, P2, O2, A2> & r, detail::const_cast_tag)
    { this->set_offset(const_cast<PointedType*>(r.get())); }
 
    //!Emulates dynamic_cast operator.
    //!Never throws.
- template<class Y>
- offset_ptr(const offset_ptr<Y> & r, detail::dynamic_cast_tag)
+ template<class T2, class P2, class O2, std::size_t A2>
+ offset_ptr(const offset_ptr<T2, P2, O2, A2> & r, detail::dynamic_cast_tag)
    { this->set_offset(dynamic_cast<PointedType*>(r.get())); }
 
    //!Emulates reinterpret_cast operator.
    //!Never throws.
- template<class Y>
- offset_ptr(const offset_ptr<Y> & r, detail::reinterpret_cast_tag)
+ template<class T2, class P2, class O2, std::size_t A2>
+ offset_ptr(const offset_ptr<T2, P2, O2, A2> & r, detail::reinterpret_cast_tag)
    { this->set_offset(reinterpret_cast<PointedType*>(r.get())); }
 
    //!Obtains raw pointer from offset.
    //!Never throws.
    pointer get()const
- { return static_cast<pointer>(this->get_pointer()); }
+ { return this->get_pointer(); }
 
- std::ptrdiff_t get_offset() const
+ offset_type get_offset() const
    { return internal.m_offset; }
 
    //!Pointer-like -> operator. It can return 0 pointer.
@@ -171,7 +199,8 @@
 
    //!Indexing operator.
    //!Never throws.
- reference operator[](std::ptrdiff_t idx) const
+ template<class T>
+ reference operator[](T idx) const
    { return this->get()[idx]; }
 
    //!Assignment from pointer (saves extra conversion).
@@ -186,28 +215,32 @@
 
    //!Assignment from related offset_ptr. If pointers of pointee types
    //! are assignable, offset_ptrs will be assignable. Never throws.
- template <class T2>
- offset_ptr& operator= (const offset_ptr<T2> & pt)
+ 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; }
  
- //!offset_ptr + std::ptrdiff_t.
+ //!offset_ptr + difference_type.
    //!Never throws.
- offset_ptr operator+ (std::ptrdiff_t offset) const
+ template<class T>
+ offset_ptr operator+ (T offset) const
    { return offset_ptr(this->get()+offset); }
 
- //!offset_ptr - std::ptrdiff_t.
+ //!offset_ptr - difference_type.
    //!Never throws.
- offset_ptr operator- (std::ptrdiff_t offset) const
+ template<class T>
+ offset_ptr operator- (T offset) const
    { return offset_ptr(this->get()-offset); }
 
- //!offset_ptr += std::ptrdiff_t.
+ //!offset_ptr += difference_type.
    //!Never throws.
- offset_ptr &operator+= (std::ptrdiff_t offset)
+ template<class T>
+ offset_ptr &operator+= (T offset)
    { this->inc_offset(offset * sizeof (PointedType)); return *this; }
 
- //!offset_ptr -= std::ptrdiff_t.
+ //!offset_ptr -= difference_type.
    //!Never throws.
- offset_ptr &operator-= (std::ptrdiff_t offset)
+ template<class T>
+ offset_ptr &operator-= (T offset)
    { this->dec_offset(offset * sizeof (PointedType)); return *this; }
 
    //!++offset_ptr.
@@ -249,118 +282,119 @@
 */
 };
 
-//!offset_ptr<T1> == offset_ptr<T2>.
+//!offset_ptr<T1, P1, O1, A1> == offset_ptr<T2, P2, O2, A2>.
 //!Never throws.
-template<class T1, class T2>
-inline bool operator== (const offset_ptr<T1> &pt1,
- const offset_ptr<T2> &pt2)
+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(); }
 
-//!offset_ptr<T1> != offset_ptr<T2>.
+//!offset_ptr<T1, P1, O1, A1> != offset_ptr<T2, P2, O2, A2>.
 //!Never throws.
-template<class T1, class T2>
-inline bool operator!= (const offset_ptr<T1> &pt1,
- const offset_ptr<T2> &pt2)
+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(); }
 
-//!offset_ptr<T1> < offset_ptr<T2>.
+//!offset_ptr<T1, P1, O1, A1> < offset_ptr<T2, P2, O2, A2>.
 //!Never throws.
-template<class T1, class T2>
-inline bool operator< (const offset_ptr<T1> &pt1,
- const offset_ptr<T2> &pt2)
+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(); }
 
-//!offset_ptr<T1> <= offset_ptr<T2>.
+//!offset_ptr<T1, P1, O1, A1> <= offset_ptr<T2, P2, O2, A2>.
 //!Never throws.
-template<class T1, class T2>
-inline bool operator<= (const offset_ptr<T1> &pt1,
- const offset_ptr<T2> &pt2)
+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(); }
 
-//!offset_ptr<T1> > offset_ptr<T2>.
+//!offset_ptr<T1, P1, O1, A1> > offset_ptr<T2, P2, O2, A2>.
 //!Never throws.
-template<class T1, class T2>
-inline bool operator> (const offset_ptr<T1> &pt1,
- const offset_ptr<T2> &pt2)
+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(); }
 
-//!offset_ptr<T1> >= offset_ptr<T2>.
+//!offset_ptr<T1, P1, O1, A1> >= offset_ptr<T2, P2, O2, A2>.
 //!Never throws.
-template<class T1, class T2>
-inline bool operator>= (const offset_ptr<T1> &pt1,
- const offset_ptr<T2> &pt2)
+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(); }
 
 //!operator<<
 //!for offset ptr
-template<class E, class T, class Y>
+template<class E, class T, class W, class X, class Y, std::size_t Z>
 inline std::basic_ostream<E, T> & operator<<
- (std::basic_ostream<E, T> & os, offset_ptr<Y> const & p)
+ (std::basic_ostream<E, T> & os, offset_ptr<W, X, Y, Z> const & p)
 { return os << p.get_offset(); }
 
 //!operator>>
 //!for offset ptr
-template<class E, class T, class Y>
+template<class E, class T, class W, class X, class Y, std::size_t Z>
 inline std::basic_istream<E, T> & operator>>
- (std::basic_istream<E, T> & is, offset_ptr<Y> & p)
+ (std::basic_istream<E, T> & is, offset_ptr<W, X, Y, Z> & p)
 { return is >> p.get_offset(); }
 
-//!std::ptrdiff_t + offset_ptr
+//!difference_type + offset_ptr
 //!operation
-template<class T>
-inline offset_ptr<T> operator+(std::ptrdiff_t diff, const offset_ptr<T>& right)
+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 T, class T2>
-inline std::ptrdiff_t operator- (const offset_ptr<T> &pt, const offset_ptr<T2> &pt2)
-{ return pt.get()- pt2.get(); }
+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>
-inline void swap (boost::interprocess::offset_ptr<T> &pt,
- boost::interprocess::offset_ptr<T> &pt2)
+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>::value_type *ptr = pt.get();
+ 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 T, class U>
-inline boost::interprocess::offset_ptr<T>
- static_pointer_cast(const boost::interprocess::offset_ptr<U> & r)
+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>
+ static_pointer_cast(const boost::interprocess::offset_ptr<T2, P2, O2, A2> & r)
 {
- return boost::interprocess::offset_ptr<T>
+ return boost::interprocess::offset_ptr<T1, P1, O1, A1>
             (r, boost::interprocess::detail::static_cast_tag());
 }
 
 //!Simulation of const_cast between pointers. Never throws.
-template<class T, class U>
-inline boost::interprocess::offset_ptr<T>
- const_pointer_cast(const boost::interprocess::offset_ptr<U> & r)
+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>
+ const_pointer_cast(const boost::interprocess::offset_ptr<T2, P2, O2, A2> & r)
 {
- return boost::interprocess::offset_ptr<T>
+ return boost::interprocess::offset_ptr<T1, P1, O1, A1>
             (r, boost::interprocess::detail::const_cast_tag());
 }
 
 //!Simulation of dynamic_cast between pointers. Never throws.
-template<class T, class U>
-inline boost::interprocess::offset_ptr<T>
- dynamic_pointer_cast(const boost::interprocess::offset_ptr<U> & r)
+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>
+ dynamic_pointer_cast(const boost::interprocess::offset_ptr<T2, P2, O2, A2> & r)
 {
- return boost::interprocess::offset_ptr<T>
+ return boost::interprocess::offset_ptr<T1, P1, O1, A1>
             (r, boost::interprocess::detail::dynamic_cast_tag());
 }
 
 //!Simulation of reinterpret_cast between pointers. Never throws.
-template<class T, class U>
-inline boost::interprocess::offset_ptr<T>
- reinterpret_pointer_cast(const boost::interprocess::offset_ptr<U> & r)
+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>
+ reinterpret_pointer_cast(const boost::interprocess::offset_ptr<T2, P2, O2, A2> & r)
 {
- return boost::interprocess::offset_ptr<T>
+ return boost::interprocess::offset_ptr<T1, P1, O1, A1>
             (r, boost::interprocess::detail::reinterpret_cast_tag());
 }
 
@@ -369,15 +403,15 @@
 /// @cond
 
 //!has_trivial_constructor<> == true_type specialization for optimizations
-template <class T>
-struct has_trivial_constructor< boost::interprocess::offset_ptr<T> >
+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 };
 };
 
 ///has_trivial_destructor<> == true_type specialization for optimizations
-template <class T>
-struct has_trivial_destructor< boost::interprocess::offset_ptr<T> >
+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 };
 };
@@ -387,8 +421,8 @@
 //#endif
 //!get_pointer() enables boost::mem_fn to recognize offset_ptr.
 //!Never throws.
-template<class T>
-inline T * get_pointer(boost::interprocess::offset_ptr<T> const & p)
+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)
 { return p.get(); }
 //#if !defined(_MSC_VER) || (_MSC_VER >= 1400)
 } //namespace interprocess
@@ -409,22 +443,22 @@
 template<class VoidPointer, std::size_t N>
 struct max_pointer_plus_bits;
 
-template<std::size_t Alignment>
-struct max_pointer_plus_bits<boost::interprocess::offset_ptr<void>, Alignment>
+template<std::size_t OffsetAlignment, class P, class O, std::size_t A>
+struct max_pointer_plus_bits<boost::interprocess::offset_ptr<void, P, O, A>, OffsetAlignment>
 {
    //The offset ptr can embed one bit less than the alignment since it
    //uses offset == 1 to store the null pointer.
- static const std::size_t value = ::boost::interprocess::detail::ls_zeros<Alignment>::value - 1;
+ static const std::size_t value = ::boost::interprocess::detail::ls_zeros<OffsetAlignment>::value - 1;
 };
 
 //Predeclaration
 template<class Pointer, std::size_t NumBits>
 struct pointer_plus_bits;
 
-template<class T, std::size_t NumBits>
-struct pointer_plus_bits<boost::interprocess::offset_ptr<T>, NumBits>
+template<class T, class P, class O, std::size_t A, std::size_t NumBits>
+struct pointer_plus_bits<boost::interprocess::offset_ptr<T, P, O, A>, NumBits>
 {
- typedef boost::interprocess::offset_ptr<T> pointer;
+ typedef boost::interprocess::offset_ptr<T, P, O, A> pointer;
    //Bits are stored in the lower bits of the pointer except the LSB,
    //because this bit is used to represent the null pointer.
    static const std::size_t Mask = ((std::size_t(1) << NumBits)-1)<<1u;
@@ -450,6 +484,13 @@
 };
 
 } //namespace intrusive
+
+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 >
+{
+ typedef ::boost::interprocess::offset_ptr<U, T2, T3, A> type;
+};
+
 } //namespace boost{
 /// @endcond
 

Modified: branches/release/boost/interprocess/segment_manager.hpp
==============================================================================
--- branches/release/boost/interprocess/segment_manager.hpp (original)
+++ branches/release/boost/interprocess/segment_manager.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -74,12 +74,14 @@
    
    //Experimental. Don't use
    typedef typename MemoryAlgorithm::multiallocation_chain multiallocation_chain;
+ typedef typename MemoryAlgorithm::difference_type difference_type;
+ typedef typename MemoryAlgorithm::size_type size_type;
 
    /// @endcond
 
    //!This constant indicates the payload size
    //!associated with each allocation of the memory algorithm
- static const std::size_t PayloadPerAllocation = MemoryAlgorithm::PayloadPerAllocation;
+ static const size_type PayloadPerAllocation = MemoryAlgorithm::PayloadPerAllocation;
 
    //!Constructor of the segment_manager_base
    //!
@@ -92,7 +94,7 @@
    //!dynamic allocation
    //!
    //!Can throw
- segment_manager_base(std::size_t size, std::size_t reserved_bytes)
+ segment_manager_base(size_type size, size_type reserved_bytes)
       : MemoryAlgorithm(size, reserved_bytes)
    {
       BOOST_ASSERT((sizeof(segment_manager_base<MemoryAlgorithm>) == sizeof(MemoryAlgorithm)));
@@ -100,22 +102,22 @@
 
    //!Returns the size of the memory
    //!segment
- std::size_t get_size() const
+ size_type get_size() const
    { return MemoryAlgorithm::get_size(); }
 
    //!Returns the number of free bytes of the memory
    //!segment
- std::size_t get_free_memory() const
+ size_type get_free_memory() const
    { return MemoryAlgorithm::get_free_memory(); }
 
    //!Obtains the minimum size needed by
    //!the segment manager
- static std::size_t get_min_size (std::size_t size)
+ static size_type get_min_size (size_type size)
    { return MemoryAlgorithm::get_min_size(size); }
 
    //!Allocates nbytes bytes. This function is only used in
    //!single-segment management. Never throws
- void * allocate (std::size_t nbytes, std::nothrow_t)
+ void * allocate (size_type nbytes, std::nothrow_t)
    { return MemoryAlgorithm::allocate(nbytes); }
 
    /// @cond
@@ -123,7 +125,7 @@
    //Experimental. Dont' use.
    //!Allocates n_elements of
    //!elem_size bytes. Throws bad_alloc on failure.
- multiallocation_chain allocate_many(std::size_t elem_bytes, std::size_t num_elements)
+ multiallocation_chain allocate_many(size_type elem_bytes, size_type num_elements)
    {
       multiallocation_chain mem(MemoryAlgorithm::allocate_many(elem_bytes, num_elements));
       if(mem.empty()) throw bad_alloc();
@@ -133,7 +135,7 @@
    //!Allocates n_elements, each one of
    //!element_lenghts[i]*sizeof_element bytes. Throws bad_alloc on failure.
    multiallocation_chain allocate_many
- (const std::size_t *element_lenghts, std::size_t n_elements, std::size_t sizeof_element = 1)
+ (const size_type *element_lenghts, size_type n_elements, size_type sizeof_element = 1)
    {
       multiallocation_chain mem(MemoryAlgorithm::allocate_many(element_lenghts, n_elements, sizeof_element));
       if(mem.empty()) throw bad_alloc();
@@ -143,14 +145,14 @@
    //!Allocates n_elements of
    //!elem_size bytes. Returns a default constructed iterator on failure.
    multiallocation_chain allocate_many
- (std::size_t elem_bytes, std::size_t num_elements, std::nothrow_t)
+ (size_type elem_bytes, size_type num_elements, std::nothrow_t)
    { return MemoryAlgorithm::allocate_many(elem_bytes, num_elements); }
 
    //!Allocates n_elements, each one of
    //!element_lenghts[i]*sizeof_element bytes.
    //!Returns a default constructed iterator on failure.
    multiallocation_chain allocate_many
- (const std::size_t *elem_sizes, std::size_t n_elements, std::size_t sizeof_element, std::nothrow_t)
+ (const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, std::nothrow_t)
    { return MemoryAlgorithm::allocate_many(elem_sizes, n_elements, sizeof_element); }
 
    //!Deallocates elements pointed by the
@@ -162,7 +164,7 @@
 
    //!Allocates nbytes bytes. Throws boost::interprocess::bad_alloc
    //!on failure
- void * allocate(std::size_t nbytes)
+ void * allocate(size_type nbytes)
    {
       void * ret = MemoryAlgorithm::allocate(nbytes);
       if(!ret)
@@ -172,12 +174,12 @@
 
    //!Allocates nbytes bytes. This function is only used in
    //!single-segment management. Never throws
- void * allocate_aligned (std::size_t nbytes, std::size_t alignment, std::nothrow_t)
+ void * allocate_aligned (size_type nbytes, size_type alignment, std::nothrow_t)
    { return MemoryAlgorithm::allocate_aligned(nbytes, alignment); }
 
    //!Allocates nbytes bytes. This function is only used in
    //!single-segment management. Throws bad_alloc when fails
- void * allocate_aligned(std::size_t nbytes, std::size_t alignment)
+ void * allocate_aligned(size_type nbytes, size_type alignment)
    {
       void * ret = MemoryAlgorithm::allocate_aligned(nbytes, alignment);
       if(!ret)
@@ -187,8 +189,8 @@
 
    template<class T>
    std::pair<T *, bool>
- allocation_command (boost::interprocess::allocation_type command, std::size_t limit_size,
- std::size_t preferred_size,std::size_t &received_size,
+ allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
+ size_type preferred_size,size_type &received_size,
                            T *reuse_ptr = 0)
    {
       std::pair<T *, bool> ret = MemoryAlgorithm::allocation_command
@@ -200,9 +202,9 @@
    }
 
    std::pair<void *, bool>
- raw_allocation_command (boost::interprocess::allocation_type command, std::size_t limit_objects,
- std::size_t preferred_objects,std::size_t &received_objects,
- void *reuse_ptr = 0, std::size_t sizeof_object = 1)
+ raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_objects,
+ size_type preferred_objects,size_type &received_objects,
+ void *reuse_ptr = 0, size_type sizeof_object = 1)
    {
       std::pair<void *, bool> ret = MemoryAlgorithm::raw_allocation_command
          ( command | boost::interprocess::nothrow_allocation, limit_objects, preferred_objects, received_objects
@@ -219,7 +221,7 @@
 
    //!Increases managed memory in extra_size bytes more. This only works
    //!with single-segment management.
- void grow(std::size_t extra_size)
+ void grow(size_type extra_size)
    { MemoryAlgorithm::grow(extra_size); }
 
    //!Decreases managed memory to the minimum. This only works
@@ -243,17 +245,17 @@
    { MemoryAlgorithm::zero_free_memory(); }
 
    //!Returns the size of the buffer previously allocated pointed by ptr
- std::size_t size(const void *ptr) const
+ size_type size(const void *ptr) const
    { return MemoryAlgorithm::size(ptr); }
 
    /// @cond
    protected:
    void * prot_anonymous_construct
- (std::size_t num, bool dothrow, detail::in_place_interface &table)
+ (size_type num, bool dothrow, detail::in_place_interface &table)
    {
- typedef detail::block_header block_header_t;
- block_header_t block_info ( table.size*num
- , table.alignment
+ typedef detail::block_header<size_type> block_header_t;
+ block_header_t block_info ( size_type(table.size*num)
+ , size_type(table.alignment)
                                  , anonymous_type
                                  , 1
                                  , 0);
@@ -292,7 +294,7 @@
    {
 
       //Get control data from associated with this object
- typedef detail::block_header block_header_t;
+ typedef detail::block_header<size_type> block_header_t;
       block_header_t *ctrl_data = block_header_t::block_header_from_value(object, table.size, table.alignment);
 
       //-------------------------------
@@ -307,7 +309,7 @@
       //Call destructors and free memory
       //Build scoped ptr to avoid leaks with destructor exception
       std::size_t destroyed = 0;
- table.destroy_n(const_cast<void*>(object), ctrl_data->m_value_bytes/table.size, destroyed);
+ table.destroy_n(const_cast<void*>(object), ctrl_data->m_value_bytes/table.size, destroyed);
       this->deallocate(ctrl_data);
    }
    /// @endcond
@@ -341,20 +343,22 @@
    segment_manager(const segment_manager &);
    segment_manager &operator=(const segment_manager &);
    typedef segment_manager_base<MemoryAlgorithm> Base;
- typedef detail::block_header block_header_t;
    /// @endcond
 
    public:
    typedef MemoryAlgorithm memory_algorithm;
    typedef typename Base::void_pointer void_pointer;
+ typedef typename Base::size_type size_type;
+ typedef typename Base::difference_type difference_type;
    typedef CharType char_type;
 
    typedef segment_manager_base<MemoryAlgorithm> segment_manager_base_type;
 
- static const std::size_t PayloadPerAllocation = Base::PayloadPerAllocation;
+ static const size_type PayloadPerAllocation = Base::PayloadPerAllocation;
 
    /// @cond
    private:
+ typedef detail::block_header<size_type> block_header_t;
    typedef detail::index_config<CharType, MemoryAlgorithm> index_config_named;
    typedef detail::index_config<char, MemoryAlgorithm> index_config_unique;
    typedef IndexType<index_config_named> index_type;
@@ -403,7 +407,7 @@
    //!"size" is the size of the memory segment where
    //!the segment manager is being constructed.
    //!Can throw
- segment_manager(std::size_t size)
+ segment_manager(size_type size)
       : Base(size, priv_get_reserved_bytes())
       , m_header(static_cast<Base*>(get_this_pointer()))
    {
@@ -415,28 +419,28 @@
    //!and the object count. On failure the first member of the
    //!returned pair is 0.
    template <class T>
- std::pair<T*, std::size_t> find (const CharType* name)
+ std::pair<T*, size_type> find (const CharType* name)
    { return this->priv_find_impl<T>(name, true); }
 
    //!Tries to find a previous unique allocation. Returns the address
    //!and the object count. On failure the first member of the
    //!returned pair is 0.
    template <class T>
- std::pair<T*, std::size_t> find (const detail::unique_instance_t* name)
+ std::pair<T*, size_type> find (const detail::unique_instance_t* name)
    { return this->priv_find_impl<T>(name, true); }
 
    //!Tries to find a previous named allocation. Returns the address
    //!and the object count. On failure the first member of the
    //!returned pair is 0. This search is not mutex-protected!
    template <class T>
- std::pair<T*, std::size_t> find_no_lock (const CharType* name)
+ std::pair<T*, size_type> find_no_lock (const CharType* name)
    { return this->priv_find_impl<T>(name, false); }
 
    //!Tries to find a previous unique allocation. Returns the address
    //!and the object count. On failure the first member of the
    //!returned pair is 0. This search is not mutex-protected!
    template <class T>
- std::pair<T*, std::size_t> find_no_lock (const detail::unique_instance_t* name)
+ std::pair<T*, size_type> find_no_lock (const detail::unique_instance_t* name)
    { return this->priv_find_impl<T>(name, false); }
 
    //!Returns throwing "construct" proxy
@@ -558,7 +562,7 @@
    //!Returns the length of an object created with construct/find_or_construct
    //!functions. Does not throw.
    template<class T>
- static std::size_t get_instance_length(const T *ptr)
+ static size_type get_instance_length(const T *ptr)
    { return priv_get_instance_length(block_header_t::block_header_from_value(ptr), sizeof(T)); }
 
    //!Returns is the the name of an object created with construct/find_or_construct
@@ -570,7 +574,7 @@
    //!Preallocates needed index resources to optimize the
    //!creation of "num" named objects in the managed memory segment.
    //!Can throw boost::interprocess::bad_alloc if there is no enough memory.
- void reserve_named_objects(std::size_t num)
+ void reserve_named_objects(size_type num)
    {
       //-------------------------------
       scoped_lock<rmutex> guard(m_header);
@@ -581,7 +585,7 @@
    //!Preallocates needed index resources to optimize the
    //!creation of "num" unique objects in the managed memory segment.
    //!Can throw boost::interprocess::bad_alloc if there is no enough memory.
- void reserve_unique_objects(std::size_t num)
+ void reserve_unique_objects(size_type num)
    {
       //-------------------------------
       scoped_lock<rmutex> guard(m_header);
@@ -602,7 +606,7 @@
 
    //!Returns the number of named objects stored in
    //!the segment.
- std::size_t get_num_named_objects()
+ size_type get_num_named_objects()
    {
       //-------------------------------
       scoped_lock<rmutex> guard(m_header);
@@ -612,7 +616,7 @@
 
    //!Returns the number of unique objects stored in
    //!the segment.
- std::size_t get_num_unique_objects()
+ size_type get_num_unique_objects()
    {
       //-------------------------------
       scoped_lock<rmutex> guard(m_header);
@@ -622,7 +626,7 @@
 
    //!Obtains the minimum size needed by the
    //!segment manager
- static std::size_t get_min_size()
+ static size_type get_min_size()
    { return Base::get_min_size(priv_get_reserved_bytes()); }
 
    //!Returns a constant iterator to the beginning of the information about
@@ -694,7 +698,7 @@
    //!encapsulated in an object function.
    template<class T>
    T *generic_construct(const CharType *name,
- std::size_t num,
+ size_type num,
                          bool try2find,
                          bool dothrow,
                          detail::in_place_interface &table)
@@ -708,12 +712,12 @@
    //!and the object count. On failure the first member of the
    //!returned pair is 0.
    template <class T>
- std::pair<T*, std::size_t> priv_find_impl (const CharType* name, bool lock)
+ std::pair<T*, size_type> priv_find_impl (const CharType* name, bool lock)
    {
       //The name can't be null, no anonymous object can be found by name
       BOOST_ASSERT(name != 0);
       detail::placement_destroy<T> table;
- std::size_t size;
+ size_type size;
       void *ret;
 
       if(name == reinterpret_cast<const CharType*>(-1)){
@@ -722,30 +726,30 @@
       else{
          ret = priv_generic_find<CharType> (name, m_header.m_named_index, table, size, is_intrusive_t(), lock);
       }
- return std::pair<T*, std::size_t>(static_cast<T*>(ret), size);
+ return std::pair<T*, size_type>(static_cast<T*>(ret), size);
    }
 
    //!Tries to find a previous unique allocation. Returns the address
    //!and the object count. On failure the first member of the
    //!returned pair is 0.
    template <class T>
- std::pair<T*, std::size_t> priv_find__impl (const detail::unique_instance_t* name, bool lock)
+ std::pair<T*, size_type> priv_find__impl (const detail::unique_instance_t* name, bool lock)
    {
       detail::placement_destroy<T> table;
- std::size_t size;
+ size_type size;
       void *ret = priv_generic_find<char>(name, m_header.m_unique_index, table, size, is_intrusive_t(), lock);
- return std::pair<T*, std::size_t>(static_cast<T*>(ret), size);
+ return std::pair<T*, size_type>(static_cast<T*>(ret), size);
    }
 
    void *priv_generic_construct(const CharType *name,
- std::size_t num,
+ size_type num,
                          bool try2find,
                          bool dothrow,
                          detail::in_place_interface &table)
    {
       void *ret;
       //Security overflow check
- if(num > ((std::size_t)-1)/table.size){
+ if(num > ((std::size_t)-1)/table.size){
          if(dothrow)
             throw bad_alloc();
          else
@@ -808,7 +812,7 @@
       return name;
    }
 
- static std::size_t priv_get_instance_length(block_header_t *ctrl_data, std::size_t sizeofvalue)
+ static size_type priv_get_instance_length(block_header_t *ctrl_data, size_type sizeofvalue)
    {
       //Get header
       BOOST_ASSERT((ctrl_data->value_bytes() %sizeofvalue) == 0);
@@ -824,7 +828,7 @@
       return (instance_type)ctrl_data->alloc_type();
    }
 
- static std::size_t priv_get_reserved_bytes()
+ static size_type priv_get_reserved_bytes()
    {
       //Get the number of bytes until the end of (*this)
       //beginning in the end of the Base base.
@@ -836,7 +840,7 @@
       (const CharT* name,
        IndexType<detail::index_config<CharT, MemoryAlgorithm> > &index,
        detail::in_place_interface &table,
- std::size_t &length,
+ size_type &length,
        detail::true_ is_intrusive,
        bool use_lock)
    {
@@ -876,7 +880,7 @@
       (const CharT* name,
        IndexType<detail::index_config<CharT, MemoryAlgorithm> > &index,
        detail::in_place_interface &table,
- std::size_t &length,
+ size_type &length,
        detail::false_ is_intrusive,
        bool use_lock)
    {
@@ -920,7 +924,7 @@
       (void)is_node_index;
       typedef typename IndexType<detail::index_config<CharT, MemoryAlgorithm> >::iterator index_it;
 
- index_it *ihdr = block_header_t::to_first_header<index_it>(block_header);
+ index_it *ihdr = block_header_t::template to_first_header<index_it>(block_header);
       return this->priv_generic_named_destroy_impl<CharT>(*ihdr, index, table);
    }
 
@@ -967,7 +971,7 @@
       intrusive_value_type *iv = intrusive_value_type::get_intrusive_value_type(ctrl_data);
       void *memory = iv;
       void *values = ctrl_data->value();
- std::size_t num = ctrl_data->m_value_bytes/table.size;
+ std::size_t num = ctrl_data->m_value_bytes/table.size;
       
       //Sanity check
       BOOST_ASSERT((ctrl_data->m_value_bytes % table.size) == 0);
@@ -1031,7 +1035,7 @@
 
       //Check if the distance between the name pointer and the memory pointer
       //is correct (this can detect incorrect type in destruction)
- std::size_t num = ctrl_data->m_value_bytes/table.size;
+ std::size_t num = ctrl_data->m_value_bytes/table.size;
       void *values = ctrl_data->value();
 
       //Sanity check
@@ -1047,7 +1051,7 @@
 
       void *memory;
       if(is_node_index_t::value){
- index_it *ihdr = block_header_t::
+ index_it *ihdr = block_header_t::template
             to_first_header<index_it>(ctrl_data);
          ihdr->~index_it();
          memory = ihdr;
@@ -1057,16 +1061,16 @@
       }
 
       //Call destructors and free memory
- std::size_t destroyed;
+ std::size_t destroyed;
       table.destroy_n(values, num, destroyed);
       this->deallocate(memory);
       return true;
    }
 
    template<class CharT>
- void * priv_generic_named_construct(std::size_t type,
+ void * priv_generic_named_construct(unsigned char type,
                                const CharT *name,
- std::size_t num,
+ size_type num,
                                bool try2find,
                                bool dothrow,
                                detail::in_place_interface &table,
@@ -1074,10 +1078,10 @@
                                detail::true_ is_intrusive)
    {
       (void)is_intrusive;
- std::size_t namelen = std::char_traits<CharT>::length(name);
+ std::size_t namelen = std::char_traits<CharT>::length(name);
 
- block_header_t block_info ( table.size*num
- , table.alignment
+ block_header_t block_info ( size_type(table.size*num)
+ , size_type(table.alignment)
                                  , type
                                  , sizeof(CharT)
                                  , namelen);
@@ -1139,11 +1143,11 @@
       //Check if there is enough memory
       if(dothrow){
          buffer_ptr = this->allocate
- (block_info.total_size_with_header<intrusive_value_type>());
+ (block_info.template total_size_with_header<intrusive_value_type>());
       }
       else{
          buffer_ptr = this->allocate
- (block_info.total_size_with_header<intrusive_value_type>(), std::nothrow_t());
+ (block_info.template total_size_with_header<intrusive_value_type>(), std::nothrow_t());
          if(!buffer_ptr)
             return 0;
       }
@@ -1193,9 +1197,9 @@
    //!Generic named new function for
    //!named functions
    template<class CharT>
- void * priv_generic_named_construct(std::size_t type,
+ void * priv_generic_named_construct(unsigned char type,
                                const CharT *name,
- std::size_t num,
+ size_type num,
                                bool try2find,
                                bool dothrow,
                                detail::in_place_interface &table,
@@ -1205,8 +1209,8 @@
       (void)is_intrusive;
       std::size_t namelen = std::char_traits<CharT>::length(name);
 
- block_header_t block_info ( table.size*num
- , table.alignment
+ block_header_t block_info ( size_type(table.size*num)
+ , size_type(table.alignment)
                                  , type
                                  , sizeof(CharT)
                                  , namelen);
@@ -1266,7 +1270,7 @@
 
       //Allocate and construct the headers
       if(is_node_index_t::value){
- std::size_t total_size = block_info.total_size_with_header<index_it>();
+ size_type total_size = block_info.template total_size_with_header<index_it>();
          if(dothrow){
             buffer_ptr = this->allocate(total_size);
          }
@@ -1276,7 +1280,7 @@
                return 0;
          }
          index_it *idr = new(buffer_ptr) index_it(it);
- hdr = block_header_t::from_first_header<index_it>(idr);
+ hdr = block_header_t::template from_first_header<index_it>(idr);
       }
       else{
          if(dothrow){

Modified: branches/release/boost/interprocess/shared_memory_object.hpp
==============================================================================
--- branches/release/boost/interprocess/shared_memory_object.hpp (original)
+++ branches/release/boost/interprocess/shared_memory_object.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -53,7 +53,7 @@
 {
    /// @cond
    //Non-copyable and non-assignable
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(shared_memory_object)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(shared_memory_object)
    /// @endcond
 
    public:
@@ -79,14 +79,14 @@
    //!Moves the ownership of "moved"'s shared memory object to *this.
    //!After the call, "moved" does not represent any shared memory object.
    //!Does not throw
- shared_memory_object(BOOST_INTERPROCESS_RV_REF(shared_memory_object) moved)
+ shared_memory_object(BOOST_RV_REF(shared_memory_object) moved)
       : m_handle(file_handle_t(detail::invalid_file()))
    { this->swap(moved); }
 
    //!Moves the ownership of "moved"'s shared memory to *this.
    //!After the call, "moved" does not represent any shared memory.
    //!Does not throw
- shared_memory_object &operator=(BOOST_INTERPROCESS_RV_REF(shared_memory_object) moved)
+ shared_memory_object &operator=(BOOST_RV_REF(shared_memory_object) moved)
    {
       shared_memory_object tmp(boost::interprocess::move(moved));
       this->swap(tmp);

Modified: branches/release/boost/interprocess/smart_ptr/enable_shared_from_this.hpp
==============================================================================
--- branches/release/boost/interprocess/smart_ptr/enable_shared_from_this.hpp (original)
+++ branches/release/boost/interprocess/smart_ptr/enable_shared_from_this.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -14,8 +14,8 @@
 #ifndef BOOST_INTERPROCESS_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
 #define BOOST_INTERPROCESS_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
 
-#include <boost/interprocess/detail/workaround.hpp>
 #include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
 
 #include <boost/assert.hpp>
 #include <boost/interprocess/smart_ptr/weak_ptr.hpp>

Modified: branches/release/boost/interprocess/smart_ptr/shared_ptr.hpp
==============================================================================
--- branches/release/boost/interprocess/smart_ptr/shared_ptr.hpp (original)
+++ branches/release/boost/interprocess/smart_ptr/shared_ptr.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -108,7 +108,7 @@
    typedef typename boost::pointer_to_other
             <typename VoidAllocator::pointer, const VoidAllocator>::type const_allocator_pointer;
 
- BOOST_INTERPROCESS_COPYABLE_AND_MOVABLE(shared_ptr)
+ BOOST_COPYABLE_AND_MOVABLE(shared_ptr)
    public:
 
    //!Constructs an empty shared_ptr.
@@ -156,7 +156,7 @@
    //!Move-Constructs a shared_ptr that takes ownership of other resource and
    //!other is put in default-constructed state.
    //!Throws: nothing.
- explicit shared_ptr(BOOST_INTERPROCESS_RV_REF(shared_ptr) other)
+ explicit shared_ptr(BOOST_RV_REF(shared_ptr) other)
       : m_pn()
    { this->swap(other); }
 
@@ -195,7 +195,7 @@
 
    //!Equivalent to shared_ptr(r).swap(*this).
    //!Never throws
- shared_ptr & operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(shared_ptr) r)
+ shared_ptr & operator=(BOOST_COPY_ASSIGN_REF(shared_ptr) r)
    {
       m_pn = r.m_pn; // shared_count::op= doesn't throw
       return *this;
@@ -203,7 +203,7 @@
 
    //!Move-assignment. Equivalent to shared_ptr(other).swap(*this).
    //!Never throws
- shared_ptr & operator=(BOOST_INTERPROCESS_RV_REF(shared_ptr) other) // never throws
+ shared_ptr & operator=(BOOST_RV_REF(shared_ptr) other) // never throws
    {
       this_type(other).swap(*this);
       return *this;
@@ -368,6 +368,27 @@
    );
 }
 
+//!Returns an instance of a shared pointer constructed
+//!with the default allocator and deleter from a pointer
+//!of type T that has been allocated in the passed managed segment.
+//!Does not throw, return null shared pointer in error.
+template<class T, class ManagedMemory>
+inline typename managed_shared_ptr<T, ManagedMemory>::type
+ make_managed_shared_ptr(T *constructed_object, ManagedMemory &managed_memory, std::nothrow_t)
+{
+ try{
+ return typename managed_shared_ptr<T, ManagedMemory>::type
+ ( constructed_object
+ , managed_memory.template get_allocator<void>()
+ , managed_memory.template get_deleter<T>()
+ );
+ }
+ catch(...){
+ return typename managed_shared_ptr<T, ManagedMemory>::type();
+ }
+}
+
+
 } // namespace interprocess
 
 /// @cond

Modified: branches/release/boost/interprocess/smart_ptr/unique_ptr.hpp
==============================================================================
--- branches/release/boost/interprocess/smart_ptr/unique_ptr.hpp (original)
+++ branches/release/boost/interprocess/smart_ptr/unique_ptr.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -151,7 +151,7 @@
    //!deleter() and u.get_deleter() both reference the same lvalue deleter.
    //!
    //!Throws: nothing.
- unique_ptr(BOOST_INTERPROCESS_RV_REF(unique_ptr) u)
+ unique_ptr(BOOST_RV_REF(unique_ptr) u)
       : ptr_(u.release(), boost::interprocess::forward<D>(u.get_deleter()))
    {}
 
@@ -175,7 +175,7 @@
    //!
    //!Throws: nothing.
    template <class U, class E>
- unique_ptr(BOOST_INTERPROCESS_RV_REF_2_TEMPL_ARGS(unique_ptr, U, E) u,
+ unique_ptr(BOOST_RV_REF_2_TEMPL_ARGS(unique_ptr, U, E) u,
       typename detail::enable_if_c<
             detail::is_convertible<typename unique_ptr<U, E>::pointer, pointer>::value &&
             detail::is_convertible<E, D>::value &&
@@ -208,7 +208,7 @@
    //!Returns: *this.
    //!
    //!Throws: nothing.
- unique_ptr& operator=(BOOST_INTERPROCESS_RV_REF(unique_ptr) u)
+ unique_ptr& operator=(BOOST_RV_REF(unique_ptr) u)
    {
       reset(u.release());
       ptr_.second() = boost::interprocess::move(u.get_deleter());
@@ -230,7 +230,7 @@
    //!
    //!Throws: nothing.
    template <class U, class E>
- unique_ptr& operator=(BOOST_INTERPROCESS_RV_REF_2_TEMPL_ARGS(unique_ptr, U, E) u)
+ 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());
@@ -325,7 +325,7 @@
    /// @cond
    private:
    boost::compressed_pair<pointer, D> ptr_;
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(unique_ptr)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(unique_ptr)
    template <class U, class E> unique_ptr(unique_ptr<U, E>&);
    template <class U> unique_ptr(U&, typename detail::unique_ptr_error<U>::type = 0);
    

Modified: branches/release/boost/interprocess/sync/emulation/mutex.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/emulation/mutex.hpp (original)
+++ branches/release/boost/interprocess/sync/emulation/mutex.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -111,4 +111,6 @@
 } //namespace interprocess {
 } //namespace boost {
 
+#include <boost/interprocess/detail/config_end.hpp>
+
 #endif //BOOST_INTERPROCESS_DETAIL_EMULATION_MUTEX_HPP

Modified: branches/release/boost/interprocess/sync/file_lock.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/file_lock.hpp (original)
+++ branches/release/boost/interprocess/sync/file_lock.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -39,7 +39,7 @@
 {
    /// @cond
    //Non-copyable
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(file_lock)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(file_lock)
    /// @endcond
 
    public:
@@ -56,14 +56,14 @@
    //!Moves the ownership of "moved"'s file mapping object to *this.
    //!After the call, "moved" does not represent any file mapping object.
    //!Does not throw
- file_lock(BOOST_INTERPROCESS_RV_REF(file_lock) moved)
+ file_lock(BOOST_RV_REF(file_lock) moved)
       : m_file_hnd(file_handle_t(detail::invalid_file()))
    { this->swap(moved); }
 
    //!Moves the ownership of "moved"'s file mapping to *this.
    //!After the call, "moved" does not represent any file mapping.
    //!Does not throw
- file_lock &operator=(BOOST_INTERPROCESS_RV_REF(file_lock) moved)
+ file_lock &operator=(BOOST_RV_REF(file_lock) moved)
    {
       file_lock tmp(boost::interprocess::move(moved));
       this->swap(tmp);

Modified: branches/release/boost/interprocess/sync/posix/semaphore_wrapper.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/posix/semaphore_wrapper.hpp (original)
+++ branches/release/boost/interprocess/sync/posix/semaphore_wrapper.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -103,7 +103,7 @@
       #else
       detail::tmp_filename(semname, sem_str);
       #endif
- return 0 != sem_unlink(sem_str.c_str());
+ return 0 == sem_unlink(sem_str.c_str());
    }
    catch(...){
       return false;

Modified: branches/release/boost/interprocess/sync/scoped_lock.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/scoped_lock.hpp (original)
+++ branches/release/boost/interprocess/sync/scoped_lock.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -53,7 +53,7 @@
    /// @cond
    private:
    typedef scoped_lock<Mutex> this_type;
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(scoped_lock)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(scoped_lock)
    typedef bool this_type::*unspecified_bool_type;
    /// @endcond
    public:
@@ -123,7 +123,7 @@
    //! can be moved with the expression: "boost::interprocess::move(lock);". This
    //! constructor does not alter the state of the mutex, only potentially
    //! who owns it.
- scoped_lock(BOOST_INTERPROCESS_RV_REF(scoped_lock) scop)
+ scoped_lock(BOOST_RV_REF(scoped_lock) scop)
       : mp_mutex(0), m_locked(scop.owns())
    { mp_mutex = scop.release(); }
 
@@ -140,7 +140,7 @@
    //! other threads hold a sharable_lock on this mutex (sharable_lock's can
    //! share ownership with an upgradable_lock).
    template<class T>
- explicit scoped_lock(BOOST_INTERPROCESS_RV_REF(upgradable_lock<T>) upgr
+ explicit scoped_lock(BOOST_RV_REF(upgradable_lock<T>) upgr
       , typename detail::enable_if< detail::is_same<T, Mutex> >::type * = 0)
       : mp_mutex(0), m_locked(false)
    {
@@ -168,7 +168,7 @@
    //! If the "read lock" is held, then mutex transfer occurs only if it can
    //! do so in a non-blocking manner.
    template<class T>
- scoped_lock(BOOST_INTERPROCESS_RV_REF(upgradable_lock<T>) upgr, try_to_lock_type
+ scoped_lock(BOOST_RV_REF(upgradable_lock<T>) upgr, try_to_lock_type
          , typename detail::enable_if< detail::is_same<T, Mutex> >::type * = 0)
       : mp_mutex(0), m_locked(false)
    {
@@ -198,7 +198,7 @@
    //! merely changes type to an unlocked "write lock". If the "read lock" is held,
    //! then mutex transfer occurs only if it can do so in a non-blocking manner.
    template<class T>
- scoped_lock(BOOST_INTERPROCESS_RV_REF(upgradable_lock<T>) upgr, boost::posix_time::ptime &abs_time
+ scoped_lock(BOOST_RV_REF(upgradable_lock<T>) upgr, boost::posix_time::ptime &abs_time
                , typename detail::enable_if< detail::is_same<T, Mutex> >::type * = 0)
       : mp_mutex(0), m_locked(false)
    {
@@ -229,7 +229,7 @@
    //! If the "read lock" is held, then mutex transfer occurs only if it can
    //! do so in a non-blocking manner.
    template<class T>
- scoped_lock(BOOST_INTERPROCESS_RV_REF(sharable_lock<T>) shar, try_to_lock_type
+ scoped_lock(BOOST_RV_REF(sharable_lock<T>) shar, try_to_lock_type
       , typename detail::enable_if< detail::is_same<T, Mutex> >::type * = 0)
       : mp_mutex(0), m_locked(false)
    {
@@ -258,7 +258,7 @@
    //! the same mutex before the assignment. In this case, this will own the
    //! mutex after the assignment (and scop will not), but the mutex's lock
    //! count will be decremented by one.
- scoped_lock &operator=(BOOST_INTERPROCESS_RV_REF(scoped_lock) scop)
+ scoped_lock &operator=(BOOST_RV_REF(scoped_lock) scop)
    {
       if(this->owns())
          this->unlock();

Modified: branches/release/boost/interprocess/sync/sharable_lock.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/sharable_lock.hpp (original)
+++ branches/release/boost/interprocess/sync/sharable_lock.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -56,7 +56,7 @@
    typedef sharable_lock<SharableMutex> this_type;
    explicit sharable_lock(scoped_lock<mutex_type>&);
    typedef bool this_type::*unspecified_bool_type;
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(sharable_lock)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(sharable_lock)
    /// @endcond
    public:
 
@@ -124,7 +124,7 @@
    //! 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,
    //! only potentially who owns it.
- sharable_lock(BOOST_INTERPROCESS_RV_REF(sharable_lock<mutex_type>) upgr)
+ sharable_lock(BOOST_RV_REF(sharable_lock<mutex_type>) upgr)
       : mp_mutex(0), m_locked(upgr.owns())
    { mp_mutex = upgr.release(); }
 
@@ -138,7 +138,7 @@
    //! signature. An non-moved upgradable_lock can be moved with the expression:
    //! "boost::interprocess::move(lock);".*/
    template<class T>
- sharable_lock(BOOST_INTERPROCESS_RV_REF(upgradable_lock<T>) upgr
+ sharable_lock(BOOST_RV_REF(upgradable_lock<T>) upgr
       , typename detail::enable_if< detail::is_same<T, SharableMutex> >::type * = 0)
       : mp_mutex(0), m_locked(false)
    {
@@ -161,7 +161,7 @@
    //! signature. An non-moved scoped_lock can be moved with the expression:
    //! "boost::interprocess::move(lock);".
    template<class T>
- sharable_lock(BOOST_INTERPROCESS_RV_REF(scoped_lock<T>) scop
+ sharable_lock(BOOST_RV_REF(scoped_lock<T>) scop
                , typename detail::enable_if< detail::is_same<T, SharableMutex> >::type * = 0)
       : mp_mutex(0), m_locked(false)
    {
@@ -188,7 +188,7 @@
    //!Notes: With a recursive mutex it is possible that both this and upgr own the mutex
    //! before the assignment. In this case, this will own the mutex after the assignment
    //! (and upgr will not), but the mutex's lock count will be decremented by one.
- sharable_lock &operator=(BOOST_INTERPROCESS_RV_REF(sharable_lock<mutex_type>) upgr)
+ sharable_lock &operator=(BOOST_RV_REF(sharable_lock<mutex_type>) upgr)
    {
       if(this->owns())
          this->unlock();

Modified: branches/release/boost/interprocess/sync/upgradable_lock.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/upgradable_lock.hpp (original)
+++ branches/release/boost/interprocess/sync/upgradable_lock.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -57,7 +57,7 @@
    typedef upgradable_lock<UpgradableMutex> this_type;
    explicit upgradable_lock(scoped_lock<mutex_type>&);
    typedef bool this_type::*unspecified_bool_type;
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(upgradable_lock)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(upgradable_lock)
    /// @endcond
    public:
 
@@ -119,7 +119,7 @@
    //! signature. An non-moved upgradable_lock can be moved with the
    //! expression: "boost::interprocess::move(lock);". This constructor does not alter the
    //! state of the mutex, only potentially who owns it.
- upgradable_lock(BOOST_INTERPROCESS_RV_REF(upgradable_lock<mutex_type>) upgr)
+ upgradable_lock(BOOST_RV_REF(upgradable_lock<mutex_type>) upgr)
       : mp_mutex(0), m_locked(upgr.owns())
    { mp_mutex = upgr.release(); }
 
@@ -133,7 +133,7 @@
    //! signature. An non-moved sharable_lock can be moved with the
    //! expression: "boost::interprocess::move(lock);".
    template<class T>
- upgradable_lock(BOOST_INTERPROCESS_RV_REF(scoped_lock<T>) scop
+ upgradable_lock(BOOST_RV_REF(scoped_lock<T>) scop
                   , typename detail::enable_if< detail::is_same<T, UpgradableMutex> >::type * = 0)
       : mp_mutex(0), m_locked(false)
    {
@@ -161,7 +161,7 @@
    //! "upgradable lock". If the "read lock" is held, then mutex transfer
    //! occurs only if it can do so in a non-blocking manner.
    template<class T>
- upgradable_lock( BOOST_INTERPROCESS_RV_REF(sharable_lock<T>) shar, try_to_lock_type
+ upgradable_lock( BOOST_RV_REF(sharable_lock<T>) shar, try_to_lock_type
                   , typename detail::enable_if< detail::is_same<T, UpgradableMutex> >::type * = 0)
       : mp_mutex(0), m_locked(false)
    {
@@ -192,7 +192,7 @@
    //! mutex before the assignment. In this case, this will own the mutex
    //! after the assignment (and upgr will not), but the mutex's upgradable lock
    //! count will be decremented by one.
- upgradable_lock &operator=(BOOST_INTERPROCESS_RV_REF(upgradable_lock) upgr)
+ upgradable_lock &operator=(BOOST_RV_REF(upgradable_lock) upgr)
    {
       if(this->owns())
          this->unlock();

Modified: branches/release/boost/interprocess/sync/xsi/simple_xsi_semaphore.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/xsi/simple_xsi_semaphore.hpp (original)
+++ branches/release/boost/interprocess/sync/xsi/simple_xsi_semaphore.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -1,3 +1,12 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
 #ifndef BOOST_INTERPROCESS_SYNC_XSI_SIMPLE_XSI_SEMAPHORE_HPP
 #define BOOST_INTERPROCESS_SYNC_XSI_SIMPLE_XSI_SEMAPHORE_HPP
 
@@ -103,3 +112,5 @@
 } //namespace xsi {
 } //namespace interprocess {
 } //namespace boost {
+
+#endif //BOOST_INTERPROCESS_SYNC_XSI_SIMPLE_XSI_SEMAPHORE_HPP

Modified: branches/release/boost/interprocess/sync/xsi/xsi_named_mutex.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/xsi/xsi_named_mutex.hpp (original)
+++ branches/release/boost/interprocess/sync/xsi/xsi_named_mutex.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 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)
 //
@@ -49,7 +49,7 @@
    /// @endcond
 
    public:
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(xsi_named_mutex)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(xsi_named_mutex)
 
    //!Default constructor.
    //!Represents an empty xsi_named_mutex.
@@ -65,13 +65,13 @@
    //!Moves the ownership of "moved"'s named mutex to *this.
    //!After the call, "moved" does not represent any named mutex
    //!Does not throw
- xsi_named_mutex(BOOST_INTERPROCESS_RV_REF(xsi_named_mutex) moved)
+ xsi_named_mutex(BOOST_RV_REF(xsi_named_mutex) moved)
    { this->swap(moved); }
 
    //!Moves the ownership of "moved"'s named mutex to *this.
    //!After the call, "moved" does not represent any named mutex.
    //!Does not throw
- xsi_named_mutex &operator=(BOOST_INTERPROCESS_RV_REF(xsi_named_mutex) moved)
+ xsi_named_mutex &operator=(BOOST_RV_REF(xsi_named_mutex) moved)
    {
       xsi_named_mutex tmp(boost::interprocess::move(moved));
       this->swap(tmp);

Modified: branches/release/boost/interprocess/windows_shared_memory.hpp
==============================================================================
--- branches/release/boost/interprocess/windows_shared_memory.hpp (original)
+++ branches/release/boost/interprocess/windows_shared_memory.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -52,7 +52,7 @@
 {
    /// @cond
    //Non-copyable and non-assignable
- BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(windows_shared_memory)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(windows_shared_memory)
    /// @endcond
 
    public:
@@ -80,14 +80,14 @@
    //!Moves the ownership of "moved"'s shared memory object to *this.
    //!After the call, "moved" does not represent any shared memory object.
    //!Does not throw
- windows_shared_memory(BOOST_INTERPROCESS_RV_REF(windows_shared_memory) moved)
+ windows_shared_memory(BOOST_RV_REF(windows_shared_memory) moved)
       : m_handle(0)
    { this->swap(moved); }
 
    //!Moves the ownership of "moved"'s shared memory to *this.
    //!After the call, "moved" does not represent any shared memory.
    //!Does not throw
- windows_shared_memory &operator=(BOOST_INTERPROCESS_RV_REF(windows_shared_memory) moved)
+ windows_shared_memory &operator=(BOOST_RV_REF(windows_shared_memory) moved)
    {
       windows_shared_memory tmp(boost::interprocess::move(moved));
       this->swap(tmp);

Modified: branches/release/boost/intrusive/avl_set.hpp
==============================================================================
--- branches/release/boost/intrusive/avl_set.hpp (original)
+++ branches/release/boost/intrusive/avl_set.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -16,6 +16,7 @@
 #include <boost/intrusive/intrusive_fwd.hpp>
 #include <boost/intrusive/avltree.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
+#include <boost/move/move.hpp>
 #include <iterator>
 
 namespace boost {
@@ -42,12 +43,8 @@
    /// @cond
    typedef avltree_impl<Config> tree_type;
    //! This class is
- //! non-copyable
- avl_set_impl (const avl_set_impl&);
-
- //! This class is
- //! non-assignable
- avl_set_impl &operator =(const avl_set_impl&);
+ //! movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_set_impl)
 
    typedef tree_type implementation_defined;
    /// @endcond
@@ -113,6 +110,17 @@
       : tree_(true, b, e, cmp, v_traits)
    {}
 
+ //! <b>Effects</b>: to-do
+ //!
+ avl_set_impl(BOOST_RV_REF(avl_set_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ avl_set_impl& operator=(BOOST_RV_REF(avl_set_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the avl_set
    //! are not deleted (i.e. no destructors are called).
    //!
@@ -1181,6 +1189,7 @@
       #endif
       ::type Base;
 
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_set)
    public:
    typedef typename Base::value_compare value_compare;
    typedef typename Base::value_traits value_traits;
@@ -1202,6 +1211,13 @@
       : Base(b, e, cmp, v_traits)
    {}
 
+ avl_set(BOOST_RV_REF(avl_set) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ avl_set& operator=(BOOST_RV_REF(avl_set) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
    static avl_set &container_from_end_iterator(iterator end_iterator)
    { return static_cast<avl_set &>(Base::container_from_end_iterator(end_iterator)); }
 
@@ -1238,9 +1254,8 @@
    /// @cond
    typedef avltree_impl<Config> tree_type;
 
- //Non-copyable and non-assignable
- avl_multiset_impl (const avl_multiset_impl&);
- avl_multiset_impl &operator =(const avl_multiset_impl&);
+ //Movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_multiset_impl)
    typedef tree_type implementation_defined;
    /// @endcond
 
@@ -1305,6 +1320,17 @@
       : tree_(false, b, e, cmp, v_traits)
    {}
 
+ //! <b>Effects</b>: to-do
+ //!
+ avl_multiset_impl(BOOST_RV_REF(avl_multiset_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ avl_multiset_impl& operator=(BOOST_RV_REF(avl_multiset_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the avl_multiset
    //! are not deleted (i.e. no destructors are called).
    //!
@@ -2280,6 +2306,7 @@
       #endif
       ::type Base;
 
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_multiset)
    public:
    typedef typename Base::value_compare value_compare;
    typedef typename Base::value_traits value_traits;
@@ -2301,6 +2328,13 @@
       : Base(b, e, cmp, v_traits)
    {}
 
+ avl_multiset(BOOST_RV_REF(avl_multiset) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ avl_multiset& operator=(BOOST_RV_REF(avl_multiset) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
    static avl_multiset &container_from_end_iterator(iterator end_iterator)
    { return static_cast<avl_multiset &>(Base::container_from_end_iterator(end_iterator)); }
 

Modified: branches/release/boost/intrusive/avltree.hpp
==============================================================================
--- branches/release/boost/intrusive/avltree.hpp (original)
+++ branches/release/boost/intrusive/avltree.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -32,6 +32,7 @@
 #include <boost/intrusive/options.hpp>
 #include <boost/intrusive/avltree_algorithms.hpp>
 #include <boost/intrusive/link_mode.hpp>
+#include <boost/move/move.hpp>
 
 namespace boost {
 namespace intrusive {
@@ -122,9 +123,8 @@
    private:
    typedef detail::size_holder<constant_time_size, size_type> size_traits;
 
- //noncopyable
- avltree_impl (const avltree_impl&);
- avltree_impl operator =(const avltree_impl&);
+ //noncopyable, movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(avltree_impl)
 
    enum { safemode_or_autounlink =
             (int)real_value_traits::link_mode == (int)auto_unlink ||
@@ -159,6 +159,12 @@
    value_compare &priv_comp()
    { return data_.node_plus_pred_.get(); }
 
+ const value_traits &priv_value_traits() const
+ { return data_; }
+
+ value_traits &priv_value_traits()
+ { return data_; }
+
    const node &priv_header() const
    { return data_.node_plus_pred_.header_plus_size_.header_; }
 
@@ -241,6 +247,21 @@
          this->insert_equal(b, e);
    }
 
+ //! <b>Effects</b>: to-do
+ //!
+ 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());
+ this->priv_size_traits().set_size(size_type(0));
+ this->swap(x);
+ }
+
+ //! <b>Effects</b>: to-do
+ //!
+ avltree_impl& operator=(BOOST_RV_REF(avltree_impl) x)
+ { this->swap(x); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the set
    //! are not deleted (i.e. no destructors are called), but the nodes according to
    //! the value_traits template parameter are reinitialized and thus can be reused.
@@ -1274,6 +1295,8 @@
       node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this)
                                    , node_ptr(&priv_header())
                                    , get_real_value_traits().to_node_ptr(with_this));
+ if(safemode_or_autounlink)
+ node_algorithms::init(replace_this.pointed_node());
    }
 
    //! <b>Requires</b>: value must be an lvalue and shall be in a set of
@@ -1604,6 +1627,8 @@
    #endif
       ::type Base;
 
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(avltree)
+
    public:
    typedef typename Base::value_compare value_compare;
    typedef typename Base::value_traits value_traits;
@@ -1626,6 +1651,13 @@
       : Base(unique, b, e, cmp, v_traits)
    {}
 
+ avltree(BOOST_RV_REF(avltree) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ avltree& operator=(BOOST_RV_REF(avltree) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
    static avltree &container_from_end_iterator(iterator end_iterator)
    { return static_cast<avltree &>(Base::container_from_end_iterator(end_iterator)); }
 

Modified: branches/release/boost/intrusive/detail/hashtable_node.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/hashtable_node.hpp (original)
+++ branches/release/boost/intrusive/detail/hashtable_node.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -23,6 +23,9 @@
 #include <boost/intrusive/detail/slist_node.hpp> //remove-me
 #include <cstddef>
 #include <boost/pointer_cast.hpp>
+#include <boost/move/move.hpp>
+
+
 namespace boost {
 namespace intrusive {
 namespace detail {
@@ -76,6 +79,10 @@
 template<class Slist>
 struct bucket_traits_impl
 {
+ private:
+ BOOST_COPYABLE_AND_MOVABLE(bucket_traits_impl)
+
+ public:
    /// @cond
    typedef typename boost::pointer_to_other
       < typename Slist::pointer, bucket_impl<Slist> >::type bucket_ptr;
@@ -86,6 +93,21 @@
       : buckets_(buckets), buckets_len_(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; }
+
+ 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;
+ }
+
+ bucket_traits_impl& operator=(BOOST_COPY_ASSIGN_REF(bucket_traits_impl) x)
+ {
+ buckets_ = x.buckets_; buckets_len_ = x.buckets_len_; return *this;
+ }
+
    bucket_ptr bucket_begin() const
    { return buckets_; }
 

Modified: branches/release/boost/intrusive/detail/mpl.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/mpl.hpp (original)
+++ branches/release/boost/intrusive/detail/mpl.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -138,6 +138,10 @@
 struct is_unary_or_binary_function_impl
 { static const bool value = false; };
 
+// see boost ticket #4094
+// avoid duplicate definitions of is_unary_or_binary_function_impl
+#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
+
 template <typename R>
 struct is_unary_or_binary_function_impl<R (*)()>
 { static const bool value = true; };
@@ -145,19 +149,11 @@
 template <typename R>
 struct is_unary_or_binary_function_impl<R (*)(...)>
 { static const bool value = true; };
-/*
-#ifdef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
-
-template <typename R>
-struct is_unary_or_binary_function_impl<R (__stdcall*)()>
-{ static const bool value = true; };
 
-template <typename R>
-struct is_unary_or_binary_function_impl<R (__stdcall*)(...)>
-{ static const bool value = true; };
+#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
 
 template <typename R>
-struct is_unary_or_binary_function_impl<R (__stdcall*)(...)>
+struct is_unary_or_binary_function_impl<R (__stdcall*)()>
 { static const bool value = true; };
 
 template <typename R>
@@ -165,18 +161,19 @@
 { static const bool value = true; };
 
 template <typename R>
-struct is_unary_or_binary_function_impl<R (__fastcall*)(...)>
-{ static const bool value = true; };
-
-template <typename R>
 struct is_unary_or_binary_function_impl<R (__cdecl*)()>
 { static const bool value = true; };
 
 template <typename R>
 struct is_unary_or_binary_function_impl<R (__cdecl*)(...)>
 { static const bool value = true; };
+
 #endif
-*/
+
+// see boost ticket #4094
+// avoid duplicate definitions of is_unary_or_binary_function_impl
+#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
+
 template <typename R, class T0>
 struct is_unary_or_binary_function_impl<R (*)(T0)>
 { static const bool value = true; };
@@ -185,34 +182,30 @@
 struct is_unary_or_binary_function_impl<R (*)(T0...)>
 { static const bool value = true; };
 
-#ifdef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
+#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
 
 template <typename R, class T0>
 struct is_unary_or_binary_function_impl<R (__stdcall*)(T0)>
 { static const bool value = true; };
-/*
-template <typename R, class T0>
-struct is_unary_or_binary_function_impl<R (__stdcall*)(T0...)>
-{ static const bool value = true; };
 
 template <typename R, class T0>
 struct is_unary_or_binary_function_impl<R (__fastcall*)(T0)>
 { static const bool value = true; };
 
 template <typename R, class T0>
-struct is_unary_or_binary_function_impl<R (__fastcall*)(T0...)>
-{ static const bool value = true; };
-
-template <typename R, class T0>
 struct is_unary_or_binary_function_impl<R (__cdecl*)(T0)>
 { static const bool value = true; };
 
 template <typename R, class T0>
 struct is_unary_or_binary_function_impl<R (__cdecl*)(T0...)>
 { static const bool value = true; };
-*/
+
 #endif
 
+// see boost ticket #4094
+// avoid duplicate definitions of is_unary_or_binary_function_impl
+#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
+
 template <typename R, class T0, class T1>
 struct is_unary_or_binary_function_impl<R (*)(T0, T1)>
 { static const bool value = true; };
@@ -220,15 +213,11 @@
 template <typename R, class T0, class T1>
 struct is_unary_or_binary_function_impl<R (*)(T0, T1...)>
 { static const bool value = true; };
-/*
-#ifdef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
 
-template <typename R, class T0, class T1>
-struct is_unary_or_binary_function_impl<R (__stdcall*)(T0, T1)>
-{ static const bool value = true; };
+#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
 
 template <typename R, class T0, class T1>
-struct is_unary_or_binary_function_impl<R (__stdcall*)(T0, T1...)>
+struct is_unary_or_binary_function_impl<R (__stdcall*)(T0, T1)>
 { static const bool value = true; };
 
 template <typename R, class T0, class T1>
@@ -236,10 +225,6 @@
 { static const bool value = true; };
 
 template <typename R, class T0, class T1>
-struct is_unary_or_binary_function_impl<R (__fastcall*)(T0, T1...)>
-{ static const bool value = true; };
-
-template <typename R, class T0, class T1>
 struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1)>
 { static const bool value = true; };
 
@@ -247,7 +232,7 @@
 struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1...)>
 { static const bool value = true; };
 #endif
-*/
+
 template <typename T>
 struct is_unary_or_binary_function_impl<T&>
 { static const bool value = false; };

Modified: branches/release/boost/intrusive/detail/utilities.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/utilities.hpp (original)
+++ branches/release/boost/intrusive/detail/utilities.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -207,32 +207,33 @@
    : private detail::ebo_functor_holder<KeyValueCompare>
 {
    typedef typename Container::real_value_traits real_value_traits;
+ typedef typename Container::value_type value_type;
    typedef typename real_value_traits::node_ptr node_ptr;
    typedef typename real_value_traits::const_node_ptr const_node_ptr;
    typedef detail::ebo_functor_holder<KeyValueCompare> base_t;
    key_nodeptr_comp(KeyValueCompare kcomp, const Container *cont)
       : base_t(kcomp), cont_(cont)
    {}
+
+ template<class T>
+ struct is_node_ptr
+ {
+ static const bool value = is_same<T, const_node_ptr>::value || is_same<T, node_ptr>::value;
+ };
 
- template<class KeyType>
- bool operator()( const_node_ptr node, const KeyType &key
- , typename enable_if_c
- <!is_convertible<KeyType, const_node_ptr>::value>::type * = 0) const
- { return base_t::get()(*cont_->get_real_value_traits().to_value_ptr(node), key); }
-
- template<class KeyType>
- bool operator()(const KeyType &key, const_node_ptr node
- , typename enable_if_c
- <!is_convertible<KeyType, const_node_ptr>::value>::type * = 0) const
- { return base_t::get()(key, *cont_->get_real_value_traits().to_value_ptr(node)); }
-
- bool operator()(const_node_ptr node1, const_node_ptr node2) const
- {
- return base_t::get()
- ( *cont_->get_real_value_traits().to_value_ptr(node1)
- , *cont_->get_real_value_traits().to_value_ptr(node2)
- );
- }
+ template<class T>
+ typename enable_if_c<is_node_ptr<T>::value, const value_type &>::type
+ key_forward(const T &node) const
+ { return *cont_->get_real_value_traits().to_value_ptr(node); }
+
+ template<class T>
+ typename enable_if_c<!is_node_ptr<T>::value, const T &>::type
+ key_forward(const T &key) const
+ { return key;}
+
+ template<class KeyType, class KeyType2>
+ bool operator()(const KeyType &key1, const KeyType2 &key2) const
+ { return base_t::get()(this->key_forward(key1), this->key_forward(key2)); }
 
    const Container *cont_;
 };

Modified: branches/release/boost/intrusive/hashtable.hpp
==============================================================================
--- branches/release/boost/intrusive/hashtable.hpp (original)
+++ branches/release/boost/intrusive/hashtable.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -37,6 +37,8 @@
 #include <boost/intrusive/unordered_set_hook.hpp>
 #include <boost/intrusive/slist.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
+#include <boost/type_traits.hpp>
+#include <boost/move/move.hpp>
 
 namespace boost {
 namespace intrusive {
@@ -123,7 +125,7 @@
       < typename NodeTraits::node
       , boost::intrusive::value_traits<trivial_traits>
       , boost::intrusive::constant_time_size<false>
- , boost::intrusive::size_type<std::size_t>
+ , boost::intrusive::size_type<typename boost::make_unsigned<typename std::iterator_traits<typename NodeTraits::node_ptr>::difference_type>::type>
>::type
    {};
 };
@@ -211,7 +213,7 @@
 
 template<class Config>
 struct bucket_plus_size
- : public detail::size_holder
+ : public detail::size_holder //size_traits
       < 0 != (Config::bool_flags & hash_bool_flags::constant_time_size_pos)
       , typename Config::size_type>
 {
@@ -220,15 +222,23 @@
       , typename Config::size_type> size_traits;
    typedef typename Config::bucket_traits bucket_traits;
 
- bucket_plus_size(const bucket_traits &b_traits)
- : bucket_traits_(b_traits)
+ template<class BucketTraits>
+ bucket_plus_size(BOOST_FWD_REF(BucketTraits) b_traits)
+ : bucket_traits_(::boost::forward<BucketTraits>(b_traits))
    {}
+
+ bucket_plus_size & operator =(const bucket_plus_size &x)
+ {
+ this->size_traits::operator=(x);
+ bucket_traits_ = x.bucket_traits_;
+ return *this;
+ }
    bucket_traits bucket_traits_;
 };
 
 template<class Config>
 struct bucket_hash_t
- : public detail::ebo_functor_holder<typename Config::hash>
+ : public detail::ebo_functor_holder<typename Config::hash> //hash
 {
    typedef typename Config::hash hasher;
    typedef detail::size_holder
@@ -236,22 +246,26 @@
       , typename Config::size_type> size_traits;
    typedef typename Config::bucket_traits bucket_traits;
 
- bucket_hash_t(const bucket_traits &b_traits, const hasher & h)
- : detail::ebo_functor_holder<hasher>(h), bucket_plus_size_(b_traits)
+ template<class BucketTraits>
+ bucket_hash_t(BOOST_FWD_REF(BucketTraits) b_traits, const hasher & h)
+ : detail::ebo_functor_holder<hasher>(h), bucket_plus_size_(::boost::forward<BucketTraits>(b_traits))
    {}
 
    bucket_plus_size<Config> bucket_plus_size_;
 };
 
 template<class Config, bool>
-struct bucket_hash_equal_t : public detail::ebo_functor_holder<typename Config::equal>
+struct bucket_hash_equal_t
+ : public detail::ebo_functor_holder<typename Config::equal>
 {
    typedef typename Config::equal equal;
    typedef typename Config::hash hasher;
    typedef typename Config::bucket_traits bucket_traits;
 
- bucket_hash_equal_t(const bucket_traits &b_traits, const hasher & h, const equal &e)
- : detail::ebo_functor_holder<typename Config::equal>(e), bucket_hash(b_traits, h)
+ template<class BucketTraits>
+ bucket_hash_equal_t(BOOST_FWD_REF(BucketTraits) b_traits, const hasher & h, const equal &e)
+ : detail::ebo_functor_holder<typename Config::equal>(e)//equal()
+ , bucket_hash(::boost::forward<BucketTraits>(b_traits), h)
    {}
    bucket_hash_t<Config> bucket_hash;
 };
@@ -266,8 +280,10 @@
    typedef typename unordered_bucket_ptr_impl
       <typename Config::value_traits>::type bucket_ptr;
 
- bucket_hash_equal_t(const bucket_traits &b_traits, const hasher & h, const equal &e)
- : detail::ebo_functor_holder<typename Config::equal>(e), bucket_hash(b_traits, h)
+ template<class BucketTraits>
+ bucket_hash_equal_t(BOOST_FWD_REF(BucketTraits) b_traits, const hasher & h, const equal &e)
+ : detail::ebo_functor_holder<typename Config::equal>(e) //equal()
+ , bucket_hash(::boost::forward<BucketTraits>(b_traits), h)
    {}
    bucket_hash_t<Config> bucket_hash;
    bucket_ptr cached_begin_;
@@ -282,22 +298,25 @@
    typedef typename Config::hash hasher;
    typedef typename Config::bucket_traits bucket_traits;
 
- hashtable_data_t( const bucket_traits &b_traits, const hasher & h
+ template<class BucketTraits>
+ hashtable_data_t( BOOST_FWD_REF(BucketTraits) b_traits, const hasher & h
                    , const equal &e, const value_traits &val_traits)
- : Config::value_traits(val_traits), internal_(b_traits, h, e)
+ : Config::value_traits(val_traits) //value_traits
+ , internal_(::boost::forward<BucketTraits>(b_traits), h, e)
    {}
    typedef typename detail::usetopt_mask
       < Config
       , detail::hash_bool_flags::constant_time_size_pos
- | detail::hash_bool_flags::incremental_pos
+ | detail::hash_bool_flags::incremental_pos
>::type masked_config_t;
    struct internal
- : public detail::size_holder
+ : public detail::size_holder //split_traits
          < 0 != (Config::bool_flags & hash_bool_flags::incremental_pos)
          , typename Config::size_type>
    {
- internal(const bucket_traits &b_traits, const hasher & h, const equal &e)
- : bucket_hash_equal_(b_traits, h, e)
+ template<class BucketTraits>
+ internal(BOOST_FWD_REF(BucketTraits) b_traits, const hasher & h, const equal &e)
+ : bucket_hash_equal_(::boost::forward<BucketTraits>(b_traits), h, e)
       {}
 
       bucket_hash_equal_t
@@ -706,9 +725,8 @@
    };
 
    private:
- //noncopyable
- hashtable_impl (const hashtable_impl&);
- hashtable_impl operator =(const hashtable_impl&);
+ //noncopyable, movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(hashtable_impl)
 
    enum { safemode_or_autounlink =
             (int)real_value_traits::link_mode == (int)auto_unlink ||
@@ -790,6 +808,33 @@
       priv_split_traits().set_size(bucket_size>>1);
    }
 
+ //! <b>Effects</b>: to-do
+ //!
+ hashtable_impl(BOOST_RV_REF(hashtable_impl) x)
+ : data_( ::boost::move(x.priv_bucket_traits())
+ , ::boost::move(x.priv_hasher())
+ , ::boost::move(x.priv_equal())
+ , ::boost::move(x.priv_value_traits())
+ )
+ {
+ priv_swap_cache(cache_begin_t(), x);
+ x.priv_initialize_cache();
+ if(constant_time_size){
+ this->priv_size_traits().set_size(size_type(0));
+ this->priv_size_traits().set_size(x.priv_size_traits().get_size());
+ x.priv_size_traits().set_size(size_type(0));
+ }
+ if(incremental){
+ this->priv_split_traits().set_size(x.priv_split_traits().get_size());
+ x.priv_split_traits().set_size(size_type(0));
+ }
+ }
+
+ //! <b>Effects</b>: to-do
+ //!
+ hashtable_impl& operator=(BOOST_RV_REF(hashtable_impl) x)
+ { this->swap(x); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_set
    //! are not deleted (i.e. no destructors are called).
    //!
@@ -934,14 +979,15 @@
       swap(this->priv_equal(), other.priv_equal());
       swap(this->priv_hasher(), other.priv_hasher());
       //These can't throw
- swap(this->priv_real_bucket_traits(), other.priv_real_bucket_traits());
+ swap(this->priv_bucket_traits(), other.priv_bucket_traits());
+ swap(this->priv_value_traits(), other.priv_value_traits());
       priv_swap_cache(cache_begin_t(), other);
       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());
          other.priv_size_traits().set_size(backup);
       }
- else if(incremental){
+ if(incremental){
          size_type backup = this->priv_split_traits().get_size();
          this->priv_split_traits().set_size(other.priv_split_traits().get_size());
          other.priv_split_traits().set_size(backup);
@@ -1677,7 +1723,8 @@
    //! <b>Throws</b>: If the internal hash function throws.
    const_iterator iterator_to(const_reference value) const
    {
- return const_iterator(bucket_type::s_iterator_to(priv_value_to_node(const_cast<reference>(value))), this);
+ siterator sit = bucket_type::s_iterator_to(const_cast<node &>(this->priv_value_to_node(value)));
+ return const_iterator(sit, this);
    }
 
    //! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
@@ -2147,7 +2194,7 @@
    {
       const std::size_t *primes = &detail::prime_list_holder<0>::prime_list[0];
       const std::size_t *primes_end = primes + detail::prime_list_holder<0>::prime_list_size;
- size_type const* bound = std::lower_bound(primes, primes_end, n);
+ std::size_t const* bound = std::lower_bound(primes, primes_end, n);
       if(bound == primes_end)
          --bound;
       return size_type(*bound);
@@ -2199,6 +2246,12 @@
    key_equal &priv_equal()
    { return static_cast<key_equal&>(this->data_.internal_.bucket_hash_equal_.get()); }
 
+ const value_traits &priv_value_traits() const
+ { return data_; }
+
+ value_traits &priv_value_traits()
+ { return data_; }
+
    value_type &priv_value_from_slist_node(slist_node_ptr n)
    { return *this->get_real_value_traits().to_value_ptr(dcast_bucket_ptr(n)); }
 
@@ -2223,6 +2276,12 @@
    real_bucket_traits &priv_real_bucket_traits()
    { return this->priv_real_bucket_traits(detail::bool_<external_bucket_traits>()); }
 
+ const bucket_traits &priv_bucket_traits() const
+ { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_; }
+
+ bucket_traits &priv_bucket_traits()
+ { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_; }
+
    const hasher &priv_hasher() const
    { return static_cast<const hasher&>(this->data_.internal_.bucket_hash_equal_.bucket_hash.get()); }
 
@@ -2987,6 +3046,7 @@
       Options...
       #endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(hashtable)
 
    public:
    typedef typename Base::value_traits value_traits;
@@ -3008,6 +3068,13 @@
              , const value_traits &v_traits = value_traits())
       : Base(b_traits, hash_func, equal_func, v_traits)
    {}
+
+ hashtable(BOOST_RV_REF(hashtable) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ hashtable& operator=(BOOST_RV_REF(hashtable) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
 };
 
 #endif

Modified: branches/release/boost/intrusive/list.hpp
==============================================================================
--- branches/release/boost/intrusive/list.hpp (original)
+++ branches/release/boost/intrusive/list.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -30,7 +30,7 @@
 #include <algorithm>
 #include <functional>
 #include <cstddef>
-//iG pending #include <boost/pointer_cast.hpp>
+#include <boost/move/move.hpp>
 
 namespace boost {
 namespace intrusive {
@@ -114,9 +114,8 @@
    private:
    typedef detail::size_holder<constant_time_size, size_type> size_traits;
 
- //Non-copyable and non-moveable
- list_impl (const list_impl&);
- list_impl &operator =(const list_impl&);
+ //noncopyable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(list_impl)
 
    enum { safemode_or_autounlink =
             (int)real_value_traits::link_mode == (int)auto_unlink ||
@@ -173,10 +172,10 @@
    real_value_traits &get_real_value_traits(detail::bool_<true>)
    { return data_.get_value_traits(*this); }
 
- const value_traits &get_value_traits() const
+ const value_traits &priv_value_traits() const
    { return data_; }
 
- value_traits &get_value_traits()
+ value_traits &priv_value_traits()
    { return data_; }
 
    protected:
@@ -229,6 +228,21 @@
       this->insert(this->cend(), b, e);
    }
 
+ //! <b>Effects</b>: to-do
+ //!
+ list_impl(BOOST_RV_REF(list_impl) x)
+ : data_(::boost::move(x.priv_value_traits()))
+ {
+ this->priv_size_traits().set_size(size_type(0));
+ node_algorithms::init_header(this->get_root_node());
+ this->swap(x);
+ }
+
+ //! <b>Effects</b>: to-do
+ //!
+ list_impl& operator=(BOOST_RV_REF(list_impl) x)
+ { this->swap(x); return *this; }
+
    //! <b>Effects</b>: If it's not a safe-mode or an auto-unlink value_type
    //! the destructor does nothing
    //! (ie. no code is generated). Otherwise it detaches all elements from this.
@@ -988,8 +1002,8 @@
    {
       if(node_traits::get_next(this->get_root_node())
          != node_traits::get_previous(this->get_root_node())){
- list_impl carry(this->get_value_traits());
- detail::array_initializer<list_impl, 64> counter(this->get_value_traits());
+ list_impl carry(this->priv_value_traits());
+ detail::array_initializer<list_impl, 64> counter(this->priv_value_traits());
          int fill = 0;
          while(!this->empty()){
             carry.splice(carry.cbegin(), *this, this->cbegin());
@@ -1473,6 +1487,8 @@
    typedef typename Base::real_value_traits real_value_traits;
    //Assert if passed value traits are compatible with the type
    BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value));
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(list)
+
    public:
    typedef typename Base::value_traits value_traits;
    typedef typename Base::iterator iterator;
@@ -1487,6 +1503,13 @@
       : Base(b, e, v_traits)
    {}
 
+ list(BOOST_RV_REF(list) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ list& operator=(BOOST_RV_REF(list) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
    static list &container_from_end_iterator(iterator end_iterator)
    { return static_cast<list &>(Base::container_from_end_iterator(end_iterator)); }
 

Modified: branches/release/boost/intrusive/options.hpp
==============================================================================
--- branches/release/boost/intrusive/options.hpp (original)
+++ branches/release/boost/intrusive/options.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -775,7 +775,7 @@
 struct do_pack<typelist<Prev, Others...> >
 {
    typedef typename Prev::template pack
- <typename do_pack<typelist<Others...>>::type> type;
+ <typename do_pack<typelist<Others...> >::type> type;
 };
 
 

Modified: branches/release/boost/intrusive/rbtree.hpp
==============================================================================
--- branches/release/boost/intrusive/rbtree.hpp (original)
+++ branches/release/boost/intrusive/rbtree.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -33,7 +33,7 @@
 #include <boost/intrusive/options.hpp>
 #include <boost/intrusive/rbtree_algorithms.hpp>
 #include <boost/intrusive/link_mode.hpp>
-//iG pending #include <boost/pointer_cast.hpp>
+#include <boost/move/move.hpp>
 
 namespace boost {
 namespace intrusive {
@@ -122,8 +122,7 @@
    typedef detail::size_holder<constant_time_size, size_type> size_traits;
 
    //noncopyable
- rbtree_impl (const rbtree_impl&);
- rbtree_impl operator =(const rbtree_impl&);
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(rbtree_impl)
 
    enum { safemode_or_autounlink =
             (int)real_value_traits::link_mode == (int)auto_unlink ||
@@ -158,6 +157,12 @@
    value_compare &priv_comp()
    { return data_.node_plus_pred_.get(); }
 
+ const value_traits &priv_value_traits() const
+ { return data_; }
+
+ value_traits &priv_value_traits()
+ { return data_; }
+
    const node &priv_header() const
    { return data_.node_plus_pred_.header_plus_size_.header_; }
 
@@ -254,6 +259,21 @@
          this->insert_equal(b, e);
    }
 
+ //! <b>Effects</b>: to-do
+ //!
+ 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());
+ this->priv_size_traits().set_size(size_type(0));
+ this->swap(x);
+ }
+
+ //! <b>Effects</b>: to-do
+ //!
+ rbtree_impl& operator=(BOOST_RV_REF(rbtree_impl) x)
+ { this->swap(x); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the set
    //! are not deleted (i.e. no destructors are called), but the nodes according to
    //! the value_traits template parameter are reinitialized and thus can be reused.
@@ -1286,6 +1306,8 @@
       node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this)
                                    , node_ptr(&priv_header())
                                    , get_real_value_traits().to_node_ptr(with_this));
+ if(safemode_or_autounlink)
+ node_algorithms::init(replace_this.pointed_node());
    }
 
    //! <b>Requires</b>: value must be an lvalue and shall be in a set of
@@ -1611,6 +1633,7 @@
       Options...
       #endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(rbtree)
 
    public:
    typedef typename Base::value_compare value_compare;
@@ -1634,6 +1657,13 @@
       : Base(unique, b, e, cmp, v_traits)
    {}
 
+ rbtree(BOOST_RV_REF(rbtree) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ rbtree& operator=(BOOST_RV_REF(rbtree) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
    static rbtree &container_from_end_iterator(iterator end_iterator)
    { return static_cast<rbtree &>(Base::container_from_end_iterator(end_iterator)); }
 

Modified: branches/release/boost/intrusive/set.hpp
==============================================================================
--- branches/release/boost/intrusive/set.hpp (original)
+++ branches/release/boost/intrusive/set.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -18,6 +18,7 @@
 #include <boost/intrusive/detail/mpl.hpp>
 #include <boost/intrusive/rbtree.hpp>
 #include <iterator>
+#include <boost/move/move.hpp>
 
 namespace boost {
 namespace intrusive {
@@ -42,13 +43,7 @@
 {
    /// @cond
    typedef rbtree_impl<Config> tree_type;
- //! This class is
- //! non-copyable
- set_impl (const set_impl&);
-
- //! This class is
- //! non-assignable
- set_impl &operator =(const set_impl&);
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(set_impl)
 
    typedef tree_type implementation_defined;
    /// @endcond
@@ -122,6 +117,17 @@
       : tree_(true, b, e, cmp, v_traits)
    {}
 
+ //! <b>Effects</b>: to-do
+ //!
+ set_impl(BOOST_RV_REF(set_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ set_impl& operator=(BOOST_RV_REF(set_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the set
    //! are not deleted (i.e. no destructors are called).
    //!
@@ -1190,6 +1196,7 @@
       #endif
>::type Base;
 
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(set)
    public:
    typedef typename Base::value_compare value_compare;
    typedef typename Base::value_traits value_traits;
@@ -1211,6 +1218,13 @@
       : Base(b, e, cmp, v_traits)
    {}
 
+ set(BOOST_RV_REF(set) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ set& operator=(BOOST_RV_REF(set) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
    static set &container_from_end_iterator(iterator end_iterator)
    { return static_cast<set &>(Base::container_from_end_iterator(end_iterator)); }
 
@@ -1247,9 +1261,7 @@
    /// @cond
    typedef rbtree_impl<Config> tree_type;
 
- //Non-copyable and non-assignable
- multiset_impl (const multiset_impl&);
- multiset_impl &operator =(const multiset_impl&);
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(multiset_impl)
    typedef tree_type implementation_defined;
    /// @endcond
 
@@ -1321,6 +1333,17 @@
       : tree_(false, b, e, cmp, v_traits)
    {}
 
+ //! <b>Effects</b>: to-do
+ //!
+ multiset_impl(BOOST_RV_REF(multiset_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ multiset_impl& operator=(BOOST_RV_REF(multiset_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the set
    //! are not deleted (i.e. no destructors are called).
    //!
@@ -2307,6 +2330,8 @@
       Options...
       #endif
>::type Base;
+
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(multiset)
 
    public:
    typedef typename Base::value_compare value_compare;
@@ -2329,6 +2354,13 @@
       : Base(b, e, cmp, v_traits)
    {}
 
+ multiset(BOOST_RV_REF(multiset) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ multiset& operator=(BOOST_RV_REF(multiset) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
    static multiset &container_from_end_iterator(iterator end_iterator)
    { return static_cast<multiset &>(Base::container_from_end_iterator(end_iterator)); }
 

Modified: branches/release/boost/intrusive/sg_set.hpp
==============================================================================
--- branches/release/boost/intrusive/sg_set.hpp (original)
+++ branches/release/boost/intrusive/sg_set.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -16,6 +16,7 @@
 #include <boost/intrusive/intrusive_fwd.hpp>
 #include <boost/intrusive/sgtree.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
+#include <boost/move/move.hpp>
 #include <iterator>
 
 namespace boost {
@@ -42,12 +43,8 @@
    /// @cond
    typedef sgtree_impl<Config> tree_type;
    //! This class is
- //! non-copyable
- sg_set_impl (const sg_set_impl&);
-
- //! This class is
- //! non-assignable
- sg_set_impl &operator =(const sg_set_impl&);
+ //! movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_set_impl)
 
    typedef tree_type implementation_defined;
    /// @endcond
@@ -111,6 +108,17 @@
       : tree_(true, b, e, cmp, v_traits)
    {}
 
+ //! <b>Effects</b>: to-do
+ //!
+ sg_set_impl(BOOST_RV_REF(sg_set_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ sg_set_impl& operator=(BOOST_RV_REF(sg_set_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the sg_set
    //! are not deleted (i.e. no destructors are called).
    //!
@@ -1218,6 +1226,7 @@
       Options...
       #endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_set)
 
    public:
    typedef typename Base::value_compare value_compare;
@@ -1240,6 +1249,13 @@
       : Base(b, e, cmp, v_traits)
    {}
 
+ sg_set(BOOST_RV_REF(sg_set) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ sg_set& operator=(BOOST_RV_REF(sg_set) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
    static sg_set &container_from_end_iterator(iterator end_iterator)
    { return static_cast<sg_set &>(Base::container_from_end_iterator(end_iterator)); }
 
@@ -1277,8 +1293,7 @@
    typedef sgtree_impl<Config> tree_type;
 
    //Non-copyable and non-assignable
- sg_multiset_impl (const sg_multiset_impl&);
- sg_multiset_impl &operator =(const sg_multiset_impl&);
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_multiset_impl)
    typedef tree_type implementation_defined;
    /// @endcond
 
@@ -1341,6 +1356,17 @@
       : tree_(false, b, e, cmp, v_traits)
    {}
 
+ //! <b>Effects</b>: to-do
+ //!
+ sg_multiset_impl(BOOST_RV_REF(sg_multiset_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ sg_multiset_impl& operator=(BOOST_RV_REF(sg_multiset_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the sg_multiset
    //! are not deleted (i.e. no destructors are called).
    //!
@@ -2352,6 +2378,7 @@
       Options...
       #endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_multiset)
 
    public:
    typedef typename Base::value_compare value_compare;
@@ -2374,6 +2401,13 @@
       : Base(b, e, cmp, v_traits)
    {}
 
+ sg_multiset(BOOST_RV_REF(sg_multiset) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ sg_multiset& operator=(BOOST_RV_REF(sg_multiset) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
    static sg_multiset &container_from_end_iterator(iterator end_iterator)
    { return static_cast<sg_multiset &>(Base::container_from_end_iterator(end_iterator)); }
 

Modified: branches/release/boost/intrusive/sgtree.hpp
==============================================================================
--- branches/release/boost/intrusive/sgtree.hpp (original)
+++ branches/release/boost/intrusive/sgtree.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -38,6 +38,7 @@
 #include <boost/intrusive/options.hpp>
 #include <boost/intrusive/sgtree_algorithms.hpp>
 #include <boost/intrusive/link_mode.hpp>
+#include <boost/move/move.hpp>
 
 namespace boost {
 namespace intrusive {
@@ -254,8 +255,7 @@
    typedef typename alpha_traits::multiply_by_alpha_t multiply_by_alpha_t;
 
    //noncopyable
- sgtree_impl (const sgtree_impl&);
- sgtree_impl operator =(const sgtree_impl&);
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(sgtree_impl)
 
    enum { safemode_or_autounlink =
             (int)real_value_traits::link_mode == (int)auto_unlink ||
@@ -303,6 +303,12 @@
    value_compare &priv_comp()
    { return data_.node_plus_pred_.get(); }
 
+ const value_traits &priv_value_traits() const
+ { return data_; }
+
+ value_traits &priv_value_traits()
+ { return data_; }
+
    const node &priv_header() const
    { return data_.node_plus_pred_.header_plus_alpha_.header_; }
 
@@ -395,6 +401,21 @@
          this->insert_equal(b, e);
    }
 
+ //! <b>Effects</b>: to-do
+ //!
+ 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());
+ this->priv_size_traits().set_size(size_type(0));
+ this->swap(x);
+ }
+
+ //! <b>Effects</b>: to-do
+ //!
+ sgtree_impl& operator=(BOOST_RV_REF(sgtree_impl) x)
+ { this->swap(x); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the set
    //! are not deleted (i.e. no destructors are called), but the nodes according to
    //! the value_traits template parameter are reinitialized and thus can be reused.
@@ -1453,6 +1474,8 @@
       node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this)
                                    , node_ptr(&priv_header())
                                    , get_real_value_traits().to_node_ptr(with_this));
+ if(safemode_or_autounlink)
+ node_algorithms::init(replace_this.pointed_node());
    }
 
    //! <b>Requires</b>: value must be an lvalue and shall be in a set of
@@ -1836,6 +1859,8 @@
          #endif
>::type Base;
 
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(sgtree)
+
    public:
    typedef typename Base::value_compare value_compare;
    typedef typename Base::value_traits value_traits;
@@ -1858,6 +1883,13 @@
       : Base(unique, b, e, cmp, v_traits)
    {}
 
+ sgtree(BOOST_RV_REF(sgtree) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ sgtree& operator=(BOOST_RV_REF(sgtree) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
    static sgtree &container_from_end_iterator(iterator end_iterator)
    { return static_cast<sgtree &>(Base::container_from_end_iterator(end_iterator)); }
 

Modified: branches/release/boost/intrusive/slist.hpp
==============================================================================
--- branches/release/boost/intrusive/slist.hpp (original)
+++ branches/release/boost/intrusive/slist.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -31,7 +31,7 @@
 #include <algorithm>
 #include <cstddef> //std::size_t
 #include <utility> //std::pair
-//iG pending #include <boost/pointer_cast.hpp>
+#include <boost/move/move.hpp>
 
 namespace boost {
 namespace intrusive {
@@ -148,13 +148,8 @@
    private:
    typedef detail::size_holder<constant_time_size, size_type> size_traits;
 
- //! This class is
- //! non-copyable
- slist_impl (const slist_impl&);
-
- //! This class is
- //! non-asignable
- slist_impl &operator =(const slist_impl&);
+ //noncopyable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(slist_impl)
 
    enum { safemode_or_autounlink =
             (int)real_value_traits::link_mode == (int)auto_unlink ||
@@ -252,10 +247,10 @@
    real_value_traits &get_real_value_traits(detail::bool_<true>)
    { return data_.get_value_traits(*this); }
 
- const value_traits &get_value_traits() const
+ const value_traits &priv_value_traits() const
    { return data_; }
 
- value_traits &get_value_traits()
+ value_traits &priv_value_traits()
    { return data_; }
 
    protected:
@@ -305,6 +300,21 @@
       this->insert_after(this->cbefore_begin(), b, e);
    }
 
+ //! <b>Effects</b>: to-do
+ //!
+ slist_impl(BOOST_RV_REF(slist_impl) x)
+ : data_(::boost::move(x.priv_value_traits()))
+ {
+ this->priv_size_traits().set_size(size_type(0));
+ node_algorithms::init_header(this->get_root_node());
+ this->swap(x);
+ }
+
+ //! <b>Effects</b>: to-do
+ //!
+ slist_impl& operator=(BOOST_RV_REF(slist_impl) x)
+ { this->swap(x); return *this; }
+
    //! <b>Effects</b>: If it's a safe-mode
    //! or auto-unlink value, the destructor does nothing
    //! (ie. no code is generated). Otherwise it detaches all elements from this.
@@ -1313,8 +1323,8 @@
       if (node_traits::get_next(node_traits::get_next(this->get_root_node()))
          != this->get_root_node()) {
 
- slist_impl carry(this->get_value_traits());
- detail::array_initializer<slist_impl, 64> counter(this->get_value_traits());
+ slist_impl carry(this->priv_value_traits());
+ detail::array_initializer<slist_impl, 64> counter(this->priv_value_traits());
          int fill = 0;
          const_iterator last_inserted;
          while(!this->empty()){
@@ -2084,6 +2094,8 @@
    typedef typename Base::real_value_traits real_value_traits;
    //Assert if passed value traits are compatible with the type
    BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value));
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(slist)
+
    public:
    typedef typename Base::value_traits value_traits;
    typedef typename Base::iterator iterator;
@@ -2098,6 +2110,13 @@
       : Base(b, e, v_traits)
    {}
 
+ slist(BOOST_RV_REF(slist) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ slist& operator=(BOOST_RV_REF(slist) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
    static slist &container_from_end_iterator(iterator end_iterator)
    { return static_cast<slist &>(Base::container_from_end_iterator(end_iterator)); }
 

Modified: branches/release/boost/intrusive/splay_set.hpp
==============================================================================
--- branches/release/boost/intrusive/splay_set.hpp (original)
+++ branches/release/boost/intrusive/splay_set.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -16,6 +16,7 @@
 #include <boost/intrusive/intrusive_fwd.hpp>
 #include <boost/intrusive/splaytree.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
+#include <boost/move/move.hpp>
 #include <iterator>
 
 namespace boost {
@@ -42,12 +43,8 @@
    /// @cond
    typedef splaytree_impl<Config> tree_type;
    //! This class is
- //! non-copyable
- splay_set_impl (const splay_set_impl&);
-
- //! This class is
- //! non-assignable
- splay_set_impl &operator =(const splay_set_impl&);
+ //! movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(splay_set_impl)
 
    typedef tree_type implementation_defined;
    /// @endcond
@@ -113,6 +110,17 @@
       : tree_(true, b, e, cmp, v_traits)
    {}
 
+ //! <b>Effects</b>: to-do
+ //!
+ splay_set_impl(BOOST_RV_REF(splay_set_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ splay_set_impl& operator=(BOOST_RV_REF(splay_set_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the splay_set
    //! are not deleted (i.e. no destructors are called).
    //!
@@ -1202,6 +1210,7 @@
          Options...
          #endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(splay_set)
 
    public:
    typedef typename Base::value_compare value_compare;
@@ -1224,6 +1233,13 @@
       : Base(b, e, cmp, v_traits)
    {}
 
+ splay_set(BOOST_RV_REF(splay_set) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ splay_set& operator=(BOOST_RV_REF(splay_set) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
    static splay_set &container_from_end_iterator(iterator end_iterator)
    { return static_cast<splay_set &>(Base::container_from_end_iterator(end_iterator)); }
 
@@ -1260,9 +1276,8 @@
    /// @cond
    typedef splaytree_impl<Config> tree_type;
 
- //Non-copyable and non-assignable
- splay_multiset_impl (const splay_multiset_impl&);
- splay_multiset_impl &operator =(const splay_multiset_impl&);
+ //Movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(splay_multiset_impl)
    typedef tree_type implementation_defined;
    /// @endcond
 
@@ -1327,6 +1342,17 @@
       : tree_(false, b, e, cmp, v_traits)
    {}
 
+ //! <b>Effects</b>: to-do
+ //!
+ splay_multiset_impl(BOOST_RV_REF(splay_multiset_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ splay_multiset_impl& operator=(BOOST_RV_REF(splay_multiset_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the set
    //! are not deleted (i.e. no destructors are called).
    //!
@@ -2324,6 +2350,7 @@
          Options...
          #endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(splay_multiset)
 
    public:
    typedef typename Base::value_compare value_compare;
@@ -2346,6 +2373,13 @@
       : Base(b, e, cmp, v_traits)
    {}
 
+ splay_multiset(BOOST_RV_REF(splay_multiset) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ splay_multiset& operator=(BOOST_RV_REF(splay_multiset) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
    static splay_multiset &container_from_end_iterator(iterator end_iterator)
    { return static_cast<splay_multiset &>(Base::container_from_end_iterator(end_iterator)); }
 

Modified: branches/release/boost/intrusive/splaytree.hpp
==============================================================================
--- branches/release/boost/intrusive/splaytree.hpp (original)
+++ branches/release/boost/intrusive/splaytree.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -30,6 +30,7 @@
 #include <boost/intrusive/options.hpp>
 #include <boost/intrusive/splaytree_algorithms.hpp>
 #include <boost/intrusive/link_mode.hpp>
+#include <boost/move/move.hpp>
 
 
 namespace boost {
@@ -122,8 +123,7 @@
    typedef detail::size_holder<constant_time_size, size_type> size_traits;
 
    //noncopyable
- splaytree_impl (const splaytree_impl&);
- splaytree_impl operator =(const splaytree_impl&);
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(splaytree_impl)
 
    enum { safemode_or_autounlink =
             (int)real_value_traits::link_mode == (int)auto_unlink ||
@@ -158,6 +158,12 @@
    value_compare &priv_comp()
    { return data_.node_plus_pred_.get(); }
 
+ const value_traits &priv_value_traits() const
+ { return data_; }
+
+ value_traits &priv_value_traits()
+ { return data_; }
+
    const node &priv_header() const
    { return data_.node_plus_pred_.header_plus_size_.header_; }
 
@@ -240,6 +246,21 @@
          this->insert_equal(b, e);
    }
 
+ //! <b>Effects</b>: to-do
+ //!
+ 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());
+ this->priv_size_traits().set_size(size_type(0));
+ this->swap(x);
+ }
+
+ //! <b>Effects</b>: to-do
+ //!
+ splaytree_impl& operator=(BOOST_RV_REF(splaytree_impl) x)
+ { this->swap(x); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the set
    //! are not deleted (i.e. no destructors are called), but the nodes according to
    //! the value_traits template parameter are reinitialized and thus can be reused.
@@ -1261,6 +1282,8 @@
       node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this)
                                    , node_ptr(&priv_header())
                                    , get_real_value_traits().to_node_ptr(with_this));
+ if(safemode_or_autounlink)
+ node_algorithms::init(replace_this.pointed_node());
    }
 
    //! <b>Requires</b>: value must be an lvalue and shall be in a set of
@@ -1612,6 +1635,7 @@
          Options...
          #endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(splaytree)
 
    public:
    typedef typename Base::value_compare value_compare;
@@ -1635,6 +1659,13 @@
       : Base(unique, b, e, cmp, v_traits)
    {}
 
+ splaytree(BOOST_RV_REF(splaytree) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ splaytree& operator=(BOOST_RV_REF(splaytree) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
    static splaytree &container_from_end_iterator(iterator end_iterator)
    { return static_cast<splaytree &>(Base::container_from_end_iterator(end_iterator)); }
 

Modified: branches/release/boost/intrusive/treap.hpp
==============================================================================
--- branches/release/boost/intrusive/treap.hpp (original)
+++ branches/release/boost/intrusive/treap.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -31,6 +31,7 @@
 #include <boost/intrusive/detail/mpl.hpp>
 #include <boost/intrusive/treap_algorithms.hpp>
 #include <boost/intrusive/link_mode.hpp>
+#include <boost/move/move.hpp>
 #include <boost/intrusive/priority_compare.hpp>
 
 namespace boost {
@@ -126,8 +127,7 @@
    typedef detail::size_holder<constant_time_size, size_type> size_traits;
 
    //noncopyable
- treap_impl (const treap_impl&);
- treap_impl operator =(const treap_impl&);
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(treap_impl)
 
    enum { safemode_or_autounlink =
             (int)real_value_traits::link_mode == (int)auto_unlink ||
@@ -176,6 +176,12 @@
    priority_compare &priv_pcomp()
    { return data_.node_plus_pred_.header_plus_priority_size_.get(); }
 
+ const value_traits &priv_value_traits() const
+ { return data_; }
+
+ 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_; }
 
@@ -224,7 +230,7 @@
    //! <b>Throws</b>: If value_traits::node_traits::node
    //! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
    //! or the copy constructor of the value_compare/priority_compare objects throw. Basic guarantee.
- treap_impl( const value_compare &cmp = value_compare()
+ treap_impl( const value_compare &cmp = value_compare()
             , const priority_compare &pcmp = priority_compare()
             , const value_traits &v_traits = value_traits())
       : data_(cmp, pcmp, v_traits)
@@ -261,6 +267,23 @@
          this->insert_equal(b, e);
    }
 
+ //! <b>Effects</b>: to-do
+ //!
+ treap_impl(BOOST_RV_REF(treap_impl) x)
+ : data_( ::boost::move(x.priv_comp())
+ , ::boost::move(x.priv_pcomp())
+ , ::boost::move(x.priv_value_traits()))
+ {
+ node_algorithms::init_header(&priv_header());
+ this->priv_size_traits().set_size(size_type(0));
+ this->swap(x);
+ }
+
+ //! <b>Effects</b>: to-do
+ //!
+ treap_impl& operator=(BOOST_RV_REF(treap_impl) x)
+ { this->swap(x); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the set
    //! are not deleted (i.e. no destructors are called), but the nodes according to
    //! the value_traits template parameter are reinitialized and thus can be reused.
@@ -1387,6 +1410,8 @@
       node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this)
                                    , node_ptr(&priv_header())
                                    , get_real_value_traits().to_node_ptr(with_this));
+ if(safemode_or_autounlink)
+ node_algorithms::init(replace_this.pointed_node());
    }
 
    //! <b>Requires</b>: value must be an lvalue and shall be in a set of
@@ -1699,6 +1724,7 @@
       Options...
       #endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(treap)
 
    public:
    typedef typename Base::value_compare value_compare;
@@ -1725,6 +1751,13 @@
       : Base(unique, b, e, cmp, pcmp, v_traits)
    {}
 
+ treap(BOOST_RV_REF(treap) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ treap& operator=(BOOST_RV_REF(treap) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
    static treap &container_from_end_iterator(iterator end_iterator)
    { return static_cast<treap &>(Base::container_from_end_iterator(end_iterator)); }
 

Modified: branches/release/boost/intrusive/treap_set.hpp
==============================================================================
--- branches/release/boost/intrusive/treap_set.hpp (original)
+++ branches/release/boost/intrusive/treap_set.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -16,6 +16,7 @@
 #include <boost/intrusive/intrusive_fwd.hpp>
 #include <boost/intrusive/treap.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
+#include <boost/move/move.hpp>
 #include <iterator>
 
 namespace boost {
@@ -42,12 +43,8 @@
    /// @cond
    typedef treap_impl<Config> tree_type;
    //! This class is
- //! non-copyable
- treap_set_impl (const treap_set_impl&);
-
- //! This class is
- //! non-assignable
- treap_set_impl &operator =(const treap_set_impl&);
+ //! movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(treap_set_impl)
 
    typedef tree_type implementation_defined;
    /// @endcond
@@ -116,6 +113,17 @@
       : tree_(true, b, e, cmp, pcmp, v_traits)
    {}
 
+ //! <b>Effects</b>: to-do
+ //!
+ treap_set_impl(BOOST_RV_REF(treap_set_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ treap_set_impl& operator=(BOOST_RV_REF(treap_set_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the treap_set
    //! are not deleted (i.e. no destructors are called).
    //!
@@ -1294,6 +1302,7 @@
       Options...
       #endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(treap_set)
 
    public:
    typedef typename Base::value_compare value_compare;
@@ -1319,6 +1328,13 @@
       : Base(b, e, cmp, pcmp, v_traits)
    {}
 
+ treap_set(BOOST_RV_REF(treap_set) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ treap_set& operator=(BOOST_RV_REF(treap_set) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
    static treap_set &container_from_end_iterator(iterator end_iterator)
    { return static_cast<treap_set &>(Base::container_from_end_iterator(end_iterator)); }
 
@@ -1355,9 +1371,7 @@
    /// @cond
    typedef treap_impl<Config> tree_type;
 
- //Non-copyable and non-assignable
- treap_multiset_impl (const treap_multiset_impl&);
- treap_multiset_impl &operator =(const treap_multiset_impl&);
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(treap_multiset_impl)
    typedef tree_type implementation_defined;
    /// @endcond
 
@@ -1425,6 +1439,17 @@
       : tree_(false, b, e, cmp, pcmp, v_traits)
    {}
 
+ //! <b>Effects</b>: to-do
+ //!
+ treap_multiset_impl(BOOST_RV_REF(treap_multiset_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ treap_multiset_impl& operator=(BOOST_RV_REF(treap_multiset_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the treap_multiset
    //! are not deleted (i.e. no destructors are called).
    //!
@@ -2499,6 +2524,8 @@
       Options...
       #endif
>::type Base;
+ //Movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(treap_multiset)
 
    public:
    typedef typename Base::value_compare value_compare;
@@ -2524,6 +2551,13 @@
       : Base(b, e, cmp, pcmp, v_traits)
    {}
 
+ treap_multiset(BOOST_RV_REF(treap_multiset) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ treap_multiset& operator=(BOOST_RV_REF(treap_multiset) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
    static treap_multiset &container_from_end_iterator(iterator end_iterator)
    { return static_cast<treap_multiset &>(Base::container_from_end_iterator(end_iterator)); }
 

Modified: branches/release/boost/intrusive/unordered_set.hpp
==============================================================================
--- branches/release/boost/intrusive/unordered_set.hpp (original)
+++ branches/release/boost/intrusive/unordered_set.hpp 2011-07-21 13:42:58 EDT (Thu, 21 Jul 2011)
@@ -16,8 +16,10 @@
 #include <boost/intrusive/detail/config_begin.hpp>
 #include <boost/intrusive/intrusive_fwd.hpp>
 #include <boost/intrusive/hashtable.hpp>
+#include <boost/move/move.hpp>
 #include <iterator>
 
+
 namespace boost {
 namespace intrusive {
 
@@ -39,7 +41,7 @@
 //! The container supports the following options:
 //! \c base_hook<>/member_hook<>/value_traits<>,
 //! \c constant_time_size<>, \c size_type<>, \c hash<> and \c equal<>
-//! \c bucket_traits<>, power_2_buckets<> and cache_begin<>.
+//! \c bucket_traits<>, \c power_2_buckets<> and \c cache_begin<>.
 //!
 //! unordered_set only provides forward iterators but it provides 4 iterator types:
 //! iterator and const_iterator to navigate through the whole container and
@@ -68,12 +70,8 @@
    typedef hashtable_impl<Config> table_type;
 
    //! This class is
- //! non-copyable
- unordered_set_impl (const unordered_set_impl&);
-
- //! This class is
- //! non-assignable
- unordered_set_impl &operator =(const unordered_set_impl&);
+ //! movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(unordered_set_impl)
 
    typedef table_type implementation_defined;
    /// @endcond
@@ -156,6 +154,17 @@
       : table_(b_traits, hash_func, equal_func, v_traits)
    { table_.insert_unique(b, e); }
 
+ //! <b>Effects</b>: to-do
+ //!
+ unordered_set_impl(BOOST_RV_REF(unordered_set_impl) x)
+ : table_(::boost::move(x.table_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ unordered_set_impl& operator=(BOOST_RV_REF(unordered_set_impl) x)
+ { table_ = ::boost::move(x.table_); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_set
    //! are not deleted (i.e. no destructors are called).
    //!
@@ -1046,6 +1055,7 @@
 
    //Assert if passed value traits are compatible with the type
    BOOST_STATIC_ASSERT((detail::is_same<typename Base::value_traits::value_type, T>::value));
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(unordered_set)
 
    public:
    typedef typename Base::value_traits value_traits;
@@ -1073,6 +1083,13 @@
                   , const value_traits &v_traits = value_traits())
       : Base(b, e, b_traits, hash_func, equal_func, v_traits)
    {}
+
+ unordered_set(BOOST_RV_REF(unordered_set) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ unordered_set& operator=(BOOST_RV_REF(unordered_set) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
 };
 
 #endif
@@ -1096,7 +1113,7 @@
 //! The container supports the following options:
 //! \c base_hook<>/member_hook<>/value_traits<>,
 //! \c constant_time_size<>, \c size_type<>, \c hash<> and \c equal<>
-//! \c bucket_traits<>, power_2_buckets<> and cache_begin<>.
+//! \c bucket_traits<>, \c power_2_buckets<> and \c cache_begin<>.
 //!
 //! unordered_multiset only provides forward iterators but it provides 4 iterator types:
 //! iterator and const_iterator to navigate through the whole container and
@@ -1125,13 +1142,8 @@
    typedef hashtable_impl<Config> table_type;
    /// @endcond
 
- //! This class is
- //! non-copyable
- unordered_multiset_impl (const unordered_multiset_impl&);
-
- //! This class is
- //! non-assignable
- unordered_multiset_impl &operator =(const unordered_multiset_impl&);
+ //Movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(unordered_multiset_impl)
 
    typedef table_type implementation_defined;
 
@@ -1213,6 +1225,17 @@
       : table_(b_traits, hash_func, equal_func, v_traits)
    { table_.insert_equal(b, e); }
 
+ //! <b>Effects</b>: to-do
+ //!
+ unordered_multiset_impl(BOOST_RV_REF(unordered_multiset_impl) x)
+ : table_(::boost::move(x.table_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ unordered_multiset_impl& operator=(BOOST_RV_REF(unordered_multiset_impl) x)
+ { table_ = ::boost::move(x.table_); return *this; }
+
    //! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_multiset
    //! are not deleted (i.e. no destructors are called).
    //!
@@ -2045,6 +2068,7 @@
>::type Base;
    //Assert if passed value traits are compatible with the type
    BOOST_STATIC_ASSERT((detail::is_same<typename Base::value_traits::value_type, T>::value));
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(unordered_multiset)
 
    public:
    typedef typename Base::value_traits value_traits;
@@ -2072,6 +2096,13 @@
                      , const value_traits &v_traits = value_traits())
       : Base(b, e, b_traits, hash_func, equal_func, v_traits)
    {}
+
+ unordered_multiset(BOOST_RV_REF(unordered_multiset) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ unordered_multiset& operator=(BOOST_RV_REF(unordered_multiset) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
 };
 
 #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