forked from boostorg/unordered
Group together similar overloads of try_emplace
This commit is contained in:
@ -489,18 +489,28 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
|
||||
#else
|
||||
|
||||
// In order to make this a template, this handles both:
|
||||
// try_emplace(key const&)
|
||||
// try_emplace(key&&)
|
||||
|
||||
template <typename Key>
|
||||
std::pair<iterator, bool> try_emplace(BOOST_FWD_REF(Key) k)
|
||||
{
|
||||
return table_.try_emplace_unique(boost::forward<Key>(k));
|
||||
}
|
||||
|
||||
// In order to make this a template, this handles both:
|
||||
// try_emplace(const_iterator hint, key const&)
|
||||
// try_emplace(const_iterator hint, key&&)
|
||||
|
||||
template <typename Key>
|
||||
iterator try_emplace(const_iterator hint, BOOST_FWD_REF(Key) k)
|
||||
{
|
||||
return table_.try_emplace_hint_unique(hint, boost::forward<Key>(k));
|
||||
}
|
||||
|
||||
// try_emplace(key const&, Args&&...)
|
||||
|
||||
template <typename A0>
|
||||
std::pair<iterator, bool> try_emplace(
|
||||
key_type const& k, BOOST_FWD_REF(A0) a0)
|
||||
@ -510,33 +520,6 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
boost::forward<A0>(a0)));
|
||||
}
|
||||
|
||||
template <typename A0>
|
||||
iterator try_emplace(
|
||||
const_iterator hint, key_type const& k, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, k, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
}
|
||||
|
||||
template <typename A0>
|
||||
std::pair<iterator, bool> try_emplace(
|
||||
BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.try_emplace_unique(
|
||||
boost::move(k), boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
}
|
||||
|
||||
template <typename A0>
|
||||
iterator try_emplace(
|
||||
const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, boost::move(k), boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
std::pair<iterator, bool> try_emplace(
|
||||
key_type const& k, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
@ -546,35 +529,6 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
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_unique(
|
||||
hint, k, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
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_unique(
|
||||
boost::move(k),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
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_unique(
|
||||
hint, boost::move(k),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
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)
|
||||
@ -585,6 +539,26 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
boost::forward<A2>(a2)));
|
||||
}
|
||||
|
||||
// try_emplace(const_iterator hint, key const&, Args&&...)
|
||||
|
||||
template <typename A0>
|
||||
iterator try_emplace(
|
||||
const_iterator hint, key_type const& k, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, k, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
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_unique(
|
||||
hint, k, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
iterator try_emplace(const_iterator hint, key_type const& k,
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
@ -597,6 +571,27 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
.first;
|
||||
}
|
||||
|
||||
// try_emplace(key&&, Args&&...)
|
||||
|
||||
template <typename A0>
|
||||
std::pair<iterator, bool> try_emplace(
|
||||
BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.try_emplace_unique(
|
||||
boost::move(k), boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
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_unique(
|
||||
boost::move(k),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
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)
|
||||
@ -607,6 +602,27 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
boost::forward<A2>(a2)));
|
||||
}
|
||||
|
||||
// try_emplace(const_iterator hint, key&&, Args&&...)
|
||||
|
||||
template <typename A0>
|
||||
iterator try_emplace(
|
||||
const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, boost::move(k), boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
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_unique(
|
||||
hint, boost::move(k),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
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)
|
||||
|
Reference in New Issue
Block a user