forked from boostorg/unordered
Unordered: Manually write out some overloads for emplace.
Clang creates horrific error messages for Boost.Preprocessor based code, so for small number of arguments manually write out a few important functions. Not doing this everywhere. [SVN r75743]
This commit is contained in:
@ -379,7 +379,32 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std)
|
|||||||
args.a)); \
|
args.a)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT,
|
template <typename T, typename A0>
|
||||||
|
inline void construct_impl(T* address, emplace_args1<A0> const& args)
|
||||||
|
{
|
||||||
|
new((void*) address) T(boost::forward<A0>(args.a0));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename A0, typename A1>
|
||||||
|
inline void construct_impl(T* address, emplace_args2<A0, A1> const& args)
|
||||||
|
{
|
||||||
|
new((void*) address) T(
|
||||||
|
boost::forward<A0>(args.a0),
|
||||||
|
boost::forward<A1>(args.a1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename A0, typename A1, typename A2>
|
||||||
|
inline void construct_impl(T* address, emplace_args3<A0, A1, A2> const& args)
|
||||||
|
{
|
||||||
|
new((void*) address) T(
|
||||||
|
boost::forward<A0>(args.a0),
|
||||||
|
boost::forward<A1>(args.a1),
|
||||||
|
boost::forward<A2>(args.a2)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||||
BOOST_UNORDERED_CONSTRUCT_IMPL, _)
|
BOOST_UNORDERED_CONSTRUCT_IMPL, _)
|
||||||
|
|
||||||
#undef BOOST_UNORDERED_CONSTRUCT_IMPL
|
#undef BOOST_UNORDERED_CONSTRUCT_IMPL
|
||||||
|
@ -222,6 +222,64 @@ namespace unordered
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
template <typename A0>
|
||||||
|
std::pair<iterator, bool> emplace(BOOST_FWD_REF(A0) a0)
|
||||||
|
{
|
||||||
|
return table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename A0>
|
||||||
|
iterator emplace_hint(const_iterator, BOOST_FWD_REF(A0) a0)
|
||||||
|
{
|
||||||
|
return table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0)
|
||||||
|
).first;
|
||||||
|
}
|
||||||
|
|
||||||
|
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(a0, a1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename A0, typename A1>
|
||||||
|
iterator emplace_hint(const_iterator,
|
||||||
|
BOOST_FWD_REF(A0) a0,
|
||||||
|
BOOST_FWD_REF(A1) a1)
|
||||||
|
{
|
||||||
|
return table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0, a1)
|
||||||
|
).first;
|
||||||
|
}
|
||||||
|
|
||||||
|
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(a0, a1, a2)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename A0, typename A1, typename A2>
|
||||||
|
iterator emplace_hint(const_iterator,
|
||||||
|
BOOST_FWD_REF(A0) a0,
|
||||||
|
BOOST_FWD_REF(A1) a1,
|
||||||
|
BOOST_FWD_REF(A2) a2)
|
||||||
|
{
|
||||||
|
return table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0, a1, a2)
|
||||||
|
).first;
|
||||||
|
}
|
||||||
|
|
||||||
#define BOOST_UNORDERED_EMPLACE(z, n, _) \
|
#define BOOST_UNORDERED_EMPLACE(z, n, _) \
|
||||||
template < \
|
template < \
|
||||||
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
|
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
|
||||||
@ -245,14 +303,14 @@ namespace unordered
|
|||||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
|
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
|
||||||
) \
|
) \
|
||||||
{ \
|
{ \
|
||||||
return iterator(table_.emplace( \
|
return table_.emplace( \
|
||||||
boost::unordered::detail::create_emplace_args( \
|
boost::unordered::detail::create_emplace_args( \
|
||||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||||
a) \
|
a) \
|
||||||
)).first); \
|
)).first; \
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT,
|
BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||||
BOOST_UNORDERED_EMPLACE, _)
|
BOOST_UNORDERED_EMPLACE, _)
|
||||||
|
|
||||||
#undef BOOST_UNORDERED_EMPLACE
|
#undef BOOST_UNORDERED_EMPLACE
|
||||||
@ -609,6 +667,64 @@ namespace unordered
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
template <typename A0>
|
||||||
|
iterator emplace(BOOST_FWD_REF(A0) a0)
|
||||||
|
{
|
||||||
|
return iterator(table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename A0>
|
||||||
|
iterator emplace_hint(const_iterator, BOOST_FWD_REF(A0) a0)
|
||||||
|
{
|
||||||
|
return iterator(table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename A0, typename A1>
|
||||||
|
iterator emplace(
|
||||||
|
BOOST_FWD_REF(A0) a0,
|
||||||
|
BOOST_FWD_REF(A1) a1)
|
||||||
|
{
|
||||||
|
return iterator(table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0, a1)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename A0, typename A1>
|
||||||
|
iterator emplace_hint(const_iterator,
|
||||||
|
BOOST_FWD_REF(A0) a0,
|
||||||
|
BOOST_FWD_REF(A1) a1)
|
||||||
|
{
|
||||||
|
return iterator(table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0, 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 iterator(table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0, a1, a2)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename A0, typename A1, typename A2>
|
||||||
|
iterator emplace_hint(const_iterator,
|
||||||
|
BOOST_FWD_REF(A0) a0,
|
||||||
|
BOOST_FWD_REF(A1) a1,
|
||||||
|
BOOST_FWD_REF(A2) a2)
|
||||||
|
{
|
||||||
|
return iterator(table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0, a1, a2)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
#define BOOST_UNORDERED_EMPLACE(z, n, _) \
|
#define BOOST_UNORDERED_EMPLACE(z, n, _) \
|
||||||
template < \
|
template < \
|
||||||
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
|
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
|
||||||
@ -639,7 +755,7 @@ namespace unordered
|
|||||||
))); \
|
))); \
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT,
|
BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||||
BOOST_UNORDERED_EMPLACE, _)
|
BOOST_UNORDERED_EMPLACE, _)
|
||||||
|
|
||||||
#undef BOOST_UNORDERED_EMPLACE
|
#undef BOOST_UNORDERED_EMPLACE
|
||||||
|
@ -220,6 +220,64 @@ namespace unordered
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
template <typename A0>
|
||||||
|
std::pair<iterator, bool> emplace(BOOST_FWD_REF(A0) a0)
|
||||||
|
{
|
||||||
|
return table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename A0>
|
||||||
|
iterator emplace_hint(const_iterator, BOOST_FWD_REF(A0) a0)
|
||||||
|
{
|
||||||
|
return table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0)
|
||||||
|
).first;
|
||||||
|
}
|
||||||
|
|
||||||
|
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(a0, a1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename A0, typename A1>
|
||||||
|
iterator emplace_hint(const_iterator,
|
||||||
|
BOOST_FWD_REF(A0) a0,
|
||||||
|
BOOST_FWD_REF(A1) a1)
|
||||||
|
{
|
||||||
|
return table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0, a1)
|
||||||
|
).first;
|
||||||
|
}
|
||||||
|
|
||||||
|
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(a0, a1, a2)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename A0, typename A1, typename A2>
|
||||||
|
iterator emplace_hint(const_iterator,
|
||||||
|
BOOST_FWD_REF(A0) a0,
|
||||||
|
BOOST_FWD_REF(A1) a1,
|
||||||
|
BOOST_FWD_REF(A2) a2)
|
||||||
|
{
|
||||||
|
return table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0, a1, a2)
|
||||||
|
).first;
|
||||||
|
}
|
||||||
|
|
||||||
#define BOOST_UNORDERED_EMPLACE(z, n, _) \
|
#define BOOST_UNORDERED_EMPLACE(z, n, _) \
|
||||||
template < \
|
template < \
|
||||||
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
|
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
|
||||||
@ -243,14 +301,14 @@ namespace unordered
|
|||||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
|
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
|
||||||
) \
|
) \
|
||||||
{ \
|
{ \
|
||||||
return iterator(table_.emplace( \
|
return table_.emplace( \
|
||||||
boost::unordered::detail::create_emplace_args( \
|
boost::unordered::detail::create_emplace_args( \
|
||||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||||
a) \
|
a) \
|
||||||
)).first); \
|
)).first; \
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT,
|
BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||||
BOOST_UNORDERED_EMPLACE, _)
|
BOOST_UNORDERED_EMPLACE, _)
|
||||||
|
|
||||||
#undef BOOST_UNORDERED_EMPLACE
|
#undef BOOST_UNORDERED_EMPLACE
|
||||||
@ -592,6 +650,64 @@ namespace unordered
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
template <typename A0>
|
||||||
|
iterator emplace(BOOST_FWD_REF(A0) a0)
|
||||||
|
{
|
||||||
|
return iterator(table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename A0>
|
||||||
|
iterator emplace_hint(const_iterator, BOOST_FWD_REF(A0) a0)
|
||||||
|
{
|
||||||
|
return iterator(table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename A0, typename A1>
|
||||||
|
iterator emplace(
|
||||||
|
BOOST_FWD_REF(A0) a0,
|
||||||
|
BOOST_FWD_REF(A1) a1)
|
||||||
|
{
|
||||||
|
return iterator(table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0, a1)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename A0, typename A1>
|
||||||
|
iterator emplace_hint(const_iterator,
|
||||||
|
BOOST_FWD_REF(A0) a0,
|
||||||
|
BOOST_FWD_REF(A1) a1)
|
||||||
|
{
|
||||||
|
return iterator(table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0, 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 iterator(table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0, a1, a2)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename A0, typename A1, typename A2>
|
||||||
|
iterator emplace_hint(const_iterator,
|
||||||
|
BOOST_FWD_REF(A0) a0,
|
||||||
|
BOOST_FWD_REF(A1) a1,
|
||||||
|
BOOST_FWD_REF(A2) a2)
|
||||||
|
{
|
||||||
|
return iterator(table_.emplace(
|
||||||
|
boost::unordered::detail::create_emplace_args(a0, a1, a2)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
#define BOOST_UNORDERED_EMPLACE(z, n, _) \
|
#define BOOST_UNORDERED_EMPLACE(z, n, _) \
|
||||||
template < \
|
template < \
|
||||||
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
|
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
|
||||||
@ -622,7 +738,7 @@ namespace unordered
|
|||||||
))); \
|
))); \
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT,
|
BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||||
BOOST_UNORDERED_EMPLACE, _)
|
BOOST_UNORDERED_EMPLACE, _)
|
||||||
|
|
||||||
#undef BOOST_UNORDERED_EMPLACE
|
#undef BOOST_UNORDERED_EMPLACE
|
||||||
|
Reference in New Issue
Block a user