diff --git a/include/boost/unordered/detail/emplace_args.hpp b/include/boost/unordered/detail/emplace_args.hpp index 9c1dfd3e..bdbef109 100644 --- a/include/boost/unordered/detail/emplace_args.hpp +++ b/include/boost/unordered/detail/emplace_args.hpp @@ -175,6 +175,8 @@ BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, BOOST_UNORDERED_EARGS, // // Used for piecewise construction. +#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) + #define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(n, namespace_) \ template \ void construct_from_tuple(T* ptr, namespace_::tuple<>) \ @@ -210,6 +212,49 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std::tr1) #undef BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL #undef BOOST_UNORDERED_GET_TUPLE_ARG +#else + + template struct length {}; + + template + void construct_from_tuple_impl( + boost::unordered::detail::length<0>, T* ptr, + boost::tuple<>) + { + new ((void*) ptr) T(); + } + +#define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL(z, n, _) \ + template \ + void construct_from_tuple_impl( \ + boost::unordered::detail::length, T* ptr, \ + namespace_::tuple const& x) \ + { \ + new ((void*) ptr) T( \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_GET_TUPLE_ARG, namespace_) \ + ); \ + } + +#define BOOST_UNORDERED_GET_TUPLE_ARG(z, n, _) \ + boost::get(x) + + BOOST_PP_REPEAT_FROM_TO(1, 10, \ + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL, _) + + template + void construct_from_tuple(T* ptr, Tuple const& x) + { + construct_from_tuple_impl( + boost::unordered::detail::length< + boost::tuples::length::value>(), + ptr, x); + } + +#undef BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL +#undef BOOST_UNORDERED_GET_TUPLE_ARG + +#endif + //////////////////////////////////////////////////////////////////////////// // SFINAE traits for construction.