summaryrefslogtreecommitdiff
path: root/boost/parameter
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2013-08-26 08:15:55 -0400
committerAnas Nashif <anas.nashif@intel.com>2013-08-26 08:15:55 -0400
commitbb4dd8289b351fae6b55e303f189127a394a1edd (patch)
tree77c9c35a31b1459dd7988c2448e797d142530c41 /boost/parameter
parent1a78a62555be32868418fe52f8e330c9d0f95d5a (diff)
downloadboost-bb4dd8289b351fae6b55e303f189127a394a1edd.tar.gz
boost-bb4dd8289b351fae6b55e303f189127a394a1edd.tar.bz2
boost-bb4dd8289b351fae6b55e303f189127a394a1edd.zip
Imported Upstream version 1.51.0upstream/1.51.0
Diffstat (limited to 'boost/parameter')
-rw-r--r--boost/parameter/aux_/cast.hpp44
-rw-r--r--boost/parameter/preprocessor.hpp3
2 files changed, 31 insertions, 16 deletions
diff --git a/boost/parameter/aux_/cast.hpp b/boost/parameter/aux_/cast.hpp
index c9d290d9c4..b94c764e03 100644
--- a/boost/parameter/aux_/cast.hpp
+++ b/boost/parameter/aux_/cast.hpp
@@ -40,11 +40,11 @@ struct use_default_tag {};
// 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 @@ struct cast<void*>
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 @@ struct cast<void(T)>
return use_default_tag();
}
- static T execute(T value)
+ static type0 execute(type0 value)
{
return value;
}
@@ -118,9 +130,9 @@ struct cast<void(T)>
}
};
-# 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
diff --git a/boost/parameter/preprocessor.hpp b/boost/parameter/preprocessor.hpp
index 3c39619455..f1bda87cdd 100644
--- a/boost/parameter/preprocessor.hpp
+++ b/boost/parameter/preprocessor.hpp
@@ -701,6 +701,7 @@ struct funptr_predicate<void**>
) \
] \
, BOOST_PARAMETER_FN_ARG_PRED(arg) \
+ , Args \
)
# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_BODY(name, n, split_args, tag_namespace) \
@@ -728,6 +729,7 @@ struct funptr_predicate<void**>
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 @@ struct funptr_predicate<void**>
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