Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64467 - sandbox/variadic_templates/boost/mpl
From: cppljevans_at_[hidden]
Date: 2010-07-30 11:06:21


Author: cppljevans
Date: 2010-07-30 11:06:20 EDT (Fri, 30 Jul 2010)
New Revision: 64467
URL: http://svn.boost.org/trac/boost/changeset/64467

Log:
repeat.hpp and templates to help it
Added:
   sandbox/variadic_templates/boost/mpl/at_c_always.hpp (contents, props changed)
   sandbox/variadic_templates/boost/mpl/at_c_indices.hpp (contents, props changed)
   sandbox/variadic_templates/boost/mpl/repeat.hpp (contents, props changed)

Added: sandbox/variadic_templates/boost/mpl/at_c_always.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/boost/mpl/at_c_always.hpp 2010-07-30 11:06:20 EDT (Fri, 30 Jul 2010)
@@ -0,0 +1,20 @@
+#ifndef BOOST_MPL_AT_C_ALWAYS_HPP_INCLUDED
+#define BOOST_MPL_AT_C_ALWAYS_HPP_INCLUDED
+namespace boost { namespace mpl {
+
+template<typename Type>
+struct at_c_always
+{
+ template
+ < typename Index
+ , Index I
+ >
+ struct at_c
+ {
+ typedef Type type;
+ };
+};
+
+}}
+
+#endif // BOOST_MPL_AT_C_ALWAYS_HPP_INCLUDED

Added: sandbox/variadic_templates/boost/mpl/at_c_indices.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/boost/mpl/at_c_indices.hpp 2010-07-30 11:06:20 EDT (Fri, 30 Jul 2010)
@@ -0,0 +1,33 @@
+#ifndef BOOST_MPL_AT_C_INDICES_HPP_INCLUDED
+#define BOOST_MPL_AT_C_INDICES_HPP_INCLUDED
+#include <boost/mpl/package_c.hpp>
+namespace boost
+{
+ namespace mpl
+ {
+ template
+ < template<typename IndexOp, IndexOp I>class Op
+ , typename Indices=package_c<unsigned>
+ , template<typename...>class Seq=package
+ >
+ struct at_c_indices
+ ;
+ template
+ < typename Index
+ , Index... Indices
+ , template<typename IndexOp, IndexOp I>class Op
+ , template<typename...>class Seq
+ >
+ struct at_c_indices
+ < Op
+ , package_c<Index, Indices...>
+ , Seq
+ >
+ {
+ typedef Seq<typename Op<Index,Indices>::type...> type;
+ };
+
+ }//exit mpl namespace
+}//exit boost namespace
+
+#endif

Added: sandbox/variadic_templates/boost/mpl/repeat.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/boost/mpl/repeat.hpp 2010-07-30 11:06:20 EDT (Fri, 30 Jul 2010)
@@ -0,0 +1,25 @@
+//package with repeated elements.
+#ifndef BOOST_MPL_PACKAGE_REPEAT_HPP_INCLUDED
+#define BOOST_MPL_PACKAGE_REPEAT_HPP_INCLUDED
+#include <boost/mpl/at_c_always.hpp>
+#include <boost/mpl/at_c_indices.hpp>
+#include <boost/mpl/package_range_c.hpp>
+namespace boost { namespace mpl {
+ template
+ < typename Element
+ , unsigned Size=0
+ >
+struct repeat
+{
+ typedef
+ typename
+ at_c_indices
+ < at_c_always<Element>::template at_c
+ , typename package_range_c<unsigned,0,Size>::type
+ >::type
+ type
+ ;
+};
+
+}}
+#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