|
Boost-Commit : |
From: eric_at_[hidden]
Date: 2008-05-27 12:39:33
Author: eric_niebler
Date: 2008-05-27 12:39:32 EDT (Tue, 27 May 2008)
New Revision: 45815
URL: http://svn.boost.org/trac/boost/changeset/45815
Log:
get let() tests passing on gcc
Text files modified:
branches/proto/v4/boost/phoenix/core/actor.hpp | 56 ++++++++++++----------------
branches/proto/v4/boost/phoenix/function/function.hpp | 3 +
branches/proto/v4/boost/phoenix/scope/let.hpp | 9 ++--
branches/proto/v4/boost/phoenix/scope/local_variable.hpp | 79 ++++++++++++++++++++++++++-------------
4 files changed, 84 insertions(+), 63 deletions(-)
Modified: branches/proto/v4/boost/phoenix/core/actor.hpp
==============================================================================
--- branches/proto/v4/boost/phoenix/core/actor.hpp (original)
+++ branches/proto/v4/boost/phoenix/core/actor.hpp 2008-05-27 12:39:32 EDT (Tue, 27 May 2008)
@@ -68,31 +68,22 @@
////////////////////////////////////////////////////////////////////////////////////////////
template<typename SubGrammar>
struct is_nullary_cases;
-
+
////////////////////////////////////////////////////////////////////////////////////////
// True when a lambda expression can be applied with no arguments and
// without an active exception object
template<typename SubGrammar = proto::not_<proto::_>, typename X = proto::callable>
struct is_nullary
- : proto::and_<
- evaluator<SubGrammar> // only valid expressions can be evaluated as "nullary"
- , proto::or_<
- SubGrammar
- , proto::switch_<is_nullary_cases<SubGrammar> >
- >
+ : proto::or_<
+ SubGrammar
+ , proto::switch_<is_nullary_cases<SubGrammar> >
>
{};
////////////////////////////////////////////////////////////////////////////////////////
template<typename Tag, typename SubGrammar>
struct is_nullary_extension
- : proto::otherwise<
- proto::fold<
- proto::_
- , mpl::true_()
- , mpl::and_<proto::_state, is_nullary<SubGrammar> >()
- >
- >
+ : proto::nary_expr<Tag, proto::vararg<is_nullary<SubGrammar> > >
{};
////////////////////////////////////////////////////////////////////////////////////////
@@ -113,7 +104,7 @@
template<typename X>
struct case_<proto::tag::terminal, X>
- : proto::otherwise<is_terminal_nullary_local<proto::_value>()>
+ : proto::if_<is_terminal_nullary_local<proto::_value>()>
{};
};
@@ -128,7 +119,7 @@
struct terminal_extension_local
: terminal_extension<Value, SubGrammar>
{};
-
+
public:
template<typename Tag, typename X = void>
struct case_
@@ -240,7 +231,7 @@
template<typename This>
struct result<This()>
: mpl::if_c<
- result_of<is_nullary<>(This &)>::type::value
+ proto::matches<This, proto::and_<evaluator<>, is_nullary<> > >::type::value
, result_of<evaluator<>(This &, initial_state_type, fusion::vector0 &)>
, mpl::identity<void>
>::type
@@ -261,12 +252,12 @@
BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(PHOENIX_LIMIT), M0, ~)
#undef M0
}
-
+
////////////////////////////////////////////////////////////////////////////////////////////
struct INVALID_LAMBDA_EXPRESSION
: mpl::false_
{};
-
+
////////////////////////////////////////////////////////////////////////////////////////////
struct VALID_LAMBDA_EXPRESSION
: mpl::true_
@@ -290,8 +281,9 @@
typename result<Expr const()>::type
operator()() const
{
+ typedef typename result<Expr const()>::type result_type;
fusion::vector0 args;
- return this->evaluate(args);
+ return this->evaluate<result_type>(args);
}
#define M0(Z, N, _) ((0))
@@ -305,9 +297,12 @@
typename result<Expr const(BOOST_PP_SEQ_FOR_EACH_I_R(R, M5, ~, PRODUCT))>::type \
operator ()(BOOST_PP_SEQ_FOR_EACH_I_R(R, M4, ~, PRODUCT)) const \
{ \
+ typedef typename \
+ result<Expr const(BOOST_PP_SEQ_FOR_EACH_I_R(R, M5, ~, PRODUCT))>::type \
+ result_type; \
BOOST_PP_CAT(fusion::vector, SIZE)<BOOST_PP_SEQ_FOR_EACH_I_R(R, M5, ~, PRODUCT)> args \
(BOOST_PP_SEQ_FOR_EACH_I_R(R, M6, ~, PRODUCT)); \
- return this->evaluate(args); \
+ return this->evaluate<result_type>(args); \
} \
/**/
@@ -339,11 +334,10 @@
#undef M4
#undef M5
#undef M6
-
+
private:
- template<typename Args>
- typename result_of<evaluator<>(Expr const &, detail::initial_state_type, Args &)>::type
- evaluate(Args &args) const
+ template<typename Result, typename Args>
+ Result evaluate(Args &args) const
{
typedef typename
mpl::if_<
@@ -357,19 +351,17 @@
// the Phoenix lambda grammar. Go back and check your expression for well-formedness.
BOOST_MPL_ASSERT((IS_VALID_LAMBDA_EXPRESSION));
- return this->evaluate(args, IS_VALID_LAMBDA_EXPRESSION());
+ return this->evaluate<Result>(args, IS_VALID_LAMBDA_EXPRESSION());
}
- template<typename Args>
- typename result_of<evaluator<>(Expr const &, detail::initial_state_type, Args &)>::type
- evaluate(Args &args, mpl::true_) const
+ template<typename Result, typename Args>
+ Result evaluate(Args &args, mpl::true_) const
{
return evaluator<>()(this->proto_base(), mpl::void_(), args);
}
- template<typename Args>
- typename result_of<evaluator<>(Expr const &, detail::initial_state_type, Args &)>::type
- evaluate(Args &args, mpl::false_) const
+ template<typename Result, typename Args>
+ Result evaluate(Args &args, mpl::false_) const
{
BOOST_ASSERT(false);
throw "never called";
Modified: branches/proto/v4/boost/phoenix/function/function.hpp
==============================================================================
--- branches/proto/v4/boost/phoenix/function/function.hpp (original)
+++ branches/proto/v4/boost/phoenix/function/function.hpp 2008-05-27 12:39:32 EDT (Tue, 27 May 2008)
@@ -16,7 +16,8 @@
template<typename Fun>
struct function
{
- BOOST_PROTO_EXTENDS(typename proto::terminal<Fun>::type, function<Fun>, detail::domain)
+ typedef typename proto::terminal<Fun>::type base_type;
+ BOOST_PROTO_EXTENDS(base_type, function<Fun>, detail::domain)
};
}}
Modified: branches/proto/v4/boost/phoenix/scope/let.hpp
==============================================================================
--- branches/proto/v4/boost/phoenix/scope/let.hpp (original)
+++ branches/proto/v4/boost/phoenix/scope/let.hpp 2008-05-27 12:39:32 EDT (Tue, 27 May 2008)
@@ -216,8 +216,9 @@
{};
////////////////////////////////////////////////////////////////////////////////////
+ template<typename Expr>
struct is_nullary
- : phoenix::is_nullary<SubGrammar>
+ : proto::matches<Expr, phoenix::is_nullary<SubGrammar> >
{};
////////////////////////////////////////////////////////////////////////////////////
@@ -228,16 +229,16 @@
template<typename This, typename Elem, typename State>
struct result<This(Elem &, State &)>
- : mpl::and_<State, result_of<is_nullary(typename Elem::second_type)> >
+ : mpl::and_<State, is_nullary<typename Elem::second_type> >
{};
};
////////////////////////////////////////////////////////////////////////////////////
struct is_nullary_extension
- : proto::otherwise<
+ : proto::if_<
fusion::result_of::fold<
proto::_value(proto::_left)
- , proto::call<is_nullary(proto::_right)>
+ , is_nullary<proto::_right>()
, proto::make<is_nullary_fun>
>()
>
Modified: branches/proto/v4/boost/phoenix/scope/local_variable.hpp
==============================================================================
--- branches/proto/v4/boost/phoenix/scope/local_variable.hpp (original)
+++ branches/proto/v4/boost/phoenix/scope/local_variable.hpp 2008-05-27 12:39:32 EDT (Tue, 27 May 2008)
@@ -114,32 +114,59 @@
////////////////////////////////////////////////////////////////////////////////////////////////
namespace local_names
{
- actor<local_variable<struct _a_key> > const _a = {{{{}}}};
- actor<local_variable<struct _b_key> > const _b = {{{{}}}};
- actor<local_variable<struct _c_key> > const _c = {{{{}}}};
- actor<local_variable<struct _d_key> > const _d = {{{{}}}};
- actor<local_variable<struct _e_key> > const _e = {{{{}}}};
- actor<local_variable<struct _f_key> > const _f = {{{{}}}};
- actor<local_variable<struct _g_key> > const _g = {{{{}}}};
- actor<local_variable<struct _h_key> > const _h = {{{{}}}};
- actor<local_variable<struct _i_key> > const _i = {{{{}}}};
- actor<local_variable<struct _j_key> > const _j = {{{{}}}};
- actor<local_variable<struct _k_key> > const _k = {{{{}}}};
- actor<local_variable<struct _l_key> > const _l = {{{{}}}};
- actor<local_variable<struct _m_key> > const _m = {{{{}}}};
- actor<local_variable<struct _n_key> > const _n = {{{{}}}};
- actor<local_variable<struct _o_key> > const _o = {{{{}}}};
- actor<local_variable<struct _p_key> > const _p = {{{{}}}};
- actor<local_variable<struct _q_key> > const _q = {{{{}}}};
- actor<local_variable<struct _r_key> > const _r = {{{{}}}};
- actor<local_variable<struct _s_key> > const _s = {{{{}}}};
- actor<local_variable<struct _t_key> > const _t = {{{{}}}};
- actor<local_variable<struct _u_key> > const _u = {{{{}}}};
- actor<local_variable<struct _v_key> > const _v = {{{{}}}};
- actor<local_variable<struct _w_key> > const _w = {{{{}}}};
- actor<local_variable<struct _x_key> > const _x = {{{{}}}};
- actor<local_variable<struct _y_key> > const _y = {{{{}}}};
- actor<local_variable<struct _z_key> > const _z = {{{{}}}};
+ struct _a_key {};
+ struct _b_key {};
+ struct _c_key {};
+ struct _d_key {};
+ struct _e_key {};
+ struct _f_key {};
+ struct _g_key {};
+ struct _h_key {};
+ struct _i_key {};
+ struct _j_key {};
+ struct _k_key {};
+ struct _l_key {};
+ struct _m_key {};
+ struct _n_key {};
+ struct _o_key {};
+ struct _p_key {};
+ struct _q_key {};
+ struct _r_key {};
+ struct _s_key {};
+ struct _t_key {};
+ struct _u_key {};
+ struct _v_key {};
+ struct _w_key {};
+ struct _x_key {};
+ struct _y_key {};
+ struct _z_key {};
+
+ actor<local_variable<_a_key> > const _a = {{{{}}}};
+ actor<local_variable<_b_key> > const _b = {{{{}}}};
+ actor<local_variable<_c_key> > const _c = {{{{}}}};
+ actor<local_variable<_d_key> > const _d = {{{{}}}};
+ actor<local_variable<_e_key> > const _e = {{{{}}}};
+ actor<local_variable<_f_key> > const _f = {{{{}}}};
+ actor<local_variable<_g_key> > const _g = {{{{}}}};
+ actor<local_variable<_h_key> > const _h = {{{{}}}};
+ actor<local_variable<_i_key> > const _i = {{{{}}}};
+ actor<local_variable<_j_key> > const _j = {{{{}}}};
+ actor<local_variable<_k_key> > const _k = {{{{}}}};
+ actor<local_variable<_l_key> > const _l = {{{{}}}};
+ actor<local_variable<_m_key> > const _m = {{{{}}}};
+ actor<local_variable<_n_key> > const _n = {{{{}}}};
+ actor<local_variable<_o_key> > const _o = {{{{}}}};
+ actor<local_variable<_p_key> > const _p = {{{{}}}};
+ actor<local_variable<_q_key> > const _q = {{{{}}}};
+ actor<local_variable<_r_key> > const _r = {{{{}}}};
+ actor<local_variable<_s_key> > const _s = {{{{}}}};
+ actor<local_variable<_t_key> > const _t = {{{{}}}};
+ actor<local_variable<_u_key> > const _u = {{{{}}}};
+ actor<local_variable<_v_key> > const _v = {{{{}}}};
+ actor<local_variable<_w_key> > const _w = {{{{}}}};
+ actor<local_variable<_x_key> > const _x = {{{{}}}};
+ actor<local_variable<_y_key> > const _y = {{{{}}}};
+ actor<local_variable<_z_key> > const _z = {{{{}}}};
}
}}
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