mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-29 19:07:15 +02:00
Merge branch 'feature/combine-unique-equiv-tables' into develop
Expanding a lot of the call to the implementation methods. While working on some recent changes, I felt the call chains in error messages were too long, this reduces that a little. It also should make debugging a tad easier and I think it makes the methods a little more informative, as you can see what they're doing without hunting around the implementation file. Also reduces the number of symbols when compiling, although I'm not sure if that will make much of a difference. Does make the code a little long, and duplicated, but I don't think it's particularly harmful.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -29,8 +29,12 @@ template <typename A, typename K, typename M, typename H, typename P> struct map
|
||||
typedef typename pick::link_pointer link_pointer;
|
||||
typedef typename pick::node_algo node_algo;
|
||||
|
||||
typedef boost::unordered::detail::table_unique<types> table;
|
||||
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,8 +75,12 @@ struct multimap
|
||||
typedef typename pick::link_pointer link_pointer;
|
||||
typedef typename pick::node_algo node_algo;
|
||||
|
||||
typedef boost::unordered::detail::table_equiv<types> table;
|
||||
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;
|
||||
|
||||
|
@ -29,8 +29,12 @@ template <typename A, typename T, typename H, typename P> struct set
|
||||
typedef typename pick::link_pointer link_pointer;
|
||||
typedef typename pick::node_algo node_algo;
|
||||
|
||||
typedef boost::unordered::detail::table_unique<types> table;
|
||||
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,8 +74,12 @@ template <typename A, typename T, typename H, typename P> struct multiset
|
||||
typedef typename pick::link_pointer link_pointer;
|
||||
typedef typename pick::node_algo node_algo;
|
||||
|
||||
typedef boost::unordered::detail::table_equiv<types> table;
|
||||
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;
|
||||
|
||||
|
@ -101,6 +101,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
BOOST_NOEXCEPT_IF(table::nothrow_move_constructible)
|
||||
: table_(other.table_, boost::unordered::detail::move_tag())
|
||||
{
|
||||
// The move is done in table_
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -222,7 +223,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
template <class... Args>
|
||||
std::pair<iterator, bool> emplace(BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
return table_.emplace_impl(
|
||||
return table_.emplace_unique(
|
||||
table::extractor::extract(boost::forward<Args>(args)...),
|
||||
boost::forward<Args>(args)...);
|
||||
}
|
||||
@ -248,7 +249,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
template <typename A0>
|
||||
std::pair<iterator, bool> emplace(BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.emplace_impl(
|
||||
return table_.emplace_unique(
|
||||
table::extractor::extract(boost::forward<A0>(a0)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
@ -258,7 +259,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
std::pair<iterator, bool> emplace(
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace_impl(
|
||||
return table_.emplace_unique(
|
||||
table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -269,7 +270,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
std::pair<iterator, bool> emplace(
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.emplace_impl(
|
||||
return table_.emplace_unique(
|
||||
table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -284,7 +285,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
template <class... Args>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
return table_.emplace_hint_impl(hint,
|
||||
return table_.emplace_hint_unique(hint,
|
||||
table::extractor::extract(boost::forward<Args>(args)...),
|
||||
boost::forward<Args>(args)...);
|
||||
}
|
||||
@ -306,17 +307,17 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
template <typename A0>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.emplace_hint_impl(hint,
|
||||
return table_.emplace_hint_unique(hint,
|
||||
table::extractor::extract(boost::forward<A0>(a0)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
boost::forward<A0>(a0)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
iterator emplace_hint(
|
||||
const_iterator hint, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace_hint_impl(
|
||||
return table_.emplace_hint_unique(
|
||||
hint, table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -327,7 +328,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.emplace_hint_impl(
|
||||
return table_.emplace_hint_unique(
|
||||
hint, table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -344,7 +345,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
std::pair<iterator, bool> emplace( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return table_.emplace_impl( \
|
||||
return table_.emplace_unique( \
|
||||
table::extractor::extract( \
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)), \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
@ -355,7 +356,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
iterator emplace_hint(const_iterator hint, \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return table_.emplace_hint_impl( \
|
||||
return table_.emplace_hint_unique( \
|
||||
hint, table::extractor::extract( \
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)), \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
@ -424,7 +425,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
node_type extract(const_iterator position)
|
||||
{
|
||||
return node_type(
|
||||
table_.extract_by_iterator(position), table_.node_alloc());
|
||||
table_.extract_by_iterator_unique(position), table_.node_alloc());
|
||||
}
|
||||
|
||||
node_type extract(const key_type& k)
|
||||
@ -435,13 +436,13 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
insert_return_type insert(BOOST_RV_REF(node_type) np)
|
||||
{
|
||||
insert_return_type result;
|
||||
table_.move_insert_node_type(np, result);
|
||||
table_.move_insert_node_type_unique(np, result);
|
||||
return boost::move(result);
|
||||
}
|
||||
|
||||
iterator insert(const_iterator hint, BOOST_RV_REF(node_type) np)
|
||||
{
|
||||
return table_.move_insert_node_type_with_hint(hint, np);
|
||||
return table_.move_insert_node_type_with_hint_unique(hint, np);
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
@ -459,14 +460,14 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
std::pair<iterator, bool> try_emplace(
|
||||
key_type const& k, BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
return table_.try_emplace_impl(k, boost::forward<Args>(args)...);
|
||||
return table_.try_emplace_unique(k, boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
iterator try_emplace(
|
||||
const_iterator hint, key_type const& k, BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
return table_.try_emplace_hint_impl(
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, k, boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
@ -474,7 +475,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
std::pair<iterator, bool> try_emplace(
|
||||
BOOST_RV_REF(key_type) k, BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
return table_.try_emplace_impl(
|
||||
return table_.try_emplace_unique(
|
||||
boost::move(k), boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
@ -482,7 +483,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k,
|
||||
BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
return table_.try_emplace_hint_impl(
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, boost::move(k), boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
@ -491,20 +492,20 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
template <typename Key>
|
||||
std::pair<iterator, bool> try_emplace(BOOST_FWD_REF(Key) k)
|
||||
{
|
||||
return table_.try_emplace_impl(boost::forward<Key>(k));
|
||||
return table_.try_emplace_unique(boost::forward<Key>(k));
|
||||
}
|
||||
|
||||
template <typename Key>
|
||||
iterator try_emplace(const_iterator hint, BOOST_FWD_REF(Key) k)
|
||||
{
|
||||
return table_.try_emplace_hint_impl(hint, boost::forward<Key>(k));
|
||||
return table_.try_emplace_hint_unique(hint, boost::forward<Key>(k));
|
||||
}
|
||||
|
||||
template <typename A0>
|
||||
std::pair<iterator, bool> try_emplace(
|
||||
key_type const& k, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.try_emplace_impl(
|
||||
return table_.try_emplace_unique(
|
||||
k, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
}
|
||||
@ -513,7 +514,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
iterator try_emplace(
|
||||
const_iterator hint, key_type const& k, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.try_emplace_hint_impl(
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, k, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
}
|
||||
@ -522,7 +523,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
std::pair<iterator, bool> try_emplace(
|
||||
BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.try_emplace_impl(
|
||||
return table_.try_emplace_hint_unique(
|
||||
boost::move(k), boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
}
|
||||
@ -531,7 +532,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
iterator try_emplace(
|
||||
const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.try_emplace_hint_impl(
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, boost::move(k), boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
}
|
||||
@ -540,7 +541,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
std::pair<iterator, bool> try_emplace(
|
||||
key_type const& k, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.try_emplace_impl(
|
||||
return table_.try_emplace_unique(
|
||||
k, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
}
|
||||
@ -549,7 +550,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
iterator try_emplace(const_iterator hint, key_type const& k,
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.try_emplace_hint_impl(
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, k, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
}
|
||||
@ -558,7 +559,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
std::pair<iterator, bool> try_emplace(
|
||||
BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.try_emplace_impl(
|
||||
return table_.try_emplace_unique(
|
||||
boost::move(k),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
@ -568,7 +569,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k,
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.try_emplace_hint_impl(
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, boost::move(k),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
@ -578,7 +579,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
std::pair<iterator, bool> try_emplace(key_type const& k,
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.try_emplace_impl(
|
||||
return table_.try_emplace_unique(
|
||||
k, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)));
|
||||
@ -589,7 +590,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_
|
||||
.try_emplace_impl_(
|
||||
.try_emplace_unique(
|
||||
hint, k, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)))
|
||||
@ -600,7 +601,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
std::pair<iterator, bool> try_emplace(BOOST_RV_REF(key_type) k,
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.try_emplace_impl(
|
||||
return table_.try_emplace_unique(
|
||||
boost::move(k), boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)));
|
||||
@ -610,7 +611,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k,
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.try_emplace_hint_impl(
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, boost::move(k),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
@ -623,7 +624,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
std::pair<iterator, bool> try_emplace( \
|
||||
key_type const& k, BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return table_.try_emplace_impl( \
|
||||
return table_.try_emplace_unique( \
|
||||
k, boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \
|
||||
} \
|
||||
@ -632,7 +633,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
iterator try_emplace(const_iterator hint, key_type const& k, \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return table_.try_emplace_hint_impl(hint, k, \
|
||||
return table_.try_emplace_hint_unique(hint, k, \
|
||||
boost::unordered::detail::create_emplace_args(BOOST_PP_ENUM_##z( \
|
||||
n, BOOST_UNORDERED_CALL_FORWARD, a))); \
|
||||
} \
|
||||
@ -641,7 +642,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
std::pair<iterator, bool> try_emplace(BOOST_RV_REF(key_type) k, \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return table_.try_emplace_impl(boost::move(k), \
|
||||
return table_.try_emplace_unique(boost::move(k), \
|
||||
boost::unordered::detail::create_emplace_args(BOOST_PP_ENUM_##z( \
|
||||
n, BOOST_UNORDERED_CALL_FORWARD, a))); \
|
||||
} \
|
||||
@ -650,7 +651,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k, \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return table_.try_emplace_hint_impl(hint, boost::move(k), \
|
||||
return table_.try_emplace_hint_unique(hint, boost::move(k), \
|
||||
boost::unordered::detail::create_emplace_args(BOOST_PP_ENUM_##z( \
|
||||
n, BOOST_UNORDERED_CALL_FORWARD, a))); \
|
||||
}
|
||||
@ -666,14 +667,14 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
std::pair<iterator, bool> insert_or_assign(
|
||||
key_type const& k, BOOST_FWD_REF(M) obj)
|
||||
{
|
||||
return table_.insert_or_assign_impl(k, boost::forward<M>(obj));
|
||||
return table_.insert_or_assign_unique(k, boost::forward<M>(obj));
|
||||
}
|
||||
|
||||
template <class M>
|
||||
std::pair<iterator, bool> insert_or_assign(
|
||||
BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj)
|
||||
{
|
||||
return table_.insert_or_assign_impl(
|
||||
return table_.insert_or_assign_unique(
|
||||
boost::move(k), boost::forward<M>(obj));
|
||||
}
|
||||
|
||||
@ -681,7 +682,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
iterator insert_or_assign(
|
||||
const_iterator, key_type const& k, BOOST_FWD_REF(M) obj)
|
||||
{
|
||||
return table_.insert_or_assign_impl(k, boost::forward<M>(obj)).first;
|
||||
return table_.insert_or_assign_unique(k, boost::forward<M>(obj)).first;
|
||||
}
|
||||
|
||||
template <class M>
|
||||
@ -689,7 +690,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
const_iterator, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj)
|
||||
{
|
||||
return table_
|
||||
.insert_or_assign_impl(boost::move(k), boost::forward<M>(obj))
|
||||
.insert_or_assign_unique(boost::move(k), boost::forward<M>(obj))
|
||||
.first;
|
||||
}
|
||||
|
||||
@ -883,6 +884,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
BOOST_NOEXCEPT_IF(table::nothrow_move_constructible)
|
||||
: table_(other.table_, boost::unordered::detail::move_tag())
|
||||
{
|
||||
// The move is done in table_
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1004,7 +1006,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
|
||||
template <class... Args> iterator emplace(BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
return iterator(table_.emplace_impl(
|
||||
return iterator(table_.emplace_equiv(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(), boost::forward<Args>(args)...)));
|
||||
}
|
||||
@ -1028,7 +1030,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
|
||||
template <typename A0> iterator emplace(BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return iterator(table_.emplace_impl(
|
||||
return iterator(table_.emplace_equiv(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -1038,7 +1040,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
template <typename A0, typename A1>
|
||||
iterator emplace(BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return iterator(table_.emplace_impl(
|
||||
return iterator(table_.emplace_equiv(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -1049,7 +1051,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
iterator emplace(
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return iterator(table_.emplace_impl(
|
||||
return iterator(table_.emplace_equiv(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -1064,7 +1066,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
template <class... Args>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
return iterator(table_.emplace_hint_impl(
|
||||
return iterator(table_.emplace_hint_equiv(
|
||||
hint, boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(), boost::forward<Args>(args)...)));
|
||||
}
|
||||
@ -1086,7 +1088,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
template <typename A0>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return iterator(table_.emplace_hint_impl(
|
||||
return iterator(table_.emplace_hint_equiv(
|
||||
hint, boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -1097,7 +1099,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
iterator emplace_hint(
|
||||
const_iterator hint, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return iterator(table_.emplace_hint_impl(
|
||||
return iterator(table_.emplace_hint_equiv(
|
||||
hint, boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -1108,7 +1110,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return iterator(table_.emplace_hint_impl(
|
||||
return iterator(table_.emplace_hint_equiv(
|
||||
hint, boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -1124,7 +1126,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
|
||||
iterator emplace(BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return iterator(table_.emplace_impl( \
|
||||
return iterator(table_.emplace_equiv( \
|
||||
boost::unordered::detail::func::construct_node_from_args( \
|
||||
table_.node_alloc(), \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
@ -1135,7 +1137,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
iterator emplace_hint(const_iterator hint, \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return iterator(table_.emplace_hint_impl( \
|
||||
return iterator(table_.emplace_hint_equiv( \
|
||||
hint, \
|
||||
boost::unordered::detail::func::construct_node_from_args( \
|
||||
table_.node_alloc(), \
|
||||
@ -1202,7 +1204,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
node_type extract(const_iterator position)
|
||||
{
|
||||
return node_type(
|
||||
table_.extract_by_iterator(position), table_.node_alloc());
|
||||
table_.extract_by_iterator_equiv(position), table_.node_alloc());
|
||||
}
|
||||
|
||||
node_type extract(const key_type& k)
|
||||
@ -1212,12 +1214,12 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
|
||||
iterator insert(BOOST_RV_REF(node_type) np)
|
||||
{
|
||||
return table_.move_insert_node_type(np);
|
||||
return table_.move_insert_node_type_equiv(np);
|
||||
}
|
||||
|
||||
iterator insert(const_iterator hint, BOOST_RV_REF(node_type) np)
|
||||
{
|
||||
return table_.move_insert_node_type_with_hint(hint, np);
|
||||
return table_.move_insert_node_type_with_hint_equiv(hint, np);
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
@ -1376,8 +1378,13 @@ unordered_map<K, T, H, P, A>::unordered_map(InputIt f, InputIt l, size_type n,
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
unordered_map<K, T, H, P, A>::unordered_map(unordered_map const& other)
|
||||
: table_(other.table_)
|
||||
: table_(other.table_,
|
||||
unordered_map::value_allocator_traits::
|
||||
select_on_container_copy_construction(other.get_allocator()))
|
||||
{
|
||||
if (other.table_.size_) {
|
||||
table_.copy_buckets_unique(other.table_);
|
||||
}
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
@ -1392,6 +1399,9 @@ unordered_map<K, T, H, P, A>::unordered_map(
|
||||
unordered_map const& other, allocator_type const& a)
|
||||
: table_(other.table_, a)
|
||||
{
|
||||
if (other.table_.size_) {
|
||||
table_.copy_buckets_unique(other.table_);
|
||||
}
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
@ -1399,6 +1409,12 @@ unordered_map<K, T, H, P, A>::unordered_map(
|
||||
BOOST_RV_REF(unordered_map) other, allocator_type const& a)
|
||||
: table_(other.table_, a, boost::unordered::detail::move_tag())
|
||||
{
|
||||
if (table_.node_alloc() == other.table_.node_alloc()) {
|
||||
table_.move_buckets_from(other.table_);
|
||||
} else if (other.table_.size_) {
|
||||
// TODO: Could pick new bucket size?
|
||||
table_.move_buckets(other.table_);
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
@ -1515,7 +1531,7 @@ template <class InputIt>
|
||||
void unordered_map<K, T, H, P, A>::insert(InputIt first, InputIt last)
|
||||
{
|
||||
if (first != last) {
|
||||
table_.insert_range_impl(
|
||||
table_.insert_range_unique(
|
||||
table::extractor::extract(*first), first, last);
|
||||
}
|
||||
}
|
||||
@ -1536,7 +1552,7 @@ unordered_map<K, T, H, P, A>::erase(iterator position)
|
||||
node_pointer node = table::get_node(position);
|
||||
BOOST_ASSERT(node);
|
||||
node_pointer next = table::node_algo::next_node(node);
|
||||
table_.erase_nodes(node, next);
|
||||
table_.erase_nodes_unique(node, next);
|
||||
return iterator(next);
|
||||
}
|
||||
|
||||
@ -1547,7 +1563,7 @@ unordered_map<K, T, H, P, A>::erase(const_iterator position)
|
||||
node_pointer node = table::get_node(position);
|
||||
BOOST_ASSERT(node);
|
||||
node_pointer next = table::node_algo::next_node(node);
|
||||
table_.erase_nodes(node, next);
|
||||
table_.erase_nodes_unique(node, next);
|
||||
return iterator(next);
|
||||
}
|
||||
|
||||
@ -1555,7 +1571,7 @@ template <class K, class T, class H, class P, class A>
|
||||
typename unordered_map<K, T, H, P, A>::size_type
|
||||
unordered_map<K, T, H, P, A>::erase(const key_type& k)
|
||||
{
|
||||
return table_.erase_key(k);
|
||||
return table_.erase_key_unique(k);
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
@ -1565,7 +1581,7 @@ unordered_map<K, T, H, P, A>::erase(const_iterator first, const_iterator last)
|
||||
node_pointer last_node = table::get_node(last);
|
||||
if (first == last)
|
||||
return iterator(last_node);
|
||||
table_.erase_nodes(table::get_node(first), last_node);
|
||||
table_.erase_nodes_unique(table::get_node(first), last_node);
|
||||
return iterator(last_node);
|
||||
}
|
||||
|
||||
@ -1593,7 +1609,7 @@ template <typename H2, typename P2>
|
||||
void unordered_map<K, T, H, P, A>::merge(
|
||||
boost::unordered_map<K, T, H2, P2, A>& source)
|
||||
{
|
||||
table_.merge_impl(source.table_);
|
||||
table_.merge_unique(source.table_);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
@ -1602,7 +1618,7 @@ template <typename H2, typename P2>
|
||||
void unordered_map<K, T, H, P, A>::merge(
|
||||
boost::unordered_map<K, T, H2, P2, A>&& source)
|
||||
{
|
||||
table_.merge_impl(source.table_);
|
||||
table_.merge_unique(source.table_);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1612,7 +1628,7 @@ template <typename H2, typename P2>
|
||||
void unordered_map<K, T, H, P, A>::merge(
|
||||
boost::unordered_multimap<K, T, H2, P2, A>& source)
|
||||
{
|
||||
table_.merge_impl(source.table_);
|
||||
table_.merge_unique(source.table_);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
@ -1621,7 +1637,7 @@ template <typename H2, typename P2>
|
||||
void unordered_map<K, T, H, P, A>::merge(
|
||||
boost::unordered_multimap<K, T, H2, P2, A>&& source)
|
||||
{
|
||||
table_.merge_impl(source.table_);
|
||||
table_.merge_unique(source.table_);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -1709,14 +1725,14 @@ template <class K, class T, class H, class P, class A>
|
||||
typename unordered_map<K, T, H, P, A>::mapped_type&
|
||||
unordered_map<K, T, H, P, A>::operator[](const key_type& k)
|
||||
{
|
||||
return table_.try_emplace_impl(k).first->second;
|
||||
return table_.try_emplace_unique(k).first->second;
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
typename unordered_map<K, T, H, P, A>::mapped_type&
|
||||
unordered_map<K, T, H, P, A>::operator[](BOOST_RV_REF(key_type) k)
|
||||
{
|
||||
return table_.try_emplace_impl(boost::move(k)).first->second;
|
||||
return table_.try_emplace_unique(boost::move(k)).first->second;
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
@ -1793,7 +1809,7 @@ inline bool operator==(unordered_map<K, T, H, P, A> const& m1,
|
||||
unordered_map<K, T, H, P, A> x;
|
||||
};
|
||||
#endif
|
||||
return m1.table_.equals(m2.table_);
|
||||
return m1.table_.equals_unique(m2.table_);
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
@ -1806,7 +1822,7 @@ inline bool operator!=(unordered_map<K, T, H, P, A> const& m1,
|
||||
unordered_map<K, T, H, P, A> x;
|
||||
};
|
||||
#endif
|
||||
return !m1.table_.equals(m2.table_);
|
||||
return !m1.table_.equals_unique(m2.table_);
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
@ -1852,8 +1868,13 @@ unordered_multimap<K, T, H, P, A>::unordered_multimap(InputIt f, InputIt l,
|
||||
template <class K, class T, class H, class P, class A>
|
||||
unordered_multimap<K, T, H, P, A>::unordered_multimap(
|
||||
unordered_multimap const& other)
|
||||
: table_(other.table_)
|
||||
: table_(other.table_,
|
||||
unordered_multimap::value_allocator_traits::
|
||||
select_on_container_copy_construction(other.get_allocator()))
|
||||
{
|
||||
if (other.table_.size_) {
|
||||
table_.copy_buckets_equiv(other.table_);
|
||||
}
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
@ -1868,6 +1889,9 @@ unordered_multimap<K, T, H, P, A>::unordered_multimap(
|
||||
unordered_multimap const& other, allocator_type const& a)
|
||||
: table_(other.table_, a)
|
||||
{
|
||||
if (other.table_.size_) {
|
||||
table_.copy_buckets_equiv(other.table_);
|
||||
}
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
@ -1875,6 +1899,12 @@ unordered_multimap<K, T, H, P, A>::unordered_multimap(
|
||||
BOOST_RV_REF(unordered_multimap) other, allocator_type const& a)
|
||||
: table_(other.table_, a, boost::unordered::detail::move_tag())
|
||||
{
|
||||
if (table_.node_alloc() == other.table_.node_alloc()) {
|
||||
table_.move_buckets_from(other.table_);
|
||||
} else if (other.table_.size_) {
|
||||
// TODO: Could pick new bucket size?
|
||||
table_.move_buckets_equiv(other.table_);
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
@ -1990,7 +2020,7 @@ template <class K, class T, class H, class P, class A>
|
||||
template <class InputIt>
|
||||
void unordered_multimap<K, T, H, P, A>::insert(InputIt first, InputIt last)
|
||||
{
|
||||
table_.insert_range(first, last);
|
||||
table_.insert_range_equiv(first, last);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
@ -2009,7 +2039,7 @@ unordered_multimap<K, T, H, P, A>::erase(iterator position)
|
||||
node_pointer node = table::get_node(position);
|
||||
BOOST_ASSERT(node);
|
||||
node_pointer next = table::node_algo::next_node(node);
|
||||
table_.erase_nodes(node, next);
|
||||
table_.erase_nodes_equiv(node, next);
|
||||
return iterator(next);
|
||||
}
|
||||
|
||||
@ -2020,7 +2050,7 @@ unordered_multimap<K, T, H, P, A>::erase(const_iterator position)
|
||||
node_pointer node = table::get_node(position);
|
||||
BOOST_ASSERT(node);
|
||||
node_pointer next = table::node_algo::next_node(node);
|
||||
table_.erase_nodes(node, next);
|
||||
table_.erase_nodes_equiv(node, next);
|
||||
return iterator(next);
|
||||
}
|
||||
|
||||
@ -2028,7 +2058,7 @@ template <class K, class T, class H, class P, class A>
|
||||
typename unordered_multimap<K, T, H, P, A>::size_type
|
||||
unordered_multimap<K, T, H, P, A>::erase(const key_type& k)
|
||||
{
|
||||
return table_.erase_key(k);
|
||||
return table_.erase_key_equiv(k);
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
@ -2039,7 +2069,7 @@ unordered_multimap<K, T, H, P, A>::erase(
|
||||
node_pointer last_node = table::get_node(last);
|
||||
if (first == last)
|
||||
return iterator(last_node);
|
||||
table_.erase_nodes(table::get_node(first), last_node);
|
||||
table_.erase_nodes_equiv(table::get_node(first), last_node);
|
||||
return iterator(last_node);
|
||||
}
|
||||
|
||||
@ -2234,7 +2264,7 @@ inline bool operator==(unordered_multimap<K, T, H, P, A> const& m1,
|
||||
unordered_multimap<K, T, H, P, A> x;
|
||||
};
|
||||
#endif
|
||||
return m1.table_.equals(m2.table_);
|
||||
return m1.table_.equals_equiv(m2.table_);
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
@ -2247,7 +2277,7 @@ inline bool operator!=(unordered_multimap<K, T, H, P, A> const& m1,
|
||||
unordered_multimap<K, T, H, P, A> x;
|
||||
};
|
||||
#endif
|
||||
return !m1.table_.equals(m2.table_);
|
||||
return !m1.table_.equals_equiv(m2.table_);
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
@ -2268,10 +2298,7 @@ template <typename N, class K, class T, class A> class node_handle_map
|
||||
{
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(node_handle_map)
|
||||
|
||||
template <typename Types>
|
||||
friend struct ::boost::unordered::detail::table_unique;
|
||||
template <typename Types>
|
||||
friend struct ::boost::unordered::detail::table_equiv;
|
||||
template <typename Types> friend struct ::boost::unordered::detail::table;
|
||||
template <class K2, class T2, class H2, class P2, class A2>
|
||||
friend class boost::unordered::unordered_map;
|
||||
template <class K2, class T2, class H2, class P2, class A2>
|
||||
|
@ -99,6 +99,7 @@ template <class T, class H, class P, class A> class unordered_set
|
||||
BOOST_NOEXCEPT_IF(table::nothrow_move_constructible)
|
||||
: table_(other.table_, boost::unordered::detail::move_tag())
|
||||
{
|
||||
// The move is done in table_
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -220,7 +221,7 @@ template <class T, class H, class P, class A> class unordered_set
|
||||
template <class... Args>
|
||||
std::pair<iterator, bool> emplace(BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
return table_.emplace_impl(
|
||||
return table_.emplace_unique(
|
||||
table::extractor::extract(boost::forward<Args>(args)...),
|
||||
boost::forward<Args>(args)...);
|
||||
}
|
||||
@ -246,7 +247,7 @@ template <class T, class H, class P, class A> class unordered_set
|
||||
template <typename A0>
|
||||
std::pair<iterator, bool> emplace(BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.emplace_impl(
|
||||
return table_.emplace_unique(
|
||||
table::extractor::extract(boost::forward<A0>(a0)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
@ -256,7 +257,7 @@ template <class T, class H, class P, class A> class unordered_set
|
||||
std::pair<iterator, bool> emplace(
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace_impl(
|
||||
return table_.emplace_unique(
|
||||
table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -267,7 +268,7 @@ template <class T, class H, class P, class A> class unordered_set
|
||||
std::pair<iterator, bool> emplace(
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.emplace_impl(
|
||||
return table_.emplace_unique(
|
||||
table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -282,7 +283,7 @@ template <class T, class H, class P, class A> class unordered_set
|
||||
template <class... Args>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
return table_.emplace_hint_impl(hint,
|
||||
return table_.emplace_hint_unique(hint,
|
||||
table::extractor::extract(boost::forward<Args>(args)...),
|
||||
boost::forward<Args>(args)...);
|
||||
}
|
||||
@ -304,17 +305,17 @@ template <class T, class H, class P, class A> class unordered_set
|
||||
template <typename A0>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.emplace_hint_impl(hint,
|
||||
return table_.emplace_hint_unique(hint,
|
||||
table::extractor::extract(boost::forward<A0>(a0)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
boost::forward<A0>(a0)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
iterator emplace_hint(
|
||||
const_iterator hint, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace_hint_impl(
|
||||
return table_.emplace_hint_unique(
|
||||
hint, table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -325,7 +326,7 @@ template <class T, class H, class P, class A> class unordered_set
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.emplace_hint_impl(
|
||||
return table_.emplace_hint_unique(
|
||||
hint, table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -342,7 +343,7 @@ template <class T, class H, class P, class A> class unordered_set
|
||||
std::pair<iterator, bool> emplace( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return table_.emplace_impl( \
|
||||
return table_.emplace_unique( \
|
||||
table::extractor::extract( \
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)), \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
@ -353,7 +354,7 @@ template <class T, class H, class P, class A> class unordered_set
|
||||
iterator emplace_hint(const_iterator hint, \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return table_.emplace_hint_impl( \
|
||||
return table_.emplace_hint_unique( \
|
||||
hint, table::extractor::extract( \
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)), \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
@ -404,7 +405,7 @@ template <class T, class H, class P, class A> class unordered_set
|
||||
node_type extract(const_iterator position)
|
||||
{
|
||||
return node_type(
|
||||
table_.extract_by_iterator(position), table_.node_alloc());
|
||||
table_.extract_by_iterator_unique(position), table_.node_alloc());
|
||||
}
|
||||
|
||||
node_type extract(const key_type& k)
|
||||
@ -415,13 +416,13 @@ template <class T, class H, class P, class A> class unordered_set
|
||||
insert_return_type insert(BOOST_RV_REF(node_type) np)
|
||||
{
|
||||
insert_return_type result;
|
||||
table_.move_insert_node_type(np, result);
|
||||
table_.move_insert_node_type_unique(np, result);
|
||||
return boost::move(result);
|
||||
}
|
||||
|
||||
iterator insert(const_iterator hint, BOOST_RV_REF(node_type) np)
|
||||
{
|
||||
return table_.move_insert_node_type_with_hint(hint, np);
|
||||
return table_.move_insert_node_type_with_hint_unique(hint, np);
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
@ -609,6 +610,7 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
BOOST_NOEXCEPT_IF(table::nothrow_move_constructible)
|
||||
: table_(other.table_, boost::unordered::detail::move_tag())
|
||||
{
|
||||
// The move is done in table_
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -730,7 +732,7 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
|
||||
template <class... Args> iterator emplace(BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
return iterator(table_.emplace_impl(
|
||||
return iterator(table_.emplace_equiv(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(), boost::forward<Args>(args)...)));
|
||||
}
|
||||
@ -754,7 +756,7 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
|
||||
template <typename A0> iterator emplace(BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return iterator(table_.emplace_impl(
|
||||
return iterator(table_.emplace_equiv(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -764,7 +766,7 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
template <typename A0, typename A1>
|
||||
iterator emplace(BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return iterator(table_.emplace_impl(
|
||||
return iterator(table_.emplace_equiv(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -775,7 +777,7 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
iterator emplace(
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return iterator(table_.emplace_impl(
|
||||
return iterator(table_.emplace_equiv(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -790,7 +792,7 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
template <class... Args>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
return iterator(table_.emplace_hint_impl(
|
||||
return iterator(table_.emplace_hint_equiv(
|
||||
hint, boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(), boost::forward<Args>(args)...)));
|
||||
}
|
||||
@ -812,7 +814,7 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
template <typename A0>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return iterator(table_.emplace_hint_impl(
|
||||
return iterator(table_.emplace_hint_equiv(
|
||||
hint, boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -823,7 +825,7 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
iterator emplace_hint(
|
||||
const_iterator hint, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return iterator(table_.emplace_hint_impl(
|
||||
return iterator(table_.emplace_hint_equiv(
|
||||
hint, boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -834,7 +836,7 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return iterator(table_.emplace_hint_impl(
|
||||
return iterator(table_.emplace_hint_equiv(
|
||||
hint, boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
@ -850,7 +852,7 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
|
||||
iterator emplace(BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return iterator(table_.emplace_impl( \
|
||||
return iterator(table_.emplace_equiv( \
|
||||
boost::unordered::detail::func::construct_node_from_args( \
|
||||
table_.node_alloc(), \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
@ -861,7 +863,7 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
iterator emplace_hint(const_iterator hint, \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return iterator(table_.emplace_hint_impl( \
|
||||
return iterator(table_.emplace_hint_equiv( \
|
||||
hint, \
|
||||
boost::unordered::detail::func::construct_node_from_args( \
|
||||
table_.node_alloc(), \
|
||||
@ -910,7 +912,7 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
node_type extract(const_iterator position)
|
||||
{
|
||||
return node_type(
|
||||
table_.extract_by_iterator(position), table_.node_alloc());
|
||||
table_.extract_by_iterator_equiv(position), table_.node_alloc());
|
||||
}
|
||||
|
||||
node_type extract(const key_type& k)
|
||||
@ -920,12 +922,12 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
|
||||
iterator insert(BOOST_RV_REF(node_type) np)
|
||||
{
|
||||
return table_.move_insert_node_type(np);
|
||||
return table_.move_insert_node_type_equiv(np);
|
||||
}
|
||||
|
||||
iterator insert(const_iterator hint, BOOST_RV_REF(node_type) np)
|
||||
{
|
||||
return table_.move_insert_node_type_with_hint(hint, np);
|
||||
return table_.move_insert_node_type_with_hint_equiv(hint, np);
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
@ -1075,8 +1077,13 @@ unordered_set<T, H, P, A>::unordered_set(InputIt f, InputIt l, size_type n,
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
unordered_set<T, H, P, A>::unordered_set(unordered_set const& other)
|
||||
: table_(other.table_)
|
||||
: table_(other.table_,
|
||||
unordered_set::value_allocator_traits::
|
||||
select_on_container_copy_construction(other.get_allocator()))
|
||||
{
|
||||
if (other.table_.size_) {
|
||||
table_.copy_buckets_unique(other.table_);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
@ -1091,6 +1098,9 @@ unordered_set<T, H, P, A>::unordered_set(
|
||||
unordered_set const& other, allocator_type const& a)
|
||||
: table_(other.table_, a)
|
||||
{
|
||||
if (other.table_.size_) {
|
||||
table_.copy_buckets_unique(other.table_);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
@ -1098,6 +1108,12 @@ unordered_set<T, H, P, A>::unordered_set(
|
||||
BOOST_RV_REF(unordered_set) other, allocator_type const& a)
|
||||
: table_(other.table_, a, boost::unordered::detail::move_tag())
|
||||
{
|
||||
if (table_.node_alloc() == other.table_.node_alloc()) {
|
||||
table_.move_buckets_from(other.table_);
|
||||
} else if (other.table_.size_) {
|
||||
// TODO: Could pick new bucket size?
|
||||
table_.move_buckets(other.table_);
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
@ -1211,7 +1227,7 @@ template <class InputIt>
|
||||
void unordered_set<T, H, P, A>::insert(InputIt first, InputIt last)
|
||||
{
|
||||
if (first != last) {
|
||||
table_.insert_range_impl(
|
||||
table_.insert_range_unique(
|
||||
table::extractor::extract(*first), first, last);
|
||||
}
|
||||
}
|
||||
@ -1231,7 +1247,7 @@ typename unordered_set<T, H, P, A>::iterator unordered_set<T, H, P, A>::erase(
|
||||
node_pointer node = table::get_node(position);
|
||||
BOOST_ASSERT(node);
|
||||
node_pointer next = table::node_algo::next_node(node);
|
||||
table_.erase_nodes(node, next);
|
||||
table_.erase_nodes_unique(node, next);
|
||||
return iterator(next);
|
||||
}
|
||||
|
||||
@ -1239,7 +1255,7 @@ template <class T, class H, class P, class A>
|
||||
typename unordered_set<T, H, P, A>::size_type unordered_set<T, H, P, A>::erase(
|
||||
const key_type& k)
|
||||
{
|
||||
return table_.erase_key(k);
|
||||
return table_.erase_key_unique(k);
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
@ -1249,7 +1265,7 @@ typename unordered_set<T, H, P, A>::iterator unordered_set<T, H, P, A>::erase(
|
||||
node_pointer last_node = table::get_node(last);
|
||||
if (first == last)
|
||||
return iterator(last_node);
|
||||
table_.erase_nodes(table::get_node(first), last_node);
|
||||
table_.erase_nodes_unique(table::get_node(first), last_node);
|
||||
return iterator(last_node);
|
||||
}
|
||||
|
||||
@ -1293,7 +1309,7 @@ template <typename H2, typename P2>
|
||||
void unordered_set<T, H, P, A>::merge(
|
||||
boost::unordered_set<T, H2, P2, A>& source)
|
||||
{
|
||||
table_.merge_impl(source.table_);
|
||||
table_.merge_unique(source.table_);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
@ -1302,7 +1318,7 @@ template <typename H2, typename P2>
|
||||
void unordered_set<T, H, P, A>::merge(
|
||||
boost::unordered_set<T, H2, P2, A>&& source)
|
||||
{
|
||||
table_.merge_impl(source.table_);
|
||||
table_.merge_unique(source.table_);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1312,7 +1328,7 @@ template <typename H2, typename P2>
|
||||
void unordered_set<T, H, P, A>::merge(
|
||||
boost::unordered_multiset<T, H2, P2, A>& source)
|
||||
{
|
||||
table_.merge_impl(source.table_);
|
||||
table_.merge_unique(source.table_);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
@ -1321,7 +1337,7 @@ template <typename H2, typename P2>
|
||||
void unordered_set<T, H, P, A>::merge(
|
||||
boost::unordered_multiset<T, H2, P2, A>&& source)
|
||||
{
|
||||
table_.merge_impl(source.table_);
|
||||
table_.merge_unique(source.table_);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -1408,7 +1424,7 @@ inline bool operator==(
|
||||
unordered_set<T, H, P, A> x;
|
||||
};
|
||||
#endif
|
||||
return m1.table_.equals(m2.table_);
|
||||
return m1.table_.equals_unique(m2.table_);
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
@ -1421,7 +1437,7 @@ inline bool operator!=(
|
||||
unordered_set<T, H, P, A> x;
|
||||
};
|
||||
#endif
|
||||
return !m1.table_.equals(m2.table_);
|
||||
return !m1.table_.equals_unique(m2.table_);
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
@ -1466,8 +1482,13 @@ unordered_multiset<T, H, P, A>::unordered_multiset(InputIt f, InputIt l,
|
||||
template <class T, class H, class P, class A>
|
||||
unordered_multiset<T, H, P, A>::unordered_multiset(
|
||||
unordered_multiset const& other)
|
||||
: table_(other.table_)
|
||||
: table_(other.table_,
|
||||
unordered_multiset::value_allocator_traits::
|
||||
select_on_container_copy_construction(other.get_allocator()))
|
||||
{
|
||||
if (other.table_.size_) {
|
||||
table_.copy_buckets_equiv(other.table_);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
@ -1482,6 +1503,9 @@ unordered_multiset<T, H, P, A>::unordered_multiset(
|
||||
unordered_multiset const& other, allocator_type const& a)
|
||||
: table_(other.table_, a)
|
||||
{
|
||||
if (other.table_.size_) {
|
||||
table_.copy_buckets_equiv(other.table_);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
@ -1489,6 +1513,12 @@ unordered_multiset<T, H, P, A>::unordered_multiset(
|
||||
BOOST_RV_REF(unordered_multiset) other, allocator_type const& a)
|
||||
: table_(other.table_, a, boost::unordered::detail::move_tag())
|
||||
{
|
||||
if (table_.node_alloc() == other.table_.node_alloc()) {
|
||||
table_.move_buckets_from(other.table_);
|
||||
} else if (other.table_.size_) {
|
||||
// TODO: Could pick new bucket size?
|
||||
table_.move_buckets_equiv(other.table_);
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
@ -1604,7 +1634,7 @@ template <class T, class H, class P, class A>
|
||||
template <class InputIt>
|
||||
void unordered_multiset<T, H, P, A>::insert(InputIt first, InputIt last)
|
||||
{
|
||||
table_.insert_range(first, last);
|
||||
table_.insert_range_equiv(first, last);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
@ -1623,7 +1653,7 @@ unordered_multiset<T, H, P, A>::erase(const_iterator position)
|
||||
node_pointer node = table::get_node(position);
|
||||
BOOST_ASSERT(node);
|
||||
node_pointer next = table::node_algo::next_node(node);
|
||||
table_.erase_nodes(node, next);
|
||||
table_.erase_nodes_equiv(node, next);
|
||||
return iterator(next);
|
||||
}
|
||||
|
||||
@ -1631,7 +1661,7 @@ template <class T, class H, class P, class A>
|
||||
typename unordered_multiset<T, H, P, A>::size_type
|
||||
unordered_multiset<T, H, P, A>::erase(const key_type& k)
|
||||
{
|
||||
return table_.erase_key(k);
|
||||
return table_.erase_key_equiv(k);
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
@ -1641,7 +1671,7 @@ unordered_multiset<T, H, P, A>::erase(const_iterator first, const_iterator last)
|
||||
node_pointer last_node = table::get_node(last);
|
||||
if (first == last)
|
||||
return iterator(last_node);
|
||||
table_.erase_nodes(table::get_node(first), last_node);
|
||||
table_.erase_nodes_equiv(table::get_node(first), last_node);
|
||||
return iterator(last_node);
|
||||
}
|
||||
|
||||
@ -1809,7 +1839,7 @@ inline bool operator==(unordered_multiset<T, H, P, A> const& m1,
|
||||
unordered_multiset<T, H, P, A> x;
|
||||
};
|
||||
#endif
|
||||
return m1.table_.equals(m2.table_);
|
||||
return m1.table_.equals_equiv(m2.table_);
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
@ -1822,7 +1852,7 @@ inline bool operator!=(unordered_multiset<T, H, P, A> const& m1,
|
||||
unordered_multiset<T, H, P, A> x;
|
||||
};
|
||||
#endif
|
||||
return !m1.table_.equals(m2.table_);
|
||||
return !m1.table_.equals_equiv(m2.table_);
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
@ -1843,10 +1873,7 @@ template <typename N, typename T, typename A> class node_handle_set
|
||||
{
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(node_handle_set)
|
||||
|
||||
template <typename Types>
|
||||
friend struct ::boost::unordered::detail::table_unique;
|
||||
template <typename Types>
|
||||
friend struct ::boost::unordered::detail::table_equiv;
|
||||
template <typename Types> friend struct ::boost::unordered::detail::table;
|
||||
template <class T2, class H2, class P2, class A2>
|
||||
friend class unordered_set;
|
||||
template <class T2, class H2, class P2, class A2>
|
||||
|
@ -65,6 +65,11 @@ template <typename T> struct allocator : std::allocator<T>
|
||||
allocator(const allocator<T2>& other) : std::allocator<T>(other)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T2>
|
||||
allocator(const std::allocator<T2>& other) : std::allocator<T>(other)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// Declare some members of a structs.
|
||||
|
Reference in New Issue
Block a user