Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78851 - in branches/release/boost: . parameter parameter/aux_
From: lorcaminiti_at_[hidden]
Date: 2012-06-07 14:21:26


Author: lcaminiti
Date: 2012-06-07 14:21:25 EDT (Thu, 07 Jun 2012)
New Revision: 78851
URL: http://svn.boost.org/trac/boost/changeset/78851

Log:
Merged Boost.Parameter fixes from trunk to support accessing named paramter types tag::x::_.
Properties modified:
   branches/release/boost/parameter/ (props changed)
   branches/release/boost/parameter.hpp (props changed)
Text files modified:
   branches/release/boost/parameter/aux_/cast.hpp | 44 +++++++++++++++++++++++++--------------
   branches/release/boost/parameter/preprocessor.hpp | 3 ++
   2 files changed, 31 insertions(+), 16 deletions(-)

Modified: branches/release/boost/parameter/aux_/cast.hpp
==============================================================================
--- branches/release/boost/parameter/aux_/cast.hpp (original)
+++ branches/release/boost/parameter/aux_/cast.hpp 2012-06-07 14:21:25 EDT (Thu, 07 Jun 2012)
@@ -40,11 +40,11 @@
 // X(something, *(predicate))
 // X(something, (int))
 
-template <class T>
+template <class T, class Args>
 struct cast;
 
-template <>
-struct cast<void*>
+template <class Args>
+struct cast<void*, Args>
 {
     static use_default_tag execute(use_default_tag)
     {
@@ -73,27 +73,39 @@
 
 typedef void* voidstar;
 
-template <class T>
-struct cast<voidstar(T)>
- : cast<void*>
+template <class T, class Args>
+struct cast<voidstar(T), Args>
+ : cast<void*, Args>
 {
 };
 
 #else
 
-template <class T>
-struct cast<void*(T)>
- : cast<void*>
+template <class T, class Args>
+struct cast<void*(T), Args>
+ : cast<void*, Args>
 {
 };
 
 #endif
 
-template <class T>
-struct cast<void(T)>
+// This is a hack used in cast<> to turn the user supplied type,
+// which may or may not be a placeholder expression into one, so
+// that it will be properly evaluated by mpl::apply.
+template <class T, class Dummy = mpl::_1>
+struct as_placeholder_expr
 {
+ typedef T type;
+};
+
+template <class T, class Args>
+struct cast<void(T), Args>
+{
+ typedef typename mpl::apply2<
+ as_placeholder_expr<T>, Args, Args>::type type0;
+
     typedef typename boost::add_reference<
- typename boost::remove_const<T>::type
+ typename boost::remove_const<type0>::type
>::type reference;
 
     static use_default_tag execute(use_default_tag)
@@ -106,7 +118,7 @@
         return use_default_tag();
     }
 
- static T execute(T value)
+ static type0 execute(type0 value)
     {
         return value;
     }
@@ -118,9 +130,9 @@
     }
 };
 
-# define BOOST_PARAMETER_FUNCTION_CAST(value, predicate) \
- boost::parameter::aux::cast<void predicate>::remove_const( \
- boost::parameter::aux::cast<void predicate>::execute(value) \
+# define BOOST_PARAMETER_FUNCTION_CAST(value, predicate, args) \
+ boost::parameter::aux::cast<void predicate, args>::remove_const( \
+ boost::parameter::aux::cast<void predicate, args>::execute(value) \
     )
 
 # endif

Modified: branches/release/boost/parameter/preprocessor.hpp
==============================================================================
--- branches/release/boost/parameter/preprocessor.hpp (original)
+++ branches/release/boost/parameter/preprocessor.hpp 2012-06-07 14:21:25 EDT (Thu, 07 Jun 2012)
@@ -701,6 +701,7 @@
             ) \
         ] \
       , BOOST_PARAMETER_FN_ARG_PRED(arg) \
+ , Args \
     )
 
 # define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_BODY(name, n, split_args, tag_namespace) \
@@ -728,6 +729,7 @@
     BOOST_PARAMETER_FUNCTION_CAST( \
         boost::parameter::aux::as_lvalue(BOOST_PARAMETER_FN_ARG_DEFAULT(arg), 0L) \
       , BOOST_PARAMETER_FN_ARG_PRED(arg) \
+ , Args \
     )
 
 # define BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_DEFAULT_BODY(name, n, split_args, tag_ns, const_) \
@@ -843,6 +845,7 @@
               boost::parameter::keyword<tag_ns::BOOST_PARAMETER_FN_ARG_KEYWORD(arg)>::instance \
           ] \
         , BOOST_PARAMETER_FN_ARG_PRED(arg) \
+ , Args \
       )
 
 // Generates the function template that recives a ArgumentPack, and then


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