Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64560 - in sandbox/variadic_templates/sandbox/boost/mpl: . aux_
From: cppljevans_at_[hidden]
Date: 2010-08-03 06:59:53


Author: cppljevans
Date: 2010-08-03 06:59:50 EDT (Tue, 03 Aug 2010)
New Revision: 64560
URL: http://svn.boost.org/trac/boost/changeset/64560

Log:
passes slightly revised lambda.cpp test
Added:
   sandbox/variadic_templates/sandbox/boost/mpl/aux_/
   sandbox/variadic_templates/sandbox/boost/mpl/aux_/template_arityv.hpp (contents, props changed)
   sandbox/variadic_templates/sandbox/boost/mpl/bindv.hpp (contents, props changed)
   sandbox/variadic_templates/sandbox/boost/mpl/lambdav.hpp (contents, props changed)
   sandbox/variadic_templates/sandbox/boost/mpl/quotev.hpp (contents, props changed)
   sandbox/variadic_templates/sandbox/boost/mpl/transform_pack.hpp (contents, props changed)
Text files modified:
   sandbox/variadic_templates/sandbox/boost/mpl/and.hpp | 4 +++-
   sandbox/variadic_templates/sandbox/boost/mpl/or.hpp | 21 +--------------------
   2 files changed, 4 insertions(+), 21 deletions(-)

Modified: sandbox/variadic_templates/sandbox/boost/mpl/and.hpp
==============================================================================
--- sandbox/variadic_templates/sandbox/boost/mpl/and.hpp (original)
+++ sandbox/variadic_templates/sandbox/boost/mpl/and.hpp 2010-08-03 06:59:50 EDT (Tue, 03 Aug 2010)
@@ -3,6 +3,7 @@
 
 #include <boost/mpl/fold_null_unit.hpp>
 #include <boost/mpl/converter_bool.hpp>
+#include <boost/mpl/aux_/template_arityv.hpp>
 
 namespace boost
 {
@@ -19,7 +20,8 @@
       , converter_bool
       , T...
>
- {};
+ {
+ };
 
 }//exit mpl namespace
 }//exit boost namespace

Added: sandbox/variadic_templates/sandbox/boost/mpl/aux_/template_arityv.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/sandbox/boost/mpl/aux_/template_arityv.hpp 2010-08-03 06:59:50 EDT (Tue, 03 Aug 2010)
@@ -0,0 +1,20 @@
+
+#ifndef BOOST_MPL_AUX_TEMPLATE_ARITYV_HPP_INCLUDED
+#define BOOST_MPL_AUX_TEMPLATE_ARITYV_HPP_INCLUDED
+
+namespace boost { namespace mpl { namespace aux {
+
+template
+< template<typename...>class F
+, typename... T
+>
+struct template_arity
+< F<T...>
+>
+: int_ <sizeof...(T)>
+{
+};
+
+}}}
+
+#endif // BOOST_MPL_AUX_TEMPLATE_ARITYV_HPP_INCLUDED

Added: sandbox/variadic_templates/sandbox/boost/mpl/bindv.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/sandbox/boost/mpl/bindv.hpp 2010-08-03 06:59:50 EDT (Tue, 03 Aug 2010)
@@ -0,0 +1,195 @@
+//variadic version of bind.hpp
+#ifndef BOOST_MPL_BINDV_HPP_INCLUDED
+#define BOOST_MPL_BINDV_HPP_INCLUDED
+#include <boost/mpl/bind.hpp>
+#include <boost/mpl/package.hpp>
+#include <boost/mpl/fold_assoc_pack.hpp>
+#include <boost/mpl/apply_pack.hpp>
+#include <boost/mpl/join_pack.hpp>
+#include <boost/mpl/repeat.hpp>
+#include <boost/mpl/at.hpp>
+
+namespace boost
+{
+ namespace mpl
+ {
+ template
+ < typename F
+ , typename... T
+ >
+ struct bindv
+ ;
+
+ namespace aux
+ {
+ template
+ < typename T
+ , typename U
+ >
+ struct resolve_bind_argn
+ ;
+ template
+ < typename T
+ , typename... U
+ >
+ struct resolve_bind_argn
+ < T
+ , package<U...>
+ >
+ : resolve_bind_arg
+ < T
+ #define RESOLVE_BIND_ARG_AT_C_US(z,n,data) , typename at_c<package<U...>,n>::type
+ BOOST_PP_REPEAT(BOOST_MPL_LIMIT_METAFUNCTION_ARITY,RESOLVE_BIND_ARG_AT_C_US,~)
+ #undef RESOLVE_BIND_ARG_AT_C_US
+ >
+ {};
+
+ template
+ < typename T
+ , typename... U
+ >
+ struct resolve_bind_argv
+ : resolve_bind_argn
+ < T
+ , typename join_pack
+ < package<U...>
+ , typename repeat
+ < na
+ , BOOST_MPL_LIMIT_METAFUNCTION_ARITY - sizeof...(U)
+ >::type
+ >::type
+ >
+ {
+ };
+ template
+ < int N
+ , typename... U
+ >
+ struct resolve_bind_argv
+ < arg < N >
+ , U...
+ >
+ {
+ typedef
+ typename apply_wrap
+ < mpl::arg < N >
+ , U...
+ >::type
+ type;
+ };
+
+ template
+ < typename F
+ , typename... T
+ , typename... U
+ >
+ struct resolve_bind_argv
+ < bindv< F, T... >
+ , U...
+ >
+ {
+ typedef bindv< F, T...> f_;
+ typedef typename apply_wrap < f_, U...>::type type;
+ };
+
+ template
+ < typename... U
+ >
+ struct resolve_bind
+ {
+ template
+ < typename NTs
+ , typename A
+ >
+ struct op
+ ;
+ template
+ < typename N
+ , typename... T
+ , typename A
+ >
+ struct op
+ < package<N,T...>
+ , A
+ >
+ {
+ typedef aux::replace_unnamed_arg < A, N> r;
+ typedef typename r::type a;
+ typedef typename r::next n;
+ typedef
+ typename resolve_bind_argv
+ < a
+ , U...
+ >::type
+ t;
+
+ typedef package<n,T...,t> type;
+ };
+ };
+ }
+
+ template
+ < typename F
+ , typename... T
+ >
+ struct bindv
+ {
+ template
+ < typename... U
+ >
+ struct apply
+ {
+ #if 0
+ private:
+ #endif
+ typedef
+ aux::resolve_bind<U...>
+ resolve_bind_us
+ ;
+ typedef
+ typename fold_assoc_pack
+ < assoc_left
+ , resolve_bind_us::template op
+ , package<mpl::arg<1> >
+ , F,T...
+ >::type
+ resolveds
+ ;
+ typedef
+ typename pop_front<resolveds>::type
+ fts
+ ;
+ typedef
+ typename front<fts>::type
+ f_
+ ;
+ typedef
+ typename pop_front<fts>::type
+ ts
+ ;
+ template
+ < typename... V
+ >
+ struct apply_wrap_f
+ : apply_wrap
+ < f_
+ , typename V::type...
+ >
+ {};
+ public:
+ typedef
+ typename
+ apply_pack
+ < ts
+ , apply_wrap_f
+ >
+ ::type
+ type;
+ };
+
+ };
+
+ }//exit mpl namespace
+}//exit boost namespace
+
+#endif

Added: sandbox/variadic_templates/sandbox/boost/mpl/lambdav.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/sandbox/boost/mpl/lambdav.hpp 2010-08-03 06:59:50 EDT (Tue, 03 Aug 2010)
@@ -0,0 +1,95 @@
+//variadic version of lambda.hpp
+#ifndef BOOST_MPL_LAMBDAV_HPP_INCLUDED
+#define BOOST_MPL_LAMBDAV_HPP_INCLUDED
+#include <boost/mpl/lambda.hpp>
+#include <boost/mpl/transform_pack.hpp>
+#include <boost/mpl/apply_pack.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/mpl/quotev.hpp>
+#include <boost/mpl/bindv.hpp>
+
+namespace boost
+{
+ namespace mpl
+ {
+ namespace aux
+ {
+ template
+ < typename LeMaybe
+ >
+ struct is_le
+ {
+ typedef typename LeMaybe::is_le type;
+ };
+
+ template
+ < typename IsLE
+ , typename Tag
+ , template < typename... P> class F
+ >
+ struct le_resultv
+ {
+ template
+ < typename... L
+ >
+ struct _
+ {
+ typedef F < typename L::type...> result_;
+
+ typedef result_ type;
+ };
+ };
+
+ template
+ < typename Tag
+ , template < typename... P> class F
+ >
+ struct le_resultv
+ < true_
+ , Tag
+ , F
+ >
+ {
+ template
+ < typename... L
+ >
+ struct _
+ {
+ typedef bindv < quotev< F, Tag >, typename L::result_...> result_;
+
+ typedef mpl::protect < result_ > type;
+ };
+ };
+ }
+
+ template
+ < template < typename... P > class F
+ , typename... T
+ , typename Tag
+ >
+ struct lambda
+ < F< T... >
+ , Tag
+ , int_<sizeof...(T)>
+ >
+ {
+ typedef package<lambda < T, Tag >...> ls;
+ typedef typename transform_pack<ls, aux::is_le<arg<1> > >::type is_les;
+
+ typedef typename apply_pack<is_les, or_>::type is_le;
+
+ typedef
+ apply_pack
+ < ls
+ , aux::le_resultv < is_le, Tag, F>::template _
+ >
+ le_result_;
+
+ typedef typename le_result_::result_ result_;
+ typedef typename le_result_::type type;
+ };
+
+ }//exit mpl namespace
+}//exit boost namespace
+
+#endif

Modified: sandbox/variadic_templates/sandbox/boost/mpl/or.hpp
==============================================================================
--- sandbox/variadic_templates/sandbox/boost/mpl/or.hpp (original)
+++ sandbox/variadic_templates/sandbox/boost/mpl/or.hpp 2010-08-03 06:59:50 EDT (Tue, 03 Aug 2010)
@@ -3,8 +3,7 @@
 
 #include <boost/mpl/fold_null_unit.hpp>
 #include <boost/mpl/converter_bool.hpp>
-#include <boost/mpl/int.hpp>
-#include <boost/mpl/aux_/template_arity_fwd.hpp>
+#include <boost/mpl/aux_/template_arityv.hpp>
 
 namespace boost
 {
@@ -22,26 +21,8 @@
       , T...
>
     {
- using
- fold_null_unit
- < true_
- , false_
- , converter_bool
- , T...
- >::
- apply
- ;
     };
 
- namespace aux
- {
- template < typename... T>
- struct template_arity <or_ < T...> >
- : int_ < sizeof...(T) >
- {
- };
-
- }
 }//exit mpl namespace
 }//exit boost namespace
 #endif

Added: sandbox/variadic_templates/sandbox/boost/mpl/quotev.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/sandbox/boost/mpl/quotev.hpp 2010-08-03 06:59:50 EDT (Tue, 03 Aug 2010)
@@ -0,0 +1,26 @@
+//variadic version of quote.hpp
+#ifndef BOOST_MPL_QUOTEV_HPP_INCLUDED
+#define BOOST_MPL_QUOTEV_HPP_INCLUDED
+#include <boost/mpl/void.hpp>
+#include <boost/mpl/quote.hpp>
+
+namespace boost
+{
+ namespace mpl
+ {
+ template
+ < template < typename... P> class F
+ , typename Tag = void_
+ >
+ struct quotev
+ {
+ template < typename... U > struct apply
+ : quote_impl < F < U... >, aux::has_type < F < U... > >::value >
+ {
+ };
+ };
+
+ }//exit mpl namespace
+}//exit boost namespace
+
+#endif

Added: sandbox/variadic_templates/sandbox/boost/mpl/transform_pack.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/sandbox/boost/mpl/transform_pack.hpp 2010-08-03 06:59:50 EDT (Tue, 03 Aug 2010)
@@ -0,0 +1,35 @@
+#ifndef BOOST_MPL_TRANSFORM_PACK_HPP_INCLUDED
+#define BOOST_MPL_TRANSFORM_PACK_HPP_INCLUDED
+#include <boost/mpl/package.hpp>
+#include <boost/mpl/arg.hpp>
+namespace boost
+{
+ namespace mpl
+ {
+ template
+ < typename Pack
+ , typename Op
+ >
+ struct transform_pack
+ ;
+ template
+ < typename... T
+ , template<typename Arg>class Op
+ >
+ struct transform_pack
+ < package<T...>
+ , Op<arg<1> >
+ >
+ {
+ typedef
+ package
+ < typename Op<T>::type...
+ >
+ type
+ ;
+ };
+
+ }//exit mpl namespace
+}//exit boost namespace
+
+#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