From e5181201041564c3de5281c35388fe10a9c921a6 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 24 Apr 2017 09:46:05 +0100 Subject: [PATCH] Rename some copy/assign/move methods But with a hack so that the static casts will work until there's a better method. --- .../boost/unordered/detail/implementation.hpp | 42 ++++++++++++++++--- include/boost/unordered/unordered_map.hpp | 8 ++-- include/boost/unordered/unordered_set.hpp | 8 ++-- 3 files changed, 44 insertions(+), 14 deletions(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index 8e723f13..662af550 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -4146,7 +4146,12 @@ struct table_unique : boost::unordered::detail::table //////////////////////////////////////////////////////////////////////// // fill_buckets_unique - void copy_buckets(table const& src) + BOOST_FORCEINLINE void copy_buckets(table const& src) + { + this->copy_buckets_unique(src); + } + + void copy_buckets_unique(table const& src) { this->create_buckets(this->bucket_count_); @@ -4170,7 +4175,12 @@ struct table_unique : boost::unordered::detail::table } } - void assign_buckets(table const& src) + BOOST_FORCEINLINE void assign_buckets(table const& src) + { + this->assign_buckets_unique(src); + } + + void assign_buckets_unique(table const& src) { node_holder holder(*this); for (node_pointer n = src.begin(); n; n = node_algo::next_node(n)) { @@ -4178,7 +4188,12 @@ struct table_unique : boost::unordered::detail::table } } - void move_assign_buckets(table& src) + BOOST_FORCEINLINE void move_assign_buckets(table const& src) + { + this->move_assign_buckets_unique(src); + } + + void move_assign_buckets_unique(table& src) { node_holder holder(*this); for (node_pointer n = src.begin(); n; n = node_algo::next_node(n)) { @@ -4788,7 +4803,12 @@ struct table_equiv : boost::unordered::detail::table //////////////////////////////////////////////////////////////////////// // fill_buckets - void copy_buckets(table const& src) + BOOST_FORCEINLINE void copy_buckets(table const& src) + { + this->copy_buckets_equiv(src); + } + + void copy_buckets_equiv(table const& src) { this->create_buckets(this->bucket_count_); @@ -4830,7 +4850,12 @@ struct table_equiv : boost::unordered::detail::table } } - void assign_buckets(table const& src) + BOOST_FORCEINLINE void assign_buckets(table const& src) + { + this->assign_buckets_equiv(src); + } + + void assign_buckets_equiv(table const& src) { node_holder holder(*this); for (node_pointer n = src.begin(); n;) { @@ -4845,7 +4870,12 @@ struct table_equiv : boost::unordered::detail::table } } - void move_assign_buckets(table& src) + BOOST_FORCEINLINE void move_assign_buckets(table const& src) + { + this->move_assign_buckets_equiv(src); + } + + void move_assign_buckets_equiv(table& src) { node_holder holder(*this); for (node_pointer n = src.begin(); n;) { diff --git a/include/boost/unordered/unordered_map.hpp b/include/boost/unordered/unordered_map.hpp index 4188a594..7972cc89 100644 --- a/include/boost/unordered/unordered_map.hpp +++ b/include/boost/unordered/unordered_map.hpp @@ -1381,7 +1381,7 @@ unordered_map::unordered_map(unordered_map const& other) : table_(other.table_) { if (other.table_.size_) { - table_.copy_buckets(other.table_); + table_.copy_buckets_unique(other.table_); } } @@ -1398,7 +1398,7 @@ unordered_map::unordered_map( : table_(other.table_, a) { if (other.table_.size_) { - table_.copy_buckets(other.table_); + table_.copy_buckets_unique(other.table_); } } @@ -1869,7 +1869,7 @@ unordered_multimap::unordered_multimap( : table_(other.table_) { if (other.table_.size_) { - table_.copy_buckets(other.table_); + table_.copy_buckets_equiv(other.table_); } } @@ -1886,7 +1886,7 @@ unordered_multimap::unordered_multimap( : table_(other.table_, a) { if (other.table_.size_) { - table_.copy_buckets(other.table_); + table_.copy_buckets_equiv(other.table_); } } diff --git a/include/boost/unordered/unordered_set.hpp b/include/boost/unordered/unordered_set.hpp index 6ef28460..273975ab 100644 --- a/include/boost/unordered/unordered_set.hpp +++ b/include/boost/unordered/unordered_set.hpp @@ -1080,7 +1080,7 @@ unordered_set::unordered_set(unordered_set const& other) : table_(other.table_) { if (other.table_.size_) { - table_.copy_buckets(other.table_); + table_.copy_buckets_unique(other.table_); } } @@ -1097,7 +1097,7 @@ unordered_set::unordered_set( : table_(other.table_, a) { if (other.table_.size_) { - table_.copy_buckets(other.table_); + table_.copy_buckets_unique(other.table_); } } @@ -1483,7 +1483,7 @@ unordered_multiset::unordered_multiset( : table_(other.table_) { if (other.table_.size_) { - table_.copy_buckets(other.table_); + table_.copy_buckets_equiv(other.table_); } } @@ -1500,7 +1500,7 @@ unordered_multiset::unordered_multiset( : table_(other.table_, a) { if (other.table_.size_) { - table_.copy_buckets(other.table_); + table_.copy_buckets_equiv(other.table_); } }