Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66508 - sandbox/statistics/support/boost/mpl/detail
From: erwann.rogard_at_[hidden]
Date: 2010-11-11 21:42:18


Author: e_r
Date: 2010-11-11 21:42:15 EST (Thu, 11 Nov 2010)
New Revision: 66508
URL: http://svn.boost.org/trac/boost/changeset/66508

Log:
two small mpl-like features
Added:
   sandbox/statistics/support/boost/mpl/detail/variadic_sequence.hpp (contents, props changed)
   sandbox/statistics/support/boost/mpl/detail/variadic_vector.hpp (contents, props changed)

Added: sandbox/statistics/support/boost/mpl/detail/variadic_sequence.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/mpl/detail/variadic_sequence.hpp 2010-11-11 21:42:15 EST (Thu, 11 Nov 2010)
@@ -0,0 +1,65 @@
+////////////////////////////////////////////////////////////////////////////
+// variadic_sequence.hpp //
+// //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are subject to the //
+// Boost Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_MPL_DETAIL_VARIADIC_SEQUENCE_HPP_ER_2010
+#define BOOST_MPL_DETAIL_VARIADIC_SEQUENCE_HPP_ER_2010
+#include <boost/preprocessor/repetition/enum.hpp>
+
+namespace boost{
+namespace mpl{
+namespace detail{
+namespace variadic_sequence_aux{
+
+// Source : http://stackoverflow.com/questions/2709315/is-boost-tuple-compatible-with-c0x-variadic-templates
+
+template <std::size_t, typename, typename...> struct nth_arg;
+
+template <std::size_t N, typename Void, typename T, typename... Args>
+struct nth_arg<N, Void, T, Args...>
+{
+ typedef typename nth_arg<N - 1, Void, Args...>::type type;
+};
+
+template <typename Void, typename T, typename... Args>
+struct nth_arg<0, Void, T, Args...>
+{
+ typedef T type;
+};
+
+template <std::size_t N, typename Void>
+struct nth_arg<N, Void>
+{
+ typedef Void type;
+};
+
+}// variadic_sequence_aux
+}// detail
+}// mpl
+}// boost
+
+#define BOOST_MPL_DETAIL_VARIADIC_SEQUENCE_arg(z, n, data) \
+ typename boost::mpl::detail::variadic_sequence_aux::nth_arg< \
+ n, data, Args...\
+ >::type \
+/**/
+
+#define BOOST_MPL_DETAIL_VARIADIC_SEQUENCE(N, FROM, TO, default_type) \
+template <typename ...Args> \
+struct TO \
+{ \
+ typedef FROM< \
+ BOOST_PP_ENUM( \
+ N, \
+ BOOST_MPL_DETAIL_VARIADIC_SEQUENCE_arg, \
+ default_type \
+ ) \
+ > type; \
+}; \
+/**/
+
+#endif

Added: sandbox/statistics/support/boost/mpl/detail/variadic_vector.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/mpl/detail/variadic_vector.hpp 2010-11-11 21:42:15 EST (Thu, 11 Nov 2010)
@@ -0,0 +1,30 @@
+////////////////////////////////////////////////////////////////////////////
+// variadic_sequence.hpp //
+// //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are subject to the //
+// Boost Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_MPL_DETAIL_VARIADIC_VECTOR_HPP_ER_2010
+#define BOOST_MPL_DETAIL_VARIADIC_VECTOR_HPP_ER_2010
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/aux_/na.hpp>
+#include <boost/mpl/detail/variadic_sequence.hpp>
+
+namespace boost{
+namespace mpl{
+namespace detail{
+
+BOOST_MPL_DETAIL_VARIADIC_SEQUENCE(
+ BOOST_MPL_LIMIT_VECTOR_SIZE,
+ ::boost::mpl::vector,
+ variadic_vector,
+ ::boost::mpl::na
+)
+
+}// detail
+}// mpl
+}// boost
+
+#endif


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