Remove Types::is_unique

This commit is contained in:
Daniel James
2017-04-27 18:22:44 +01:00
parent f1435d53d4
commit 03baef8b28
5 changed files with 34 additions and 48 deletions
@@ -3116,16 +3116,17 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
////////////////////////////////////////////////////////////////////////
// Assignment
void assign(table const& x)
void assign(table const& x, bool is_unique)
{
if (this != boost::addressof(x)) {
assign(x, boost::unordered::detail::integral_constant<bool,
allocator_traits<node_allocator>::
propagate_on_container_copy_assignment::value>());
assign(x, is_unique,
boost::unordered::detail::integral_constant<bool,
allocator_traits<node_allocator>::
propagate_on_container_copy_assignment::value>());
}
}
void assign(table const& x, false_type)
void assign(table const& x, bool is_unique, false_type)
{
// Strong exception safety.
set_hash_functions new_func_this(*this, x);
@@ -3140,18 +3141,18 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
new_func_this.commit();
if (Types::is_unique) {
if (is_unique) {
assign_buckets_unique(x);
} else {
assign_buckets_equiv(x);
}
}
void assign(table const& x, true_type)
void assign(table const& x, bool is_unique, true_type)
{
if (node_alloc() == x.node_alloc()) {
allocators_.assign(x.allocators_);
assign(x, false_type());
assign(x, is_unique, false_type());
} else {
set_hash_functions new_func_this(*this, x);
@@ -3167,7 +3168,7 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
// Finally copy the elements.
if (x.size_) {
if (Types::is_unique) {
if (is_unique) {
copy_buckets_unique(x);
} else {
copy_buckets_equiv(x);
@@ -3176,17 +3177,18 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
}
}
void move_assign(table& x)
void move_assign(table& x, bool is_unique)
{
if (this != boost::addressof(x)) {
move_assign(
x, boost::unordered::detail::integral_constant<bool,
allocator_traits<node_allocator>::
propagate_on_container_move_assignment::value>());
x, is_unique,
boost::unordered::detail::integral_constant<bool,
allocator_traits<node_allocator>::
propagate_on_container_move_assignment::value>());
}
}
void move_assign(table& x, true_type)
void move_assign(table& x, bool /* is_unique */, true_type)
{
delete_buckets();
set_hash_functions new_func_this(*this, x);
@@ -3197,7 +3199,7 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
new_func_this.commit();
}
void move_assign(table& x, false_type)
void move_assign(table& x, bool is_unique, false_type)
{
if (node_alloc() == x.node_alloc()) {
delete_buckets();
@@ -3219,7 +3221,7 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
new_func_this.commit();
if (Types::is_unique) {
if (is_unique) {
move_assign_buckets_unique(x);
} else {
move_assign_buckets_equiv(x);
-8
View File
@@ -30,10 +30,6 @@ template <typename A, typename K, typename M, typename H, typename P> struct map
typedef boost::unordered::detail::table<types> table;
typedef boost::unordered::detail::map_extractor<value_type> extractor;
enum
{
is_unique = true
};
typedef typename boost::unordered::detail::pick_policy<K>::type policy;
@@ -71,10 +67,6 @@ struct multimap
typedef boost::unordered::detail::table<types> table;
typedef boost::unordered::detail::map_extractor<value_type> extractor;
enum
{
is_unique = false
};
typedef typename boost::unordered::detail::pick_policy<K>::type policy;
-8
View File
@@ -30,10 +30,6 @@ template <typename A, typename T, typename H, typename P> struct set
typedef boost::unordered::detail::table<types> table;
typedef boost::unordered::detail::set_extractor<value_type> extractor;
enum
{
is_unique = true
};
typedef typename boost::unordered::detail::pick_policy<T>::type policy;
@@ -70,10 +66,6 @@ template <typename A, typename T, typename H, typename P> struct multiset
typedef boost::unordered::detail::table<types> table;
typedef boost::unordered::detail::set_extractor<value_type> extractor;
enum
{
is_unique = false
};
typedef typename boost::unordered::detail::pick_policy<T>::type policy;