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:
Daniel James
2017-04-23 10:09:18 +01:00
parent 42b6b13943
commit f6f5ecdc00
3 changed files with 224 additions and 229 deletions

View File

@ -3890,81 +3890,6 @@ struct table_unique : boost::unordered::detail::table<Types>
return this->add_node(b.release(), key_hash);
}
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
emplace_return emplace(boost::unordered::detail::emplace_args1<
boost::unordered::detail::please_ignore_this_overload> const&)
{
BOOST_ASSERT(false);
return emplace_return(iterator(), false);
}
iterator emplace_hint(
c_iterator,
boost::unordered::detail::emplace_args1<
boost::unordered::detail::please_ignore_this_overload> const&)
{
BOOST_ASSERT(false);
return iterator();
}
#else
emplace_return emplace(
boost::unordered::detail::please_ignore_this_overload const&)
{
BOOST_ASSERT(false);
return emplace_return(iterator(), false);
}
iterator emplace_hint(c_iterator,
boost::unordered::detail::please_ignore_this_overload const&)
{
BOOST_ASSERT(false);
return iterator();
}
#endif
#endif
template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
emplace_return emplace(BOOST_UNORDERED_EMPLACE_ARGS)
{
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
return emplace_impl(extractor::extract(BOOST_UNORDERED_EMPLACE_FORWARD),
BOOST_UNORDERED_EMPLACE_FORWARD);
#else
return emplace_impl(extractor::extract(args.a0, args.a1),
BOOST_UNORDERED_EMPLACE_FORWARD);
#endif
}
template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
iterator emplace_hint(c_iterator hint, BOOST_UNORDERED_EMPLACE_ARGS)
{
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
return emplace_hint_impl(hint,
extractor::extract(BOOST_UNORDERED_EMPLACE_FORWARD),
BOOST_UNORDERED_EMPLACE_FORWARD);
#else
return emplace_hint_impl(hint, extractor::extract(args.a0, args.a1),
BOOST_UNORDERED_EMPLACE_FORWARD);
#endif
}
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <typename A0>
emplace_return emplace(
boost::unordered::detail::emplace_args1<A0> const& args)
{
return emplace_impl(extractor::extract(args.a0), args);
}
template <typename A0>
iterator emplace_hint(c_iterator hint,
boost::unordered::detail::emplace_args1<A0> const& args)
{
return emplace_hint_impl(hint, extractor::extract(args.a0), args);
}
#endif
template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
iterator emplace_hint_impl(
c_iterator hint, const_key_type& k, BOOST_UNORDERED_EMPLACE_ARGS)
@ -4786,56 +4711,6 @@ struct table_equiv : boost::unordered::detail::table<Types>
return n;
}
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
iterator emplace(boost::unordered::detail::emplace_args1<
boost::unordered::detail::please_ignore_this_overload> const&)
{
BOOST_ASSERT(false);
return iterator();
}
iterator emplace_hint(
c_iterator,
boost::unordered::detail::emplace_args1<
boost::unordered::detail::please_ignore_this_overload> const&)
{
BOOST_ASSERT(false);
return iterator();
}
#else
iterator emplace(
boost::unordered::detail::please_ignore_this_overload const&)
{
BOOST_ASSERT(false);
return iterator();
}
iterator emplace_hint(c_iterator,
boost::unordered::detail::please_ignore_this_overload const&)
{
BOOST_ASSERT(false);
return iterator();
}
#endif
#endif
template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
iterator emplace(BOOST_UNORDERED_EMPLACE_ARGS)
{
return iterator(emplace_impl(
boost::unordered::detail::func::construct_node_from_args(
this->node_alloc(), BOOST_UNORDERED_EMPLACE_FORWARD)));
}
template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
iterator emplace_hint(c_iterator hint, BOOST_UNORDERED_EMPLACE_ARGS)
{
return iterator(emplace_hint_impl(
hint, boost::unordered::detail::func::construct_node_from_args(
this->node_alloc(), BOOST_UNORDERED_EMPLACE_FORWARD)));
}
iterator emplace_impl(node_pointer n)
{
node_tmp a(n, this->node_alloc());

View File

@ -220,7 +220,9 @@ 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(boost::forward<Args>(args)...);
return table_.emplace_impl(
table::extractor::extract(boost::forward<Args>(args)...),
boost::forward<Args>(args)...);
}
#else
@ -244,25 +246,33 @@ 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(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
@ -272,7 +282,9 @@ 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(hint, boost::forward<Args>(args)...);
return table_.emplace_hint_impl(hint,
table::extractor::extract(boost::forward<Args>(args)...),
boost::forward<Args>(args)...);
}
#else
@ -292,28 +304,33 @@ 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(
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
@ -325,21 +342,32 @@ 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(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, _)
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
@ -625,8 +653,8 @@ template <class K, class T, class H, class P, class A> class unordered_map
n, BOOST_UNORDERED_CALL_FORWARD, a))); \
}
BOOST_PP_REPEAT_FROM_TO(
4, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT), BOOST_UNORDERED_TRY_EMPLACE, _)
BOOST_PP_REPEAT_FROM_TO(4, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT),
BOOST_UNORDERED_TRY_EMPLACE, _)
#undef BOOST_UNORDERED_TRY_EMPLACE
@ -972,7 +1000,9 @@ 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 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
@ -994,24 +1024,33 @@ 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 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
@ -1021,7 +1060,9 @@ 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 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
@ -1041,27 +1082,34 @@ 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 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
@ -1072,21 +1120,33 @@ 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 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, _)
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

View File

@ -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