forked from boostorg/unordered
Expand calls to emplace implementation
Also manually call the emplace macro up to 9 arguments, nicer error messages for little effort. Does it matter that there's no longer a nice backend for `please_ignore_this_overload`? I don't think so, I was worried that it would be confusing if triggered, but I'm not really aware of that ever happening.
This commit is contained in:
@@ -218,7 +218,9 @@ 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(boost::forward<Args>(args)...);
|
||||
return table_.emplace_impl(
|
||||
table::extractor::extract(boost::forward<Args>(args)...),
|
||||
boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -242,25 +244,33 @@ 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(boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
return table_.emplace_impl(
|
||||
table::extractor::extract(boost::forward<A0>(a0)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
std::pair<iterator, bool> emplace(
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace(boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
return table_.emplace_impl(
|
||||
table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
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> emplace(
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.emplace(boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)));
|
||||
return table_.emplace_impl(
|
||||
table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)));
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -270,7 +280,9 @@ 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(hint, boost::forward<Args>(args)...);
|
||||
return table_.emplace_hint_impl(hint,
|
||||
table::extractor::extract(boost::forward<Args>(args)...),
|
||||
boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -290,28 +302,33 @@ 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(
|
||||
hint, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
return table_.emplace_hint_impl(hint,
|
||||
table::extractor::extract(boost::forward<A0>(a0)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
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(
|
||||
hint, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
return table_.emplace_hint_impl(
|
||||
hint, table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
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(
|
||||
hint, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)));
|
||||
return table_.emplace_hint_impl(
|
||||
hint, table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)));
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -323,20 +340,31 @@ 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(boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \
|
||||
return table_.emplace_impl( \
|
||||
table::extractor::extract( \
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)), \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \
|
||||
} \
|
||||
\
|
||||
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
|
||||
iterator emplace_hint(const_iterator hint, \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return table_.emplace_hint( \
|
||||
hint, boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \
|
||||
return table_.emplace_hint_impl( \
|
||||
hint, table::extractor::extract( \
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)), \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \
|
||||
}
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(4, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT),
|
||||
BOOST_UNORDERED_EMPLACE(1, 4, _)
|
||||
BOOST_UNORDERED_EMPLACE(1, 5, _)
|
||||
BOOST_UNORDERED_EMPLACE(1, 6, _)
|
||||
BOOST_UNORDERED_EMPLACE(1, 7, _)
|
||||
BOOST_UNORDERED_EMPLACE(1, 8, _)
|
||||
BOOST_UNORDERED_EMPLACE(1, 9, _)
|
||||
BOOST_PP_REPEAT_FROM_TO(10, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT),
|
||||
BOOST_UNORDERED_EMPLACE, _)
|
||||
|
||||
#undef BOOST_UNORDERED_EMPLACE
|
||||
@@ -695,9 +723,12 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
// emplace
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template <class... Args> iterator emplace(BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
return table_.emplace(boost::forward<Args>(args)...);
|
||||
return iterator(table_.emplace_impl(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(), boost::forward<Args>(args)...)));
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -719,24 +750,33 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
|
||||
template <typename A0> iterator emplace(BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.emplace(boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
return iterator(table_.emplace_impl(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)))));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
iterator emplace(BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace(boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
return iterator(table_.emplace_impl(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)))));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
iterator emplace(
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.emplace(boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)));
|
||||
return iterator(table_.emplace_impl(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)))));
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -746,7 +786,9 @@ 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 table_.emplace_hint(hint, boost::forward<Args>(args)...);
|
||||
return iterator(table_.emplace_hint_impl(
|
||||
hint, boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(), boost::forward<Args>(args)...)));
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -766,28 +808,34 @@ 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 table_.emplace_hint(
|
||||
hint, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
return iterator(table_.emplace_hint_impl(
|
||||
hint, boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
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(
|
||||
hint, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
return iterator(table_.emplace_hint_impl(
|
||||
hint, boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)))));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
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(
|
||||
hint, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)));
|
||||
return iterator(table_.emplace_hint_impl(
|
||||
hint, boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)))));
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -798,20 +846,32 @@ 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 table_.emplace(boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \
|
||||
return iterator(table_.emplace_impl( \
|
||||
boost::unordered::detail::func::construct_node_from_args( \
|
||||
table_.node_alloc(), \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))))); \
|
||||
} \
|
||||
\
|
||||
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
|
||||
iterator emplace_hint(const_iterator hint, \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return table_.emplace_hint( \
|
||||
hint, boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \
|
||||
return iterator(table_.emplace_hint_impl( \
|
||||
hint, \
|
||||
boost::unordered::detail::func::construct_node_from_args( \
|
||||
table_.node_alloc(), \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))))); \
|
||||
}
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(4, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT),
|
||||
BOOST_UNORDERED_EMPLACE(1, 4, _)
|
||||
BOOST_UNORDERED_EMPLACE(1, 5, _)
|
||||
BOOST_UNORDERED_EMPLACE(1, 6, _)
|
||||
BOOST_UNORDERED_EMPLACE(1, 7, _)
|
||||
BOOST_UNORDERED_EMPLACE(1, 8, _)
|
||||
BOOST_UNORDERED_EMPLACE(1, 9, _)
|
||||
BOOST_PP_REPEAT_FROM_TO(10, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT),
|
||||
BOOST_UNORDERED_EMPLACE, _)
|
||||
|
||||
#undef BOOST_UNORDERED_EMPLACE
|
||||
|
Reference in New Issue
Block a user