|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r48750 - in trunk/boost/proto: . detail transform
From: eric_at_[hidden]
Date: 2008-09-12 01:00:30
Author: eric_niebler
Date: 2008-09-12 01:00:28 EDT (Fri, 12 Sep 2008)
New Revision: 48750
URL: http://svn.boost.org/trac/boost/changeset/48750
Log:
works with decltype-based boost::result_of for C++0x compatibility
Text files modified:
trunk/boost/proto/detail/as_lvalue.hpp | 22 ------
trunk/boost/proto/detail/poly_function.hpp | 36 +++++++++++
trunk/boost/proto/extends.hpp | 121 +++++++++++++++++++++++++++++----------
trunk/boost/proto/make_expr.hpp | 84 +++++++++++---------------
trunk/boost/proto/proto_fwd.hpp | 93 ++++++++++++++---------------
trunk/boost/proto/transform/arg.hpp | 4
trunk/boost/proto/transform/call.hpp | 40 +++++++-----
7 files changed, 233 insertions(+), 167 deletions(-)
Modified: trunk/boost/proto/detail/as_lvalue.hpp
==============================================================================
--- trunk/boost/proto/detail/as_lvalue.hpp (original)
+++ trunk/boost/proto/detail/as_lvalue.hpp 2008-09-12 01:00:28 EDT (Fri, 12 Sep 2008)
@@ -17,32 +17,14 @@
{
namespace detail
{
- struct int_
- {
- int_() {}
- int_(int) {}
- };
-
template<typename T>
- T &as_lvalue(T &t, int = 0)
+ T &as_lvalue(T &t)
{
return t;
}
template<typename T>
- T const &as_lvalue(T const &t, int = 0)
- {
- return t;
- }
-
- template<typename Ret, typename T>
- Ret as_lvalue(T &t, int_ = int_() BOOST_PROTO_DISABLE_IF_IS_CONST(T))
- {
- return t;
- }
-
- template<typename Ret, typename T>
- Ret as_lvalue(T const &t, int_ = int_())
+ T const &as_lvalue(T const &t)
{
return t;
}
Modified: trunk/boost/proto/detail/poly_function.hpp
==============================================================================
--- trunk/boost/proto/detail/poly_function.hpp (original)
+++ trunk/boost/proto/detail/poly_function.hpp 2008-09-12 01:00:28 EDT (Fri, 12 Sep 2008)
@@ -25,6 +25,11 @@
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/proto/proto_fwd.hpp>
+ #ifdef _MSC_VER
+ # pragma warning(push)
+ # pragma warning(disable: 4181) // const applied to reference type
+ #endif
+
namespace boost { namespace proto { namespace detail
{
@@ -132,9 +137,14 @@
{};
////////////////////////////////////////////////////////////////////////////////////////////////
+ #define BOOST_PROTO_POLY_FUNCTION() \
+ typedef void is_poly_function_base_; \
+ /**/
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
struct poly_function_base
{
- typedef void is_poly_function_base_;
+ BOOST_PROTO_POLY_FUNCTION()
};
////////////////////////////////////////////////////////////////////////////////////////////////
@@ -163,6 +173,10 @@
};
////////////////////////////////////////////////////////////////////////////////////////////////
+ template<typename PolyFunSig, bool IsPoly>
+ struct as_mono_function_impl;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
template<typename PolyFunSig>
struct as_mono_function;
@@ -171,6 +185,10 @@
}}} // namespace boost::proto::detail
+ #ifdef _MSC_VER
+ # pragma warning(pop)
+ #endif
+
#endif
#elif 0 == BOOST_PP_ITERATION_FLAGS()
@@ -219,8 +237,22 @@
////////////////////////////////////////////////////////////////////////////////////////////////
template<typename PolyFun, BOOST_PP_ENUM_PARAMS(N, typename A)>
+ struct as_mono_function_impl<PolyFun(BOOST_PP_ENUM_PARAMS(N, A)), true>
+ {
+ typedef typename PolyFun::template impl<BOOST_PP_ENUM_PARAMS(N, const A)> type;
+ };
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ template<typename PolyFun, BOOST_PP_ENUM_PARAMS(N, typename A)>
+ struct as_mono_function_impl<PolyFun(BOOST_PP_ENUM_PARAMS(N, A)), false>
+ {
+ typedef PolyFun type;
+ };
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ template<typename PolyFun, BOOST_PP_ENUM_PARAMS(N, typename A)>
struct as_mono_function<PolyFun(BOOST_PP_ENUM_PARAMS(N, A))>
- : PolyFun::template impl<BOOST_PP_ENUM_PARAMS(N, A)>
+ : as_mono_function_impl<PolyFun(BOOST_PP_ENUM_PARAMS(N, A)), is_poly_function<PolyFun>::value>
{};
#undef N
Modified: trunk/boost/proto/extends.hpp
==============================================================================
--- trunk/boost/proto/extends.hpp (original)
+++ trunk/boost/proto/extends.hpp 2008-09-12 01:00:28 EDT (Fri, 12 Sep 2008)
@@ -94,12 +94,41 @@
/// INTERNAL ONLY
///
- #define BOOST_PROTO_DEFINE_FUN_OP_CONST(Z, N, DATA) \
+ #define BOOST_PROTO_DEFINE_FUN_OP_VARIADIC_IMPL_(Const) \
+ template<typename... A> \
+ typename boost::result_of< \
+ proto_domain( \
+ typename boost::proto::result_of::funop< \
+ proto_derived_expr BOOST_PROTO_CONST ## Const(A const &...) \
+ , proto_derived_expr \
+ , proto_domain \
+ >::type \
+ ) \
+ >::type const \
+ operator ()(A const &...a) BOOST_PROTO_CONST ## Const \
+ { \
+ typedef boost::proto::result_of::funop< \
+ proto_derived_expr BOOST_PROTO_CONST ## Const(A const &...) \
+ , proto_derived_expr \
+ , proto_domain \
+ > funop; \
+ return proto_domain()( \
+ funop::call( \
+ *static_cast<proto_derived_expr BOOST_PROTO_CONST ## Const *>(this) \
+ , a... \
+ ) \
+ ); \
+ } \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_DEFINE_FUN_OP_CONST(Z, N, DATA) \
BOOST_PROTO_DEFINE_FUN_OP_IMPL_(Z, N, DATA, 1)
/// INTERNAL ONLY
///
- #define BOOST_PROTO_DEFINE_FUN_OP_NON_CONST(Z, N, DATA) \
+ #define BOOST_PROTO_DEFINE_FUN_OP_NON_CONST(Z, N, DATA) \
BOOST_PROTO_DEFINE_FUN_OP_IMPL_(Z, N, DATA, 0)
/// INTERNAL ONLY
@@ -323,35 +352,53 @@
}; \
/**/
- #define BOOST_PROTO_EXTENDS_FUNCTION_CONST() \
- BOOST_PROTO_EXTENDS_FUNCTION_() \
- BOOST_PP_REPEAT_FROM_TO( \
- 0 \
- , BOOST_PROTO_MAX_FUNCTION_CALL_ARITY \
- , BOOST_PROTO_DEFINE_FUN_OP_CONST \
- , ~ \
- ) \
- /**/
-
- #define BOOST_PROTO_EXTENDS_FUNCTION_NON_CONST() \
- BOOST_PROTO_EXTENDS_FUNCTION_() \
- BOOST_PP_REPEAT_FROM_TO( \
- 0 \
- , BOOST_PROTO_MAX_FUNCTION_CALL_ARITY \
- , BOOST_PROTO_DEFINE_FUN_OP_NON_CONST \
- , ~ \
- ) \
- /**/
-
- #define BOOST_PROTO_EXTENDS_FUNCTION() \
- BOOST_PROTO_EXTENDS_FUNCTION_() \
- BOOST_PP_REPEAT_FROM_TO( \
- 0 \
- , BOOST_PROTO_MAX_FUNCTION_CALL_ARITY \
- , BOOST_PROTO_DEFINE_FUN_OP \
- , ~ \
- ) \
- /**/
+ #ifdef BOOST_HAS_VARIADIC_TMPL
+ #define BOOST_PROTO_EXTENDS_FUNCTION_CONST() \
+ BOOST_PROTO_EXTENDS_FUNCTION_() \
+ BOOST_PROTO_DEFINE_FUN_OP_VARIADIC_IMPL_(1) \
+ /**/
+
+ #define BOOST_PROTO_EXTENDS_FUNCTION_NON_CONST() \
+ BOOST_PROTO_EXTENDS_FUNCTION_() \
+ BOOST_PROTO_DEFINE_FUN_OP_VARIADIC_IMPL_(0) \
+ /**/
+
+ #define BOOST_PROTO_EXTENDS_FUNCTION() \
+ BOOST_PROTO_EXTENDS_FUNCTION_() \
+ BOOST_PROTO_DEFINE_FUN_OP_VARIADIC_IMPL_(0) \
+ BOOST_PROTO_DEFINE_FUN_OP_VARIADIC_IMPL_(1) \
+ /**/
+ #else
+ #define BOOST_PROTO_EXTENDS_FUNCTION_CONST() \
+ BOOST_PROTO_EXTENDS_FUNCTION_() \
+ BOOST_PP_REPEAT_FROM_TO( \
+ 0 \
+ , BOOST_PROTO_MAX_FUNCTION_CALL_ARITY \
+ , BOOST_PROTO_DEFINE_FUN_OP_CONST \
+ , ~ \
+ ) \
+ /**/
+
+ #define BOOST_PROTO_EXTENDS_FUNCTION_NON_CONST() \
+ BOOST_PROTO_EXTENDS_FUNCTION_() \
+ BOOST_PP_REPEAT_FROM_TO( \
+ 0 \
+ , BOOST_PROTO_MAX_FUNCTION_CALL_ARITY \
+ , BOOST_PROTO_DEFINE_FUN_OP_NON_CONST \
+ , ~ \
+ ) \
+ /**/
+
+ #define BOOST_PROTO_EXTENDS_FUNCTION() \
+ BOOST_PROTO_EXTENDS_FUNCTION_() \
+ BOOST_PP_REPEAT_FROM_TO( \
+ 0 \
+ , BOOST_PROTO_MAX_FUNCTION_CALL_ARITY \
+ , BOOST_PROTO_DEFINE_FUN_OP \
+ , ~ \
+ ) \
+ /**/
+ #endif
#define BOOST_PROTO_EXTENDS(Expr, Derived, Domain) \
BOOST_PROTO_BASIC_EXTENDS(Expr, Derived, Domain) \
@@ -421,6 +468,9 @@
// the operator() overloads, which is more efficient.
BOOST_PROTO_EXTENDS_FUNCTION_()
+ #ifdef BOOST_HAS_VARIADIC_TMPL
+ BOOST_PROTO_DEFINE_FUN_OP_VARIADIC_IMPL_(1)
+ #else
/// INTERNAL ONLY
///
#define BOOST_PP_LOCAL_MACRO(N) \
@@ -431,6 +481,8 @@
///
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY))
#include BOOST_PP_LOCAL_ITERATE()
+
+ #endif
};
/// \brief extends\<\> class template for adding behaviors to a Proto expression template
@@ -459,6 +511,11 @@
// the operator() overloads, which is more efficient.
BOOST_PROTO_EXTENDS_FUNCTION_()
+ #ifdef BOOST_HAS_VARIADIC_TMPL
+ BOOST_PROTO_DEFINE_FUN_OP_VARIADIC_IMPL_(0)
+ BOOST_PROTO_DEFINE_FUN_OP_VARIADIC_IMPL_(1)
+ #else
+
/// INTERNAL ONLY
///
#define BOOST_PP_LOCAL_MACRO(N) \
@@ -469,6 +526,8 @@
///
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY))
#include BOOST_PP_LOCAL_ITERATE()
+
+ #endif
};
/// INTERNAL ONLY
Modified: trunk/boost/proto/make_expr.hpp
==============================================================================
--- trunk/boost/proto/make_expr.hpp (original)
+++ trunk/boost/proto/make_expr.hpp 2008-09-12 01:00:28 EDT (Fri, 12 Sep 2008)
@@ -72,6 +72,7 @@
# include <boost/spirit/fusion/sequence/value_at.hpp>
# include <boost/spirit/fusion/sequence/size.hpp>
#endif
+ #include <boost/proto/detail/poly_function.hpp>
#include <boost/proto/detail/suffix.hpp>
#ifdef _MSC_VER
@@ -302,7 +303,7 @@
) \
) \
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(Z, N, A, const & BOOST_PP_INTERCEPT) \
- >::call( \
+ >()( \
BOOST_PP_SEQ_ENUM( \
BOOST_PP_SEQ_FOR_EACH_I( \
BOOST_PROTO_VARARG_AS_EXPR_, ~ \
@@ -486,9 +487,9 @@
struct make_expr_<tag::terminal, Domain, A
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, void BOOST_PP_INTERCEPT)>
{
- typedef typename proto::detail::protoify_<A, Domain>::type type;
+ typedef typename proto::detail::protoify_<A, Domain>::type result_type;
- static type const call(typename add_reference<A>::type a)
+ result_type operator()(typename add_reference<A>::type a) const
{
return proto::detail::protoify_<A, Domain>::call(a);
}
@@ -612,7 +613,7 @@
Tag
, deduce_domain
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, A)
- >::type
+ >::result_type
type;
};
@@ -660,7 +661,7 @@
Tag
, Domain
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, A)
- >::type
+ >::result_type
type;
};
@@ -736,6 +737,7 @@
struct make_expr
{
BOOST_PROTO_CALLABLE()
+ BOOST_PROTO_POLY_FUNCTION()
template<typename Sig>
struct result;
@@ -761,14 +763,14 @@
Tag
, Domain
, A0 const
- >::type const
+ >::type
operator ()(A0 const &a0) const
{
return proto::detail::make_expr_<
Tag
, Domain
, A0 const
- >::call(a0);
+ >()(a0);
}
// Additional overloads generated by the preprocessor ...
@@ -778,6 +780,23 @@
/**/
#include BOOST_PP_ITERATE()
+
+ /// INTERNAL ONLY
+ ///
+ template<
+ BOOST_PP_ENUM_BINARY_PARAMS(
+ BOOST_PROTO_MAX_ARITY
+ , typename A
+ , = void BOOST_PP_INTERCEPT
+ )
+ >
+ struct impl
+ : detail::make_expr_<
+ Tag
+ , Domain
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, A)
+ >
+ {};
};
/// \brief A callable function object equivalent to the
@@ -815,7 +834,7 @@
/// \param sequence A Fusion Random Access Sequence
/// \return <tt>proto::unpack_expr\<Tag, Domain\>(sequence)</tt>
template<typename Sequence>
- typename result_of::unpack_expr<Tag, Domain, Sequence const>::type const
+ typename result_of::unpack_expr<Tag, Domain, Sequence const>::type
operator ()(Sequence const &sequence) const
{
return proto::detail::unpack_expr_<
@@ -850,7 +869,7 @@
};
template<typename Sequence>
- typename proto::result_of::unpack_expr<Tag, Domain, Sequence const>::type const
+ typename proto::result_of::unpack_expr<Tag, Domain, Sequence const>::type
operator ()(Sequence const &sequence) const
{
return proto::detail::unpack_expr_<
@@ -873,30 +892,6 @@
} // namespace functional
- /// TODO document me
- template<typename Tag, typename Domain BOOST_PROTO_WHEN_BUILDING_DOCS(= deduce_domain)>
- struct _make_expr : callable
- {
- template<typename Sig>
- struct result
- : functional::make_expr<Tag, Domain>::template result<Sig>
- {};
-
- #define M0(Z, N, DATA) \
- template<BOOST_PP_ENUM_PARAMS_Z(Z, N, typename A)> \
- BOOST_PP_CAT(detail::implicit_expr_, N)<BOOST_PP_ENUM_PARAMS_Z(Z, N, A)> \
- operator ()(BOOST_PP_ENUM_BINARY_PARAMS_Z(Z, N, A, &a)) const \
- { \
- BOOST_PP_CAT(detail::implicit_expr_, N)<BOOST_PP_ENUM_PARAMS_Z(Z, N, A)> that = { \
- BOOST_PP_ENUM_PARAMS_Z(Z, N, a) \
- }; \
- return that; \
- } \
- /**/
- BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_PROTO_MAX_ARITY), M0, ~)
- #undef M0
- };
-
/// \brief Construct an expression of the requested tag type
/// with a domain and with the specified arguments as children.
///
@@ -932,7 +927,7 @@
Tag
, deduce_domain
, A0 const
- >::call(a0);
+ >()(a0);
}
/// \overload
@@ -949,7 +944,7 @@
Tag
, Domain
, B0 const
- >::call(b0);
+ >()(b0);
}
// Additional overloads generated by the preprocessor...
@@ -1054,13 +1049,6 @@
: mpl::true_
{};
- /// INTERNAL ONLY
- ///
- template<typename Tag, typename Domain>
- struct is_callable<_make_expr<Tag, Domain> >
- : mpl::true_
- {};
-
}}
#ifdef _MSC_VER
@@ -1173,9 +1161,9 @@
, BOOST_PP_CAT(list, N)<BOOST_PP_ENUM(N, BOOST_PROTO_AS_CHILD_TYPE, (A, ~, Domain)) >
> expr_type;
- typedef typename Domain::template result<void(expr_type)>::type type;
+ typedef typename Domain::template result<void(expr_type)>::type result_type;
- static type const call(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference<A, >::type a))
+ result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference<A, >::type a)) const
{
expr_type that = {
BOOST_PP_ENUM(N, BOOST_PROTO_AS_CHILD, (A, a, Domain))
@@ -1253,14 +1241,14 @@
Tag
, Domain
BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)
- >::type const
+ >::type
operator ()(BOOST_PP_ENUM_BINARY_PARAMS(N, const A, &a)) const
{
return proto::detail::make_expr_<
Tag
, Domain
BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)
- >::call(BOOST_PP_ENUM_PARAMS(N, a));
+ >()(BOOST_PP_ENUM_PARAMS(N, a));
}
#undef N
@@ -1285,7 +1273,7 @@
Tag
, deduce_domain
BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)
- >::call(BOOST_PP_ENUM_PARAMS(N, a));
+ >()(BOOST_PP_ENUM_PARAMS(N, a));
}
/// \overload
@@ -1302,7 +1290,7 @@
Tag
, Domain
BOOST_PP_ENUM_TRAILING_PARAMS(N, const B)
- >::call(BOOST_PP_ENUM_PARAMS(N, b));
+ >()(BOOST_PP_ENUM_PARAMS(N, b));
}
#undef N
Modified: trunk/boost/proto/proto_fwd.hpp
==============================================================================
--- trunk/boost/proto/proto_fwd.hpp (original)
+++ trunk/boost/proto/proto_fwd.hpp 2008-09-12 01:00:28 EDT (Fri, 12 Sep 2008)
@@ -642,54 +642,51 @@
typedef functional::eval _eval;
typedef functional::deep_copy _deep_copy;
- template<typename Tag, typename Domain = deduce_domain>
- struct _make_expr;
-
- typedef _make_expr<tag::terminal> _make_terminal;
- typedef _make_expr<tag::unary_plus> _make_unary_plus;
- typedef _make_expr<tag::negate> _make_negate;
- typedef _make_expr<tag::dereference> _make_dereference;
- typedef _make_expr<tag::complement> _make_complement;
- typedef _make_expr<tag::address_of> _make_address_of;
- typedef _make_expr<tag::logical_not> _make_logical_not;
- typedef _make_expr<tag::pre_inc> _make_pre_inc;
- typedef _make_expr<tag::pre_dec> _make_pre_dec;
- typedef _make_expr<tag::post_inc> _make_post_inc;
- typedef _make_expr<tag::post_dec> _make_post_dec;
- typedef _make_expr<tag::shift_left> _make_shift_left;
- typedef _make_expr<tag::shift_right> _make_shift_right;
- typedef _make_expr<tag::multiplies> _make_multiplies;
- typedef _make_expr<tag::divides> _make_divides;
- typedef _make_expr<tag::modulus> _make_modulus;
- typedef _make_expr<tag::plus> _make_plus;
- typedef _make_expr<tag::minus> _make_minus;
- typedef _make_expr<tag::less> _make_less;
- typedef _make_expr<tag::greater> _make_greater;
- typedef _make_expr<tag::less_equal> _make_less_equal;
- typedef _make_expr<tag::greater_equal> _make_greater_equal;
- typedef _make_expr<tag::equal_to> _make_equal_to;
- typedef _make_expr<tag::not_equal_to> _make_not_equal_to;
- typedef _make_expr<tag::logical_or> _make_logical_or;
- typedef _make_expr<tag::logical_and> _make_logical_and;
- typedef _make_expr<tag::bitwise_and> _make_bitwise_and;
- typedef _make_expr<tag::bitwise_or> _make_bitwise_or;
- typedef _make_expr<tag::bitwise_xor> _make_bitwise_xor;
- typedef _make_expr<tag::comma> _make_comma;
- typedef _make_expr<tag::mem_ptr> _make_mem_ptr;
- typedef _make_expr<tag::assign> _make_assign;
- typedef _make_expr<tag::shift_left_assign> _make_shift_left_assign;
- typedef _make_expr<tag::shift_right_assign> _make_shift_right_assign;
- typedef _make_expr<tag::multiplies_assign> _make_multiplies_assign;
- typedef _make_expr<tag::divides_assign> _make_divides_assign;
- typedef _make_expr<tag::modulus_assign> _make_modulus_assign;
- typedef _make_expr<tag::plus_assign> _make_plus_assign;
- typedef _make_expr<tag::minus_assign> _make_minus_assign;
- typedef _make_expr<tag::bitwise_and_assign> _make_bitwise_and_assign;
- typedef _make_expr<tag::bitwise_or_assign> _make_bitwise_or_assign;
- typedef _make_expr<tag::bitwise_xor_assign> _make_bitwise_xor_assign;
- typedef _make_expr<tag::subscript> _make_subscript;
- typedef _make_expr<tag::if_else_> _make_if_else;
- typedef _make_expr<tag::function> _make_function;
+ typedef functional::make_expr<tag::terminal> _make_terminal;
+ typedef functional::make_expr<tag::unary_plus> _make_unary_plus;
+ typedef functional::make_expr<tag::negate> _make_negate;
+ typedef functional::make_expr<tag::dereference> _make_dereference;
+ typedef functional::make_expr<tag::complement> _make_complement;
+ typedef functional::make_expr<tag::address_of> _make_address_of;
+ typedef functional::make_expr<tag::logical_not> _make_logical_not;
+ typedef functional::make_expr<tag::pre_inc> _make_pre_inc;
+ typedef functional::make_expr<tag::pre_dec> _make_pre_dec;
+ typedef functional::make_expr<tag::post_inc> _make_post_inc;
+ typedef functional::make_expr<tag::post_dec> _make_post_dec;
+ typedef functional::make_expr<tag::shift_left> _make_shift_left;
+ typedef functional::make_expr<tag::shift_right> _make_shift_right;
+ typedef functional::make_expr<tag::multiplies> _make_multiplies;
+ typedef functional::make_expr<tag::divides> _make_divides;
+ typedef functional::make_expr<tag::modulus> _make_modulus;
+ typedef functional::make_expr<tag::plus> _make_plus;
+ typedef functional::make_expr<tag::minus> _make_minus;
+ typedef functional::make_expr<tag::less> _make_less;
+ typedef functional::make_expr<tag::greater> _make_greater;
+ typedef functional::make_expr<tag::less_equal> _make_less_equal;
+ typedef functional::make_expr<tag::greater_equal> _make_greater_equal;
+ typedef functional::make_expr<tag::equal_to> _make_equal_to;
+ typedef functional::make_expr<tag::not_equal_to> _make_not_equal_to;
+ typedef functional::make_expr<tag::logical_or> _make_logical_or;
+ typedef functional::make_expr<tag::logical_and> _make_logical_and;
+ typedef functional::make_expr<tag::bitwise_and> _make_bitwise_and;
+ typedef functional::make_expr<tag::bitwise_or> _make_bitwise_or;
+ typedef functional::make_expr<tag::bitwise_xor> _make_bitwise_xor;
+ typedef functional::make_expr<tag::comma> _make_comma;
+ typedef functional::make_expr<tag::mem_ptr> _make_mem_ptr;
+ typedef functional::make_expr<tag::assign> _make_assign;
+ typedef functional::make_expr<tag::shift_left_assign> _make_shift_left_assign;
+ typedef functional::make_expr<tag::shift_right_assign> _make_shift_right_assign;
+ typedef functional::make_expr<tag::multiplies_assign> _make_multiplies_assign;
+ typedef functional::make_expr<tag::divides_assign> _make_divides_assign;
+ typedef functional::make_expr<tag::modulus_assign> _make_modulus_assign;
+ typedef functional::make_expr<tag::plus_assign> _make_plus_assign;
+ typedef functional::make_expr<tag::minus_assign> _make_minus_assign;
+ typedef functional::make_expr<tag::bitwise_and_assign> _make_bitwise_and_assign;
+ typedef functional::make_expr<tag::bitwise_or_assign> _make_bitwise_or_assign;
+ typedef functional::make_expr<tag::bitwise_xor_assign> _make_bitwise_xor_assign;
+ typedef functional::make_expr<tag::subscript> _make_subscript;
+ typedef functional::make_expr<tag::if_else_> _make_if_else;
+ typedef functional::make_expr<tag::function> _make_function;
template<typename T>
struct is_callable;
Modified: trunk/boost/proto/transform/arg.hpp
==============================================================================
--- trunk/boost/proto/transform/arg.hpp (original)
+++ trunk/boost/proto/transform/arg.hpp 2008-09-12 01:00:28 EDT (Fri, 12 Sep 2008)
@@ -271,7 +271,7 @@
/// \return <tt>t</tt>
/// \throw nothrow
template<typename T>
- T const &operator ()(T const &t) const
+ T operator ()(T const &t) const
{
return t;
}
@@ -279,7 +279,7 @@
/// \overload
///
template<typename T>
- T &operator ()(boost::reference_wrapper<T> const &t) const
+ T operator ()(boost::reference_wrapper<T> const &t) const
{
return t;
}
Modified: trunk/boost/proto/transform/call.hpp
==============================================================================
--- trunk/boost/proto/transform/call.hpp (original)
+++ trunk/boost/proto/transform/call.hpp 2008-09-12 01:00:28 EDT (Fri, 12 Sep 2008)
@@ -26,6 +26,7 @@
#include <boost/proto/transform/impl.hpp>
#include <boost/proto/detail/dont_care.hpp>
#include <boost/proto/detail/as_lvalue.hpp>
+ #include <boost/proto/detail/poly_function.hpp>
#include <boost/proto/detail/suffix.hpp>
namespace boost { namespace proto
@@ -142,15 +143,16 @@
: transform_impl<Expr, State, Data>
{
typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
- typedef typename boost::result_of<Fun(a0)>::type result_type;
+ typedef typename detail::as_mono_function<Fun(a0)>::type mono_fun;
+ typedef typename boost::result_of<mono_fun(a0)>::type result_type;
result_type operator ()(
typename impl2::expr_param expr
, typename impl2::state_param state
, typename impl2::data_param data
) const
{
- return Fun()(
- detail::as_lvalue<a0>(typename when<_, A0>::template impl<Expr, State, Data>()(expr, state, data), 0)
+ return mono_fun()(
+ detail::as_lvalue(typename when<_, A0>::template impl<Expr, State, Data>()(expr, state, data))
);
}
};
@@ -212,16 +214,17 @@
{
typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
typedef typename when<_, A1>::template impl<Expr, State, Data>::result_type a1;
- typedef typename boost::result_of<Fun(a0, a1)>::type result_type;
+ typedef typename detail::as_mono_function<Fun(a0, a1)>::type mono_fun;
+ typedef typename boost::result_of<mono_fun(a0, a1)>::type result_type;
result_type operator ()(
typename impl2::expr_param expr
, typename impl2::state_param state
, typename impl2::data_param data
) const
{
- return Fun()(
- detail::as_lvalue<a0>(typename when<_, A0>::template impl<Expr, State, Data>()(expr, state, data), 0)
- , detail::as_lvalue<a1>(typename when<_, A1>::template impl<Expr, State, Data>()(expr, state, data), 0)
+ return mono_fun()(
+ detail::as_lvalue(typename when<_, A0>::template impl<Expr, State, Data>()(expr, state, data))
+ , detail::as_lvalue(typename when<_, A1>::template impl<Expr, State, Data>()(expr, state, data))
);
}
};
@@ -292,17 +295,18 @@
typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
typedef typename when<_, A1>::template impl<Expr, State, Data>::result_type a1;
typedef typename when<_, A2>::template impl<Expr, State, Data>::result_type a2;
- typedef typename boost::result_of<Fun(a0, a1, a2)>::type result_type;
+ typedef typename detail::as_mono_function<Fun(a0, a1, a2)>::type mono_fun;
+ typedef typename boost::result_of<mono_fun(a0, a1, a2)>::type result_type;
result_type operator ()(
typename impl2::expr_param expr
, typename impl2::state_param state
, typename impl2::data_param data
) const
{
- return Fun()(
- detail::as_lvalue<a0>(typename when<_, A0>::template impl<Expr, State, Data>()(expr, state, data), 0)
- , detail::as_lvalue<a1>(typename when<_, A1>::template impl<Expr, State, Data>()(expr, state, data), 0)
- , detail::as_lvalue<a2>(typename when<_, A2>::template impl<Expr, State, Data>()(expr, state, data), 0)
+ return mono_fun()(
+ detail::as_lvalue(typename when<_, A0>::template impl<Expr, State, Data>()(expr, state, data))
+ , detail::as_lvalue(typename when<_, A1>::template impl<Expr, State, Data>()(expr, state, data))
+ , detail::as_lvalue(typename when<_, A2>::template impl<Expr, State, Data>()(expr, state, data))
);
}
};
@@ -384,7 +388,11 @@
#undef M0
typedef
- typename boost::result_of<Fun(BOOST_PP_ENUM_PARAMS(N, a))>::type
+ typename detail::as_mono_function<Fun(BOOST_PP_ENUM_PARAMS(N, a))>::type
+ mono_fun;
+
+ typedef
+ typename boost::result_of<mono_fun(BOOST_PP_ENUM_PARAMS(N, a))>::type
result_type;
/// Let \c ax be <tt>when\<_, Ax\>()(expr, state, data)</tt>
@@ -401,10 +409,10 @@
) const
{
#define M0(Z, M, DATA) \
- detail::as_lvalue<BOOST_PP_CAT(a, M)>( \
+ detail::as_lvalue( \
typename when<_, BOOST_PP_CAT(A, M)> \
- ::template impl<Expr, State, Data>()(expr, state, data), 0) \
- return Fun()(BOOST_PP_ENUM(N, M0, ~));
+ ::template impl<Expr, State, Data>()(expr, state, data)) \
+ return mono_fun()(BOOST_PP_ENUM(N, M0, ~));
#undef M0
}
};
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