Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75341 - trunk/boost/unordered/detail
From: dnljms_at_[hidden]
Date: 2011-11-06 04:34:55


Author: danieljames
Date: 2011-11-06 04:34:54 EST (Sun, 06 Nov 2011)
New Revision: 75341
URL: http://svn.boost.org/trac/boost/changeset/75341

Log:
Unordered: construct_from_tuple for old versions of sun.

Not properly tested, as I haven't got the compiler fully working on my
machine.
Text files modified:
   trunk/boost/unordered/detail/emplace_args.hpp | 45 ++++++++++++++++++++++++++++++++++++++++
   1 files changed, 45 insertions(+), 0 deletions(-)

Modified: trunk/boost/unordered/detail/emplace_args.hpp
==============================================================================
--- trunk/boost/unordered/detail/emplace_args.hpp (original)
+++ trunk/boost/unordered/detail/emplace_args.hpp 2011-11-06 04:34:54 EST (Sun, 06 Nov 2011)
@@ -175,6 +175,8 @@
     //
     // Used for piecewise construction.
 
+#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590)
+
 #define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(n, namespace_) \
     template<typename T> \
     void construct_from_tuple(T* ptr, namespace_::tuple<>) \
@@ -210,6 +212,49 @@
 #undef BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL
 #undef BOOST_UNORDERED_GET_TUPLE_ARG
 
+#else
+
+ template <int N> struct length {};
+
+ template<typename T>
+ 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<typename T, BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
+ void construct_from_tuple_impl( \
+ boost::unordered::detail::length<n>, T* ptr, \
+ namespace_::tuple<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> 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<n>(x)
+
+ BOOST_PP_REPEAT_FROM_TO(1, 10, \
+ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL, _)
+
+ template <typename T, typename Tuple>
+ void construct_from_tuple(T* ptr, Tuple const& x)
+ {
+ construct_from_tuple_impl(
+ boost::unordered::detail::length<
+ boost::tuples::length<Tuple>::value>(),
+ ptr, x);
+ }
+
+#undef BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL
+#undef BOOST_UNORDERED_GET_TUPLE_ARG
+
+#endif
+
     ////////////////////////////////////////////////////////////////////////////
     // SFINAE traits for construction.
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk