Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73679 - trunk/boost/unordered/detail
From: dnljms_at_[hidden]
Date: 2011-08-11 17:18:20


Author: danieljames
Date: 2011-08-11 17:18:19 EDT (Thu, 11 Aug 2011)
New Revision: 73679
URL: http://svn.boost.org/trac/boost/changeset/73679

Log:
Unordered: Starting to implement allocator propagation.
Text files modified:
   trunk/boost/unordered/detail/buckets.hpp | 11 ++++++++++-
   trunk/boost/unordered/detail/equivalent.hpp | 4 +++-
   trunk/boost/unordered/detail/table.hpp | 2 +-
   trunk/boost/unordered/detail/unique.hpp | 4 +++-
   4 files changed, 17 insertions(+), 4 deletions(-)

Modified: trunk/boost/unordered/detail/buckets.hpp
==============================================================================
--- trunk/boost/unordered/detail/buckets.hpp (original)
+++ trunk/boost/unordered/detail/buckets.hpp 2011-08-11 17:18:19 EDT (Thu, 11 Aug 2011)
@@ -103,7 +103,16 @@
             allocators_(a,a)
         {
         }
-
+
+ // TODO: Need to move allocators_, not copy. But compressed_pair
+ // doesn't support move parameters.
+ buckets(buckets& b, move_tag m)
+ : buckets_(),
+ bucket_count_(b.bucket_count),
+ allocators_(b.allocators_)
+ {
+ }
+
         inline ~buckets()
         {
             if(this->buckets_) { this->delete_buckets(); }

Modified: trunk/boost/unordered/detail/equivalent.hpp
==============================================================================
--- trunk/boost/unordered/detail/equivalent.hpp (original)
+++ trunk/boost/unordered/detail/equivalent.hpp 2011-08-11 17:18:19 EDT (Thu, 11 Aug 2011)
@@ -34,7 +34,9 @@
             hasher const& hf, key_equal const& eq, value_allocator const& a)
           : table_base(n, hf, eq, a) {}
         equivalent_table(equivalent_table const& x)
- : table_base(x, x.node_alloc()) {}
+ : table_base(x,
+ allocator_traits<node_allocator>::
+ select_on_container_copy_construction(x.node_alloc())) {}
         equivalent_table(equivalent_table const& x,
             value_allocator const& a)
           : table_base(x, a) {}

Modified: trunk/boost/unordered/detail/table.hpp
==============================================================================
--- trunk/boost/unordered/detail/table.hpp (original)
+++ trunk/boost/unordered/detail/table.hpp 2011-08-11 17:18:19 EDT (Thu, 11 Aug 2011)
@@ -203,7 +203,7 @@
         }
 
         table(table& x, move_tag)
- : buckets(x.node_alloc(), x.bucket_count_),
+ : buckets(boost::move(x.node_alloc()), x.bucket_count_),
             functions(x),
             size_(0),
             mlf_(1.0f),

Modified: trunk/boost/unordered/detail/unique.hpp
==============================================================================
--- trunk/boost/unordered/detail/unique.hpp (original)
+++ trunk/boost/unordered/detail/unique.hpp 2011-08-11 17:18:19 EDT (Thu, 11 Aug 2011)
@@ -36,7 +36,9 @@
             value_allocator const& a)
           : table_base(n, hf, eq, a) {}
         unique_table(unique_table const& x)
- : table_base(x, x.node_alloc()) {}
+ : table_base(x,
+ allocator_traits<node_allocator>::
+ select_on_container_copy_construction(x.node_alloc())) {}
         unique_table(unique_table const& x, value_allocator const& a)
           : table_base(x, a) {}
         unique_table(unique_table& x, move_tag m)


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