|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67429 - in sandbox/SOC/2010/phoenix3: boost/phoenix/core boost/phoenix/core/detail boost/phoenix/operator boost/phoenix/scope boost/phoenix/scope/detail boost/phoenix/stl/algorithm libs/phoenix/test libs/phoenix/test/algorithm libs/phoenix/test/scope
From: thom.heller_at_[hidden]
Date: 2010-12-23 06:50:44
Author: theller
Date: 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
New Revision: 67429
URL: http://svn.boost.org/trac/boost/changeset/67429
Log:
phoenix3 refactoring complete, all tests pass again
Text files modified:
sandbox/SOC/2010/phoenix3/boost/phoenix/core/actor.hpp | 53 ----
sandbox/SOC/2010/phoenix3/boost/phoenix/core/argument.hpp | 9
sandbox/SOC/2010/phoenix3/boost/phoenix/core/detail/actor_result_of.hpp | 4
sandbox/SOC/2010/phoenix3/boost/phoenix/core/environment.hpp | 132 ++------------
sandbox/SOC/2010/phoenix3/boost/phoenix/core/is_nullary.hpp | 1
sandbox/SOC/2010/phoenix3/boost/phoenix/core/terminal.hpp | 10 -
sandbox/SOC/2010/phoenix3/boost/phoenix/core/value.hpp | 100 ----------
sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp | 39 +++
sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/dynamic.hpp | 10
sandbox/SOC/2010/phoenix3/boost/phoenix/scope/dynamic.hpp | 150 ++++++++++-----
sandbox/SOC/2010/phoenix3/boost/phoenix/scope/lambda.hpp | 370 +++++++++++----------------------------
sandbox/SOC/2010/phoenix3/boost/phoenix/scope/let.hpp | 11
sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp | 113 +----------
sandbox/SOC/2010/phoenix3/boost/phoenix/scope/scoped_environment.hpp | 14
sandbox/SOC/2010/phoenix3/boost/phoenix/stl/algorithm/iteration.hpp | 17 +
sandbox/SOC/2010/phoenix3/boost/phoenix/stl/algorithm/transformation.hpp | 25 ++
sandbox/SOC/2010/phoenix3/libs/phoenix/test/Jamfile | 8
sandbox/SOC/2010/phoenix3/libs/phoenix/test/algorithm/transformation1.cpp | 1
sandbox/SOC/2010/phoenix3/libs/phoenix/test/algorithm/transformation2.cpp | 4
sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/dynamic_tests.cpp | 18 +
sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/lambda_tests.cpp | 37 ---
21 files changed, 363 insertions(+), 763 deletions(-)
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/actor.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/actor.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/actor.hpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -52,14 +52,6 @@
template <typename Expr>
struct result_matches
: mpl::eval_if<
- typename is_nullary<Expr>::type // avoid calling result_of::actor when this is false
- , boost::result_of<
- evaluator(
- Expr const &
- , fusion::vector2<fusion::vector0<>&, default_actions>&
- )
- >
- , mpl::identity<detail::error_expecting_arguments>
>
{};
@@ -70,43 +62,19 @@
typedef
typename mpl::eval_if<
- typename proto::matches<Expr, meta_grammar>::type
- , result_matches<Expr>
- , mpl::identity<detail::error_invalid_lambda_expr>
+ typename is_nullary<Expr>::type // avoid calling result_of::actor when this is false
+ , boost::result_of<
+ evaluator(
+ Expr const &
+ , fusion::vector2<fusion::vector0<>&, default_actions>&
+ )
+ >
+ //evaluator<Expr const &, fusion::vector2<fusion::vector0<>&, default_actions>&>
+ , mpl::identity<detail::error_expecting_arguments>
>::type
type;
};
- template <typename Expr, typename A0>
- struct actor<Expr, A0>
- : boost::result_of<
- evaluator(
- Expr const &
- , fusion::vector2<fusion::vector1<A0>&, default_actions>&
- )
- >
- {};
-
- template <typename Expr, typename A0, typename A1>
- struct actor<Expr, A0, A1>
- : boost::result_of<
- evaluator(
- Expr const&
- , fusion::vector2<fusion::vector2<A0, A1>&, default_actions>&
- )
- >
- {};
-
- template <typename Expr, typename A0, typename A1, typename A2>
- struct actor<Expr, A0, A1, A2>
- : boost::result_of<
- evaluator(
- Expr const&
- , fusion::vector2<fusion::vector3<A0, A1, A2>&, default_actions>&
- )
- >
- {};
-
// Bring in the rest
#include <boost/phoenix/core/detail/actor_result_of.hpp>
}
@@ -166,9 +134,6 @@
typedef typename proto::domain_of<actor<Expr> >::type domain_type;
typedef typename domain_type::proto_grammar grammar_type;
- std::cout << typeid(actor<Expr>).name() << "\n";
- std::cout << typeid(grammar_type).name() << "\n";
-
return eval(*this, env);
}
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/argument.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/argument.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/argument.hpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -43,10 +43,15 @@
typedef typename I::value_type value_type;
static value_type const value = I::value;
+ bool operator==(argument) const
+ {
+ return true;
+ }
+
template <typename I2>
- bool operator==(argument<I2> const&) const
+ bool operator==(argument<I2>) const
{
- return value == I2::value;
+ return false;
}
};
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/detail/actor_result_of.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/detail/actor_result_of.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/detail/actor_result_of.hpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -14,7 +14,7 @@
#include <boost/phoenix/support/iterate.hpp>
#define PHOENIX_ITERATION_PARAMS \
- (3, (4, PHOENIX_ACTOR_LIMIT, \
+ (3, (1, PHOENIX_ACTOR_LIMIT, \
<boost/phoenix/core/detail/actor_result_of.hpp>))
#include PHOENIX_ITERATE()
@@ -31,7 +31,7 @@
PHOENIX_ENV(PHOENIX_A)&)>
*/
: boost::result_of<
- evaluator(
+ phoenix::evaluator(
Expr const&
//, typename make_basic_environment<default_actions, PHOENIX_A>::type &
, fusion::vector2<
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/environment.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/environment.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/environment.hpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -21,7 +21,7 @@
{
namespace functional
{
- template <typename N, typename Callable = proto::callable>
+ template <typename N>
struct at
: proto::callable
{
@@ -32,14 +32,16 @@
template <typename This, typename Seq>
struct result<This(Seq)>
- : fusion::result_of::at_c<
- typename boost::remove_reference<Seq>::type
- , index::value
- >
+ : result<This(Seq const&)>
+ {};
+
+ template <typename This, typename Seq>
+ struct result<This(Seq &)>
+ : fusion::result_of::at_c<Seq, index::value>
{};
template <typename Seq>
- typename result<at(Seq &)>::type
+ typename fusion::result_of::at_c<Seq, index::value>::type
operator()(Seq& seq) const
{
return fusion::at_c<index::value>(seq);
@@ -57,7 +59,14 @@
template <typename This, typename N, typename Env>
struct result<This(N, Env)>
- : boost::result_of<at<N>(typename boost::result_of<args(Env &)>::type)>
+ : result<This(N, Env const&)>
+ {};
+
+ template <typename This, typename N, typename Env>
+ struct result<This(N, Env &)>
+ : boost::result_of<
+ at<N>(typename args::result<args(Env &)>::type)
+ >
{};
template <typename N, typename Env>
@@ -91,111 +100,12 @@
template <typename T, typename Enable = void>
struct is_environment : fusion::traits::is_sequence<T> {};
-
- /*
- namespace result_of
- {
- template <typename Env, typename N, typename Dummy = void>
- struct get_environment_argument
- : fusion::result_of::at_c<Env, N::value> {};
- }
-
- template <int N, typename Env>
- typename boost::enable_if<
- is_environment<Env>
- , typename result_of::get_environment_argument<Env, mpl::int_<N> >::type
- >::type
- get_environment_argument_c(Env& env)
- {
- return fusion::at_c<N>(env);
- }
-
- template <typename N, typename Env>
- typename boost::enable_if<
- is_environment<Env>
- , typename result_of::get_environment_argument<Env, N>::type
- >::type
- get_environment_argument_c(Env& env)
- {
- return fusion::at_c<N::value>(env);
- }
-
- // Get the Nth argument from the environment
- struct get_environment_argument
- {
- template <typename Sig>
- struct result;
-
- template <typename This, typename Env, typename N>
- struct result<This(Env&, N)>
- : result_of::get_environment_argument<Env, N> {};
-
- template <typename Env, typename N>
- typename result_of::get_environment_argument<Env, N>::type
- operator()(Env& env, N) const
- {
- return get_environment_argument_c<N::value>(env);
- //return fusion::at_c<N::value>(env);
- }
- };
- */
-
- /*
- template <typename Actions, PHOENIX_typename_A_void(PHOENIX_ARG_LIMIT), typename Dummy = void>
- struct make_environment;
-
- template <typename Actions>
- struct make_environment<Actions>
- {
- typedef fusion::vector0<> params_type;
- typedef fusion::vector2<params_type &, Actions> type;
-
- static type make(params_type & params)
- {
- return type(params, Actions());
- }
- };
-
- template <typename Actions, typename A0>
- struct make_basic_environment<Actions, A0>
- {
- typedef fusion::vector1<A0> params_type;
- //typedef fusion::vector2<params_type, Actions> type;
-
- static type make(A0 a0)
- {
- return type(params_type(a0), Actions());
- }
- };
-
- template <typename Actions, typename A0, typename A1>
- struct make_basic_environment<Actions, A0, A1>
- {
- typedef fusion::vector2<A0, A1> params_type;
- typedef fusion::vector2<params_type, Actions> type;
-
- static type make(A0 a0, A1 a1)
- {
- params_type params(a0, a1);
- return type(params, Actions());
- }
- };
-
- template <typename Actions, typename A0, typename A1, typename A2>
- struct make_basic_environment<Actions, A0, A1, A2>
- {
- typedef fusion::vector3<A0, A1, A2> params_type;
- typedef fusion::vector2<params_type, Actions> type;
+}}
- static type make(A0 a0, A1 a1, A2 a2)
- {
- return type(params_type(a0, a1, a2), Actions());
- }
- };
-
- // Bring in the rest
- #include <boost/phoenix/core/detail/make_basic_environment.hpp>
- */
+namespace boost { namespace proto
+{
+ template <typename N>
+ struct is_callable<boost::phoenix::functional::at<N> > : mpl::true_ {};
}}
#endif
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/is_nullary.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/is_nullary.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/is_nullary.hpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -44,7 +44,6 @@
template <typename Dummy>
struct is_nullary_::when<rule::custom_terminal, Dummy>
: proto::lazy<is_nullary<custom_terminal<proto::_value> >(proto::_, _env)>
- //proto::make<mpl::true_()>
{};
template <typename Dummy>
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/terminal.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/terminal.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/terminal.hpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -10,16 +10,6 @@
#include <boost/is_placeholder.hpp>
-/*
-namespace boost
-{
- template <typename T>
- struct is_placeholder
- : mpl::false_
- {};
-}
-*/
-
namespace boost { namespace phoenix
{
template <typename T>
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/value.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/value.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/value.hpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -76,107 +76,9 @@
template <typename T>
struct is_nullary<custom_terminal<actor<T> > >
- //: proto::make<typename is_nullary<T>::type()>
- //: proto::make<mpl::false_()>
- : proto::call<evaluator(proto::_value)>//, fusion::vector2<fusion::vector0<>, detail::is_nullary_>())>
+ : proto::call<evaluator(proto::_value)>
{};
- /*
- namespace result_of
- {
- template <typename Env, typename T>
- struct value
- : boost::result_of<eval_grammar(T const&)>
- {};
-
- template <typename Env, typename Expr>
- struct actor_value
- : remove_const<
- typename remove_reference<
- typename boost::result_of<eval_grammar(Expr const&, Env&)>::type
- >::type
- >
- {};
- }
-
- struct value
- {
- template<typename Sig>
- struct result;
-
- template<typename This, typename Env, typename T>
- struct result<This(Env&,T const&)>
- : result_of::value<Env, T>
- {};
-
- template<typename Env, typename T>
- typename result_of::value<Env, T>::type
- operator()(Env& env, T const& t) const
- {
- return eval(t);
- }
- };
-
- struct actor_value
- {
- template<typename Sig>
- struct result;
-
- template<typename This, typename Env, typename Actor>
- struct result<This(Env&, Actor const&)>
- : result_of::actor_value<Env, Actor>
- {};
-
- template<typename Env, typename Actor>
- typename result_of::actor_value<Env, Actor>::type
- operator()(Env& env, Actor const& actor) const
- {
- return eval(actor, env);
- }
- };
-
- namespace detail
- {
- template <typename T>
- struct convert_value
- {
- typedef T type;
- };
-
- template <typename T, int N>
- struct convert_value<T[N]>
- {
- typedef T const* type;
- };
- }
-
- template <typename T>
- struct make_value : compose<value, typename detail::convert_value<T>::type> {};
-
- template <typename Actor>
- struct make_actor_value : compose<actor_value, Actor> {};
-
- template <typename Expr>
- typename make_actor_value<actor<Expr> >::type const
- val(actor<Expr> const& a)
- {
- return make_actor_value<actor<Expr> >()(a);
- }
-
- template <typename T>
- typename make_value<T>::type const
- val(T const & t )
- {
- return make_value<T>()(t);
- }
-
- template <typename T>
- typename make_value<T>::type const
- val(T & t )
- {
- return make_value<T>()(t);
- }
-*/
}}
#endif
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -58,11 +58,42 @@
#else // PHOENIX_IS_ITERATING
- template<typename This, typename Env, typename T1, typename T2 BOOST_PP_ENUM_TRAILING_PARAMS(PHOENIX_ITERATION, typename A)>
- struct result<This(Env, T1 const&, T2 const& BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(PHOENIX_ITERATION, A, const & BOOST_PP_INTERCEPT))>
+
+ template<typename This, typename Env, typename T1, typename T2 BOOST_PP_COMMA_IF(PHOENIX_ITERATION) PHOENIX_typename_A>
+ struct result<
+ This(
+ Env
+ , T1 const&
+ , T2 const&
+ BOOST_PP_COMMA_IF(PHOENIX_ITERATION) PHOENIX_A_const_ref
+ )
+ >
+ : result<
+ This(
+ Env const &
+ , T1 const&
+ , T2 const&
+ BOOST_PP_COMMA_IF(PHOENIX_ITERATION) PHOENIX_A_const_ref
+ )
+ >
+ {};
+
+ template<typename This, typename Env, typename T1, typename T2 BOOST_PP_COMMA_IF(PHOENIX_ITERATION) PHOENIX_typename_A>
+ struct result<
+ This(
+ Env &
+ , T1 const&
+ , T2 const&
+ BOOST_PP_COMMA_IF(PHOENIX_ITERATION) PHOENIX_A_const_ref)
+ >
: boost::result_of<
- typename boost::remove_reference<typename boost::result_of<evaluator(T2 const &, Env&)>::type>::type(
- typename boost::result_of<evaluator(T1 const&, Env&)>::type
+ typename boost::remove_reference<
+ typename boost::result_of<
+ evaluator(T2 const &, Env&)>::type
+ >::type(
+ typename boost::result_of<
+ evaluator(T1 const&, Env&)
+ >::type
BOOST_PP_ENUM_TRAILING(PHOENIX_ITERATION, PHOENIX_MEMBER_RESULT_OF, _)
)
>
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/dynamic.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/dynamic.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/dynamic.hpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -16,7 +16,10 @@
#else
#define PHOENIX_SCOPE_DYNAMIC_MEMBER_I(_, n, __) \
- typedef typename make_dynamic_member<n, self_type>::type BOOST_PP_CAT(member, BOOST_PP_INC(n));
+ typedef typename expression::dynamic_member<mpl::int_<n>, self_type>::type BOOST_PP_CAT(member, BOOST_PP_INC(n));
+
+
+//typedef typename make_dynamic_member<n, self_type>::type BOOST_PP_CAT(member, BOOST_PP_INC(n));
#define PHOENIX_SCOPE_DYNAMIC_MEMBER BOOST_PP_REPEAT(PHOENIX_ITERATION, PHOENIX_SCOPE_DYNAMIC_MEMBER_I, _)
@@ -31,10 +34,11 @@
: frame(0) {}
template <int N>
- static typename make_dynamic_member<N, self_type>::type
+ static
+ void //typename make_dynamic_member<N, self_type>::type
init(self_type& scope)
{
- return make_dynamic_member<N, self_type>()(dynamic_member_data<N, self_type>(static_cast<self_type &>(scope)));
+ //return make_dynamic_member<N, self_type>()(dynamic_member_data<N, self_type>(static_cast<self_type &>(scope)));
}
PHOENIX_SCOPE_DYNAMIC_MEMBER
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/dynamic.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/dynamic.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/dynamic.hpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -12,12 +12,61 @@
#include <boost/assert.hpp>
#include <boost/noncopyable.hpp>
#include <boost/fusion/sequence/intrinsic/at.hpp>
-#include <boost/phoenix/core/compose.hpp>
+#include <boost/phoenix/core/expression.hpp>
#include <boost/phoenix/support/iterate.hpp>
+#include <boost/preprocessor/seq/for_each.hpp>
+#include <boost/preprocessor/seq/fold_left.hpp>
+#include <boost/preprocessor/punctuation/comma.hpp>
+
+#define BOOST_PHOENIX_DYNAMIC_TEMPLATE_PARAMS(R, DATA, I, ELEM) \
+ BOOST_PP_COMMA_IF(I) BOOST_PP_TUPLE_ELEM(2, 0, ELEM) \
+/**/
+
+#define BOOST_PHOENIX_DYNAMIC_CTOR_INIT(R, DATA, I, ELEM) \
+ BOOST_PP_COMMA_IF(I) BOOST_PP_TUPLE_ELEM(2, 1, ELEM)(init<I>(this)) \
+/**/
+
+#define BOOST_PHOENIX_DYNAMIC_MEMBER(R, DATA, I, ELEM) \
+ BOOST_PP_CAT(member, BOOST_PP_INC(I)) BOOST_PP_TUPLE_ELEM(2, 1, ELEM); \
+/**/
+
+#define BOOST_PHOENIX_DYNAMIC_FILLER_0(X, Y) \
+ ((X, Y)) BOOST_PHOENIX_DYNAMIC_FILLER_1 \
+/**/
+
+#define BOOST_PHOENIX_DYNAMIC_FILLER_1(X, Y) \
+ ((X, Y)) BOOST_PHOENIX_DYNAMIC_FILLER_0 \
+/**/
+
+#define BOOST_PHOENIX_DYNAMIC_FILLER_0_END
+#define BOOST_PHOENIX_DYNAMIC_FILLER_1_END
+
+#define BOOST_PHOENIX_DYNAMIC_BASE(NAME, MEMBER) \
+struct NAME \
+ : ::boost::phoenix::dynamic< \
+ BOOST_PP_SEQ_FOR_EACH_I( \
+ BOOST_PHOENIX_DYNAMIC_TEMPLATE_PARAMS \
+ , _ \
+ , MEMBER) \
+ > \
+{ \
+ NAME() \
+ : BOOST_PP_SEQ_FOR_EACH_I(BOOST_PHOENIX_DYNAMIC_CTOR_INIT, _, MEMBER) \
+ {} \
+ \
+ BOOST_PP_SEQ_FOR_EACH_I(BOOST_PHOENIX_DYNAMIC_MEMBER, _, MEMBER) \
+} \
+/**/
+
+#define BOOST_PHOENIX_DYNAMIC(NAME, MEMBER) \
+ BOOST_PHOENIX_DYNAMIC_BASE( \
+ NAME \
+ , BOOST_PP_CAT(BOOST_PHOENIX_DYNAMIC_FILLER_0 MEMBER,_END) \
+ ) \
+/**/
namespace boost { namespace phoenix
{
-
template <typename DynamicScope>
struct dynamic_frame : noncopyable
{
@@ -54,59 +103,44 @@
DynamicScope const& scope;
};
- namespace result_of
- {
- template <typename Env, typename Data>
- struct dynamic_member
- {
- typedef typename proto::result_of::value<Data>::type::result_type type;
- };
- }
+ PHOENIX_DEFINE_EXPRESSION(
+ dynamic_member
+ , (proto::terminal<proto::_>)
+ (proto::terminal<proto::_>)
+ )
- struct dynamic_member
+ struct dynamic_member_eval
{
template <typename Sig>
struct result;
- template <typename This, typename Env, typename Data>
- struct result<This(Env&, Data)>
- : result_of::dynamic_member<Env, typename remove_reference<Data>::type >
- {};
-
- template <typename This, typename Env, typename Data>
- struct result<This(Env&, Data const&)>
- : result_of::dynamic_member<Env, Data>
- {};
-
- template <typename Env, typename Data>
- typename result_of::dynamic_member<Env, Data>::type
- operator()(Env& env, Data const& data)
+ template <typename This, typename Env, typename N, typename Scope>
+ struct result<This(Env, N, Scope)>
{
- return proto::value(data)();
- }
- };
+ typedef
+ typename boost::remove_pointer<
+ typename proto::detail::uncvref<Scope>::type
+ >::type
+ scope_type;
+ typedef typename scope_type::dynamic_frame_type::tuple_type tuple_type;
- template <int N, typename DynamicScope>
- struct dynamic_member_data
- {
+ typedef typename fusion::result_of::at_c<tuple_type, proto::detail::uncvref<N>::type::value>::type type;
- typedef typename fusion::result_of::at_c<typename DynamicScope::tuple_type, N>::type result_type;
-
- dynamic_member_data(DynamicScope const& scope) : scope(scope) {};
+ };
- result_type
- operator()() const
+ template <typename Env, typename N, typename Scope>
+ typename result<dynamic_member_eval(Env, N, Scope)>::type
+ operator()(Env & env, N, Scope s) const
{
- BOOST_ASSERT(scope.frame != 0);
- return fusion::at_c<N>(scope.frame->data());
+ return fusion::at_c<N::value>(s->frame->data());
}
-
- DynamicScope const& scope;
};
- template <int N, typename DynamicScope>
- struct make_dynamic_member: compose<dynamic_member, dynamic_member_data<N, DynamicScope> > {};
-
+ template <typename Dummy>
+ struct default_actions::when<rule::dynamic_member, Dummy>
+ : proto::call<dynamic_member_eval(_env, proto::_value(proto::_child_c<0>), proto::_value(proto::_child_c<1>))>
+ {};
+
template <PHOENIX_typename_A_void(PHOENIX_DYNAMIC_LIMIT), typename Dummy = void>
struct dynamic;
@@ -121,13 +155,15 @@
: frame(0) {}
template <int N>
- static typename make_dynamic_member<N, self_type>::type
+ static
+ void//typename make_dynamic_member<N, self_type>::type
init(self_type& scope)
{
- return make_dynamic_member<N, self_type>()(dynamic_member_data<N, self_type>(static_cast<self_type &>(scope)));
+ //return make_dynamic_member<N, self_type>()(dynamic_member_data<N, self_type>(static_cast<self_type &>(scope)));
}
- typedef typename make_dynamic_member<0, self_type>::type member1;
+ //typedef typename make_dynamic_member<0, self_type>::type member1;
+ typedef typename expression::dynamic_member<mpl::int_<0>, self_type>::type member1;
mutable dynamic_frame_type* frame;
};
@@ -143,14 +179,17 @@
: frame(0) {}
template <int N>
- static typename make_dynamic_member<N, self_type>::type
+ static
+ void//typename make_dynamic_member<N, self_type>::type
init(self_type& scope)
{
- return make_dynamic_member<N, self_type>()(dynamic_member_data<N, self_type>(static_cast<self_type &>(scope)));
+ //return make_dynamic_member<N, self_type>()(dynamic_member_data<N, self_type>(static_cast<self_type &>(scope)));
}
- typedef typename make_dynamic_member<0, self_type>::type member1;
- typedef typename make_dynamic_member<1, self_type>::type member2;
+ //typedef typename make_dynamic_member<0, self_type>::type member1;
+ typedef typename expression::dynamic_member<mpl::int_<0>, self_type>::type member1;
+ //typedef typename make_dynamic_member<1, self_type>::type member2;
+ typedef typename expression::dynamic_member<mpl::int_<1>, self_type>::type member2;
mutable dynamic_frame_type* frame;
};
@@ -166,15 +205,16 @@
: frame(0) {}
template <int N>
- static typename make_dynamic_member<N, self_type>::type
- init(self_type& scope)
+ static
+ typename expression::dynamic_member<mpl::int_<N>, self_type *>::type
+ init(self_type * scope)
{
- return make_dynamic_member<N, self_type>()(dynamic_member_data<N, self_type>(static_cast<self_type &>(scope)));
+ return expression::dynamic_member<mpl::int_<N>, self_type *>::make(mpl::int_<N>(), scope);
}
- typedef typename make_dynamic_member<0, self_type>::type member1;
- typedef typename make_dynamic_member<1, self_type>::type member2;
- typedef typename make_dynamic_member<2, self_type>::type member3;
+ typedef typename expression::dynamic_member<mpl::int_<0>, dynamic *>::type member1;
+ typedef typename expression::dynamic_member<mpl::int_<1>, dynamic *>::type member2;
+ typedef typename expression::dynamic_member<mpl::int_<2>, dynamic *>::type member3;
mutable dynamic_frame_type* frame;
};
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/lambda.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/lambda.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/lambda.hpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -26,8 +26,6 @@
namespace boost { namespace phoenix
{
- //template <typename> struct lambda_actor;
-
PHOENIX_DEFINE_EXPRESSION(
lambda
, (proto::terminal<proto::_>) // OuterEnv
@@ -42,31 +40,43 @@
struct result;
template <typename This, typename Env, typename OuterEnv, typename Locals, typename Lambda>
- struct result<This(Env, OuterEnv, Locals &, Lambda &)>
+ struct result<This(Env, OuterEnv, Locals, Lambda)>
+ : result<This(Env const &, OuterEnv &, Locals &, Lambda &)>
+ {};
+
+ template <typename This, typename Env, typename OuterEnv, typename Locals, typename Lambda>
+ struct result<This(Env, OuterEnv &, Locals &, Lambda &)>
+ : result<This(Env const &, OuterEnv &, Locals &, Lambda &)>
+ {};
+
+ template <typename This, typename Env, typename OuterEnv, typename Locals, typename Lambda>
+ struct result<This(Env &, OuterEnv &, Locals &, Lambda &)>
{
typedef
typename proto::detail::uncvref<
typename boost::result_of<
+ functional::args(Env)
+ >::type
+ >::type
+ args_type;
+ typedef
+ typename proto::detail::uncvref<
+ typename boost::result_of<
functional::actions(Env)
>::type
>::type
actions_type;
+ typedef fusion::vector2<args_type, actions_type> env_type;
typedef typename proto::detail::uncvref<Locals>::type locals_type;
+
typedef typename proto::detail::uncvref<OuterEnv>::type outer_env_type;
- typedef typename proto::detail::uncvref<Env>::type env_type;
- typedef scoped_environment<env_type const, outer_env_type const, locals_type const> scoped_env;
+
+ typedef scoped_environment<env_type, outer_env_type const, locals_type const> scoped_env;
+
typedef fusion::vector2<scoped_env, actions_type&> new_env_type;
- typedef
- typename mpl::eval_if<
- /*proto::matches<
- typename proto::detail::uncvref<Locals>::type
- , proto::terminal<mpl::void_>
- >*/mpl::false_
- , boost::result_of<evaluator(Lambda &, Env)>
- , boost::result_of<evaluator(Lambda &, new_env_type)>
- >::type type;
- //typedef int type;
+
+ typedef typename boost::result_of<evaluator(Lambda const &, new_env_type &)>::type type;
};
template <typename Env, typename OuterEnv, typename Locals, typename Lambda>
@@ -76,45 +86,34 @@
typedef
typename proto::detail::uncvref<
typename boost::result_of<
+ functional::args(Env &)
+ >::type
+ >::type
+ args_type;
+ typedef
+ typename proto::detail::uncvref<
+ typename boost::result_of<
functional::actions(Env &)
>::type
>::type
actions_type;
+ typedef fusion::vector2<args_type, actions_type> env_type;
typedef typename proto::detail::uncvref<Locals>::type locals_type;
typedef typename proto::detail::uncvref<OuterEnv>::type outer_env_type;
- typedef typename proto::detail::uncvref<Env>::type env_type;
- typedef scoped_environment<env_type const, outer_env_type const, locals_type const> scoped_env_type;
+ typedef scoped_environment<env_type, OuterEnv const, locals_type const> scoped_env_type;
- outer_env_type o = outer_env;
- env_type e = env;
- locals_type l = locals;
+ env_type e(functional::args()(env), functional::actions()(env));
scoped_env_type
scoped_env(
e
- , o
- , l
+ , outer_env
+ , locals
);
- std::cout << typeid(env).name() << "\n";
- std::cout << typeid(outer_env).name() << "\n";
- std::cout << typeid(fusion::at_c<0>(env)).name() << "\n";
- std::cout << typeid(fusion::at_c<0>(outer_env)).name() << "\n";
- //std::cout << fusion::at_c<0>(fusion::at_c<0>(env)) << "\n";
- std::cout << "fuuu\n";
- //std::cout << fusion::at_c<0>(fusion::at_c<0>(outer_env)) << "\n";
- //std::cout << fusion::at_c<0>(outer_env) << "\n";
-
fusion::vector2<scoped_env_type, actions_type>
new_env(scoped_env, functional::actions()(env));
-
- //std::cout << eval(lambda, new_env) << "\n";
- /*
- //std::cout << "success!\n";
- return eval(lambda, new_env);
- */
- //std::cout << typeid(Locals).name() << "\n";
return eval(lambda, new_env);
}
};
@@ -177,7 +176,7 @@
: proto::or_<
proto::when<
expression::lambda_actor<meta_grammar>
- , mpl::true_()
+ , mpl::true_()//evaluator(proto::_child_c<0>, _env)
>
, proto::when<
expression::lambda_actor<
@@ -206,7 +205,22 @@
struct result<This(Env, Lambda &)>
{
typedef typename proto::detail::uncvref<Env>::type env_type;
- typedef typename expression::lambda<env_type, mpl::void_, typename proto::detail::uncvref<Lambda>::type>::type const type;
+
+ typedef
+ typename proto::detail::uncvref<
+ typename boost::result_of<functional::args(Env)>::type
+ >::type
+ args_type;
+
+ typedef
+ typename proto::detail::uncvref<
+ typename boost::result_of<functional::actions(Env)>::type
+ >::type
+ actions_type;
+
+ typedef fusion::vector2<args_type, actions_type> outer_env_type;
+
+ typedef typename expression::lambda<outer_env_type, mpl::void_, typename proto::detail::uncvref<Lambda>::type>::type type;
};
template <typename This, typename Env, typename Locals, typename Lambda>
@@ -223,9 +237,23 @@
>::type
locals_type;
typedef typename proto::detail::uncvref<Env>::type env_type;
+
+ typedef
+ typename proto::detail::uncvref<
+ typename boost::result_of<functional::args(Env)>::type
+ >::type
+ args_type;
+
+ typedef
+ typename proto::detail::uncvref<
+ typename boost::result_of<functional::actions(Env)>::type
+ >::type
+ actions_type;
+
+ typedef fusion::vector2<args_type, actions_type> outer_env_type;
typedef
- typename expression::lambda<env_type, locals_type, typename proto::detail::uncvref<Lambda>::type>::type const type;
+ typename expression::lambda<outer_env_type, locals_type, typename proto::detail::uncvref<Lambda>::type>::type const type;
};
template <typename Env, typename Lambda>
@@ -233,10 +261,25 @@
operator()(Env & env, Lambda const& lambda) const
{
typedef typename proto::detail::uncvref<Env>::type env_type;
- //proto::terminal<mpl::void_>::type t = {mpl::void_()};
- //return expression::lambda<env_type, proto::terminal<mpl::void_>::type, Lambda>::make(env, t, lambda);
+
+ typedef
+ typename proto::detail::uncvref<
+ typename boost::result_of<functional::args(Env)>::type
+ >::type
+ args_type;
+
+ typedef
+ typename proto::detail::uncvref<
+ typename boost::result_of<functional::actions(Env)>::type
+ >::type
+ actions_type;
+
+ typedef fusion::vector2<args_type, actions_type> outer_env_type;
+
+ outer_env_type outer_env(fusion::at_c<0>(env), fusion::at_c<1>(env));
+
mpl::void_ t;
- return expression::lambda<env_type, mpl::void_, Lambda>::make(env, t, lambda);
+ return expression::lambda<outer_env_type, mpl::void_, Lambda>::make(outer_env, t, lambda);
}
template <typename Env, typename Locals, typename Lambda>
@@ -260,14 +303,23 @@
, env
);
- typedef typename proto::detail::uncvref<Env>::type env_type;
- static env_type e(env);
+ typedef
+ typename proto::detail::uncvref<
+ typename boost::result_of<functional::args(Env)>::type
+ >::type
+ args_type;
+
+ typedef
+ typename proto::detail::uncvref<
+ typename boost::result_of<functional::actions(Env)>::type
+ >::type
+ actions_type;
- std::cout << "outer env - begin\n";
- std::cout << typeid(env).name() << "\n";
- std::cout << "outer env - end\n";
+ typedef fusion::vector2<args_type, actions_type> outer_env_type;
- return expression::lambda<env_type, locals_type, Lambda>::make(e, l, lambda);
+ outer_env_type outer_env(fusion::at_c<0>(env), fusion::at_c<1>(env));
+
+ return expression::lambda<outer_env_type, locals_type, Lambda>::make(outer_env, l, lambda);
}
};
@@ -276,19 +328,6 @@
: proto::call<lambda_actor_eval(_env, unpack)>
{};
- /*
- template <typename Expr>
- struct lambda_actor
- : actor<Expr>
- {
- typedef actor< Expr > base_type;
-
- lambda_actor(base_type const & base)
- : base_type( base )
- {}
- };
- */
-
template <typename Locals = void, typename Dummy = void>
struct lambda_actor_gen;
@@ -355,211 +394,6 @@
lambda_local_gen const lambda = lambda_local_gen();
-#if 0
- namespace result_of
- {
- template <typename Env, typename Expr, typename OuterEnv, typename Locals, typename Map>
- struct lambda
- {
- typedef scoped_environment<
- Env
- , typename proto::result_of::value<OuterEnv>::type
- , typename proto::result_of::value<Locals>::type
- , Map
- > environment;
-
- typedef typename boost::result_of<eval_grammar(Expr const&, environment&)>::type type;
- };
- }
-
- template <typename Map>
- struct lambda_eval
- {
- template <typename Sig>
- struct result;
-
- template <typename This, typename Env, typename Expr, typename OuterEnv, typename Locals>
- struct result<This(Env&, Expr const&, OuterEnv const&, Locals const&)>
- : result_of::lambda<Env, Expr, OuterEnv, Locals, Map>
- {};
-
- template <typename Env, typename Expr, typename OuterEnv, typename Locals>
- typename result_of::lambda<Env, Expr, OuterEnv, Locals, Map>::type
- operator()(Env& env, Expr const& expr, OuterEnv const& outer_env, Locals const& locals) const
- {
- typedef typename result_of::lambda<Env, Expr, OuterEnv, Locals, Map>::environment environment;
-
- typename remove_const<
- typename remove_reference<
- typename boost::result_of<eval_grammar(OuterEnv const&)>::type
- >::type
- >::type a(eval(outer_env));
-
- environment args(env, a, proto::value(locals));
-
- return eval(expr, args);
- }
- };
-
- template <typename Expr, typename OuterEnv, typename Locals, typename Map>
- struct make_lambda : compose<lambda_eval<Map>, Expr, OuterEnv, Locals> {};
-
- template <typename Vars>
- struct lambda_actor_eval
- {
- template <typename Sig>
- struct result;
-
- template <typename This, typename Env, typename A>
- struct result<This(Env&, A const&)>
- : boost::result_of<typename proto::result_of::value<A>::type(Env&)>
- {};
-
- template <typename Env, typename A>
- typename result<lambda_actor_eval(Env&, A const&)>::type const
- operator()(Env& env, A const& a) const
- {
- return proto::value(a)(env);
- }
- };
-
- template <typename Vars, typename Dummy>
- struct enable_nullary<lambda_actor_eval<Vars>, Dummy>
- : mpl::false_/*mpl::not_< typename mpl::fold<
- Vars
- , mpl::false_
- , detail::compute_no_nullary
- >::type >*/
- {};
-
-
- template <typename Expr, typename Vars, typename Map>
- struct lambda_actor
- {
- lambda_actor() {}
-
- lambda_actor(Expr const& expr, Vars const& vars)
- : expr(expr)
- , vars(vars)
- {}
-
- template <typename Sig>
- struct result;
-
- template <typename This, typename Env>
- struct result<This(Env&)>
- {
- typedef typename
- fusion::result_of::as_vector<
- typename fusion::result_of::transform<
- Vars
- , detail::initialize_local<Env>
- >::type
- >::type
- locals_type;
-
- typedef typename make_lambda<Expr, Env, locals_type, Map>::type type;
- };
-
- template <typename Env>
- typename result<lambda_actor(Env&)>::type const
- operator()(Env& env) const
- {
- typedef typename result<lambda_actor(Env&)>::locals_type locals_type;
-
- return make_lambda<
- Expr, Env, locals_type, Map
- >()(expr, env, fusion::as_vector(fusion::transform(vars, detail::initialize_local<Env>(env))));
- }
-
- Expr expr;
- Vars vars;
- };
-
- template <typename Expr, typename Vars, typename Map>
- struct make_lambda_actor: compose<lambda_actor_eval<Vars>, lambda_actor<Expr, Vars, Map> > {};
-
- template <typename Vars, typename Map>
- struct lambda_actor_gen
- {
-
- template <typename Expr>
- typename make_lambda_actor<Expr, Vars, Map>::type const
- operator[](Expr const& expr) const
- {
- return make_lambda_actor<Expr, Vars, Map>()(lambda_actor<Expr, Vars, Map>(expr, vars));
- }
-
- lambda_actor_gen(Vars const& vars)
- : vars(vars) {}
-
- Vars vars;
- };
-
- struct lambda_gen
- : lambda_actor_gen<
- fusion::vector0<>
- , detail::map_local_index_to_tuple<> >
- {
- typedef lambda_actor_gen<fusion::vector0<>, detail::map_local_index_to_tuple<> > base_type;
-
- lambda_gen()
- : base_type(fusion::vector0<>())
- {}
-
- template <typename A0>
- lambda_actor_gen<
- fusion::vector1<typename proto::result_of::child_c<A0, 1>::type>
- , detail::map_local_index_to_tuple<
- typename proto::result_of::value<
- typename proto::result_of::child_c<
- typename proto::result_of::child_c<A0, 0>::type, 0
- >::type
- >::type::type::key_type
- >
- > const
- operator()( A0 const& a0) const
- {
- return fusion::vector1<typename proto::result_of::child_c<A0, 1>::type>(proto::child_c<1>(a0));
- }
-
- template <typename A0, typename A1>
- lambda_actor_gen<
- fusion::vector2<
- typename proto::result_of::child_c<A0, 1>::type
- , typename proto::result_of::child_c<A1, 1>::type
- >
- , detail::map_local_index_to_tuple<
- typename proto::result_of::value<
- typename proto::result_of::child_c<
- typename proto::result_of::child_c<A0, 0>::type, 0
- >::type
- >::type::type::key_type
- , typename proto::result_of::value<
- typename proto::result_of::child_c<
- typename proto::result_of::child_c<A1, 0>::type, 0
- >::type
- >::type::type::key_type
- >
- > const
- operator()(A0 const& a0, A1 const& a1) const
- {
- return fusion::vector2<
- typename proto::result_of::child_c<A0, 1>::type
- , typename proto::result_of::child_c<A1, 1>::type
- >(
- proto::child_c<1>(a0)
- , proto::child_c<1>(a1)
- );
- }
-
- #define PHOENIX_LOCAL_GEN_NAME lambda_actor_gen
- #include <boost/phoenix/scope/detail/local_gen.hpp>
- #undef PHOENIX_LOCAL_GEN_NAME
- };
-
- lambda_gen const lambda = lambda_gen();
-#endif
}}
#endif
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/let.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/let.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/let.hpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -47,7 +47,7 @@
struct result;
template <typename This, typename Env, typename Locals, typename Let>
- struct result<This(Env, Locals const &, Let const&)>
+ struct result<This(Env, Locals &, Let &)>
{
typedef
typename proto::detail::uncvref<
@@ -72,8 +72,7 @@
typename boost::result_of<
evaluator(
Let const &
- , fusion::vector2<scoped_environment<Env, Env, locals_type&> &, actions_type> &
- //, fusion::vector2<scoped_environment<Env, Env, locals_type&> &, let_actions>&//actions_type> &
+ , fusion::vector2<scoped_environment<Env, Env, locals_type> &, actions_type> &
)
>::type
type;
@@ -116,14 +115,8 @@
);
fusion::vector2<scoped_environment<Env, Env, locals_type &> &, actions_type>
- //fusion::vector2<scoped_environment<Env, Env, locals_type &> &, let_actions>
new_env(scoped_env, functional::actions()(env));
- //new_env(scoped_env, let_actions());//functional::actions()(env));
- std::cout << ":(\n";
- //std::cout << typeid(Let).name() << "\n";
-
- //return let_evaluator()(let, new_env);
return eval(let, new_env);
}
};
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -36,79 +36,10 @@
template <typename Key, typename _ = proto::is_proto_expr>
struct local_variable
{
- /*
- typedef
- typename proto::result_of::make_expr<
- tag::local_variable
- , default_domain_with_basic_expr
- , Key
- >::type
- base_type;
-
- typedef scope_actor<base_type> type;
-
- typedef
- typename proto::nary_expr<tag::local_variable, Key>::proto_grammar
- proto_grammar;
- */
-
typedef expr<tag::local_variable, Key> expr_type;
typedef typename expr_type::type type;
typedef typename expr_type::proto_grammar proto_grammar;
- //BOOST_PROTO_BASIC_EXTENDS(typename expr_type::type, local_variable, phoenix_domain)
- };
- /* : proto::transform<local_variable<Key>, int>
- {
- typedef detail::local_expr<tag::local_variable, detail::local<Key> > type;
- typedef detail::local_expr<tag::local_variable, detail::local<Key> > proto_grammar;
-
- template <typename Expr, typename State, typename Data>
- struct impl : proto::transform_impl<Expr, State, Data>
- {
- typedef Expr result_type;
-
- result_type
- operator ()(
- typename impl::expr_param e
- , typename impl::state_param
- , typename impl::data_param
- ) const
- {
- return e;
- }
- };
-
- /// INTERNAL ONLY
- typedef tag::local_variable proto_tag;
- /// INTERNAL ONLY
- typedef detail::local<Key> proto_child0;
-
- };
- */
- /*
- : proto::terminal< ::boost::phoenix::local_variable<Key> >
- {
- typedef
- actor<
- typename proto::terminal<
- ::boost::phoenix::local_variable<Key>
- >::type
- >
- type;
-
- static
- actor<
- typename proto::terminal<
- ::boost::phoenix::local_variable<Key>
- >::type
- >
- make()
- {
- actor<type> e = {{local_variable<Key>()}};
- return e;
- }
};
- */
}
namespace rule
@@ -136,6 +67,11 @@
template <typename This, typename Expr, typename Env>
struct result<This(Expr&, Env)>
+ : result<This(Expr&, Env const&)>
+ {};
+
+ template <typename This, typename Expr, typename Env>
+ struct result<This(Expr&, Env &)>
{
typedef
typename boost::result_of<
@@ -152,8 +88,8 @@
};
template <typename Expr, typename Env>
- typename result<local_eval(Expr&, Env&)>::type
- operator()(Expr& expr, Env & env) const
+ typename result<local_eval(Expr const&, Env&)>::type
+ operator()(Expr const& expr, Env & env) const
{
typedef typename result<local_eval(Expr const&, Env&)>::result_type result_type;
@@ -219,6 +155,7 @@
, local_eval(proto::_right, proto::_state)
)
>
+ , proto::terminal<mpl::void_>
>
{};
}
@@ -387,9 +324,14 @@
{
template <typename Sig>
struct result;
-
+
template <typename This, typename Env>
struct result<This(Env)>
+ : result<This(Env const &)>
+ {};
+
+ template <typename This, typename Env>
+ struct result<This(Env &)>
{
typedef
typename proto::detail::uncvref<
@@ -480,16 +422,6 @@
};
- /*
- template<typename T>
- struct is_custom_terminal<local_variable<T> >
- : mpl::true_
- {};
-
- template<typename T>
- struct custom_terminal<local_variable<T> >
- : proto::callable
- */
struct local_var_eval
: proto::callable
{
@@ -509,15 +441,12 @@
};
template <typename Local, typename Env>
- //typename result<custom_terminal(Local const &, Env&)>::type
typename result<local_var_eval(Local const &, Env&)>::type
operator()(Local & local, Env & env)
{
typedef
typename expression::local_variable<Local>::type
lookup_grammar;
- std::cout << "muuh ...\n";
- std::cout << typeid(lookup_grammar).name() << "\n";
return get_local<lookup_grammar>()(env);
}
};
@@ -526,20 +455,6 @@
struct default_actions::when<rule::local_variable, Dummy>
: proto::call<local_var_eval(proto::_value(proto::_child_c<0>), _env)>
{};
-
-#if 0
- struct foo
- : proto::callable
- {
- template <typename Sig>
- struct result;
-
- template <typename This, typename Env>
- struct result<This(Env)>
- : is_scoped_environment<Env>
- {};
- };
-#endif
namespace local_names
{
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/scoped_environment.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/scoped_environment.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/scoped_environment.hpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -26,11 +26,11 @@
, fusion::random_access_traversal_tag
>
{
- typedef Env env_type;
- typedef OuterEnv outer_env_type;
- typedef Locals locals_type;
+ typedef typename boost::remove_reference<Env>::type env_type;
+ typedef typename boost::remove_reference<OuterEnv>::type outer_env_type;
+ typedef typename boost::remove_reference<Locals>::type locals_type;
- scoped_environment(Env& env, OuterEnv& outer_env, Locals & locals)
+ scoped_environment(env_type& env, outer_env_type& outer_env, locals_type & locals)
: env(env)
, outer_env(outer_env)
, locals(locals)
@@ -42,9 +42,9 @@
, locals(o.locals)
{}
- Env &env;
- OuterEnv &outer_env;
- Locals &locals;
+ env_type &env;
+ outer_env_type &outer_env;
+ locals_type &locals;
#define PHOENIX_ADAPT_SCOPED_ENVIRONMENT(INTRINSIC) \
template <typename Seq> \
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/stl/algorithm/iteration.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/stl/algorithm/iteration.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/stl/algorithm/iteration.hpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -29,6 +29,11 @@
template<typename This, class R, class F>
struct result<This(R&, F)>
+ : result<This(R&, F const &)>
+ {};
+
+ template<typename This, class R, class F>
+ struct result<This(R&, F &)>
{
typedef F type;
};
@@ -47,12 +52,22 @@
template<typename This, class R, class I>
struct result<This(R&, I)>
+ : result<This(R&, I const &)>
+ {};
+
+ template<typename This, class R, class I>
+ struct result<This(R&, I &)>
{
typedef I type;
};
-
+
template<typename This, class R, class I, class C>
struct result<This(R&, I, C)>
+ : result<This(R&, I const &, C)>
+ {};
+
+ template<typename This, class R, class I, class C>
+ struct result<This(R&, I &, C)>
{
typedef I type;
};
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/stl/algorithm/transformation.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/stl/algorithm/transformation.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/stl/algorithm/transformation.hpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -73,12 +73,23 @@
template<typename This, class R, class I>
struct result<This(R&, I)>
+ : result<This(R&, I const &)>
+ {};
+
+ template<typename This, class R, class I>
+ struct result<This(R&, I &)>
{
- typedef typename remove_reference<I>::type type;
+ typedef I type;
};
template<class R, class I>
- typename remove_reference<I>::type operator()(R& r, I i) const
+ I operator()(R& r, I & i) const
+ {
+ return std::copy_backward(detail::begin_(r), detail::end_(r), i);
+ }
+
+ template<class R, class I>
+ I const operator()(R& r, I const & i) const
{
return std::copy_backward(detail::begin_(r), detail::end_(r), i);
}
@@ -779,12 +790,22 @@
template <typename This, typename R, typename I, typename T>
struct result<This(R&, I, T)>
+ : result<This(R&, I const &, T)>
+ {};
+
+ template <typename This, typename R, typename I, typename T>
+ struct result<This(R&, I, T &)>
{
typedef T type;
};
template <typename This, typename R, typename I, typename T, typename C1, typename C2>
struct result<This(R&, I, T, C1, C2)>
+ : result<This(R&, I, T const &, C1, C2)>
+ {};
+
+ template <typename This, typename R, typename I, typename T, typename C1, typename C2>
+ struct result<This(R&, I, T &, C1, C2)>
{
typedef T type;
};
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/Jamfile
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/Jamfile (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/Jamfile 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -73,10 +73,10 @@
;
test-suite phoenix_scope :
-# [ run scope/lambda_tests.cpp ]
-# [ run scope/let_tests.cpp ]
-# [ run scope/dynamic_tests.cpp ]
-# [ run scope/bug_000008.cpp : : : $(multi-threading) ]
+ [ run scope/lambda_tests.cpp ]
+ [ run scope/let_tests.cpp ]
+ [ run scope/dynamic_tests.cpp ]
+ [ run scope/bug_000008.cpp : : : $(multi-threading) ]
;
test-suite phoenix_algorithm :
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/algorithm/transformation1.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/algorithm/transformation1.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/algorithm/transformation1.cpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -379,6 +379,7 @@
int main()
{
+ swap_test();
copy_test();
copy_backward_test();
transform_test();
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/algorithm/transformation2.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/algorithm/transformation2.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/algorithm/transformation2.cpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -169,9 +169,10 @@
BOOST_TEST(array2[0] == 1);
BOOST_TEST(array2[1] == 2);
- boost::phoenix::partial_sort(arg1, arg2, std::greater<int>())(array, array2);
+ boost::phoenix::partial_sort_copy(arg1, arg2, std::greater<int>())(array, array2);
BOOST_TEST(array2[0] == 4);
BOOST_TEST(array2[1] == 3);
+
return;
}
}
@@ -186,5 +187,6 @@
sort_test();
stable_sort_test();
partial_sort_test();
+ partial_sort_copy_test();
return boost::report_errors();
}
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/dynamic_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/dynamic_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/dynamic_tests.cpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -14,23 +14,25 @@
#include <boost/phoenix/operator.hpp>
#include <boost/phoenix/scope/dynamic.hpp>
+/*
struct my_dynamic : ::boost::phoenix::dynamic<int, std::string, double>
{
- my_dynamic() : num(init<0>(*this)), message(init<1>(*this)), real(init<2>(*this)) {}
+ my_dynamic() : num(init<0>(this)), message(init<1>(this)), real(init<2>(this)) {}
member1 num;
member2 message;
member3 real;
};
+*/
// You may also use the macro below to achieve the same as above:
//
-// PHOENIX_DYNAMIC(
-// my_dynamic,
-// (int, num)
-// (std::string, message)
-// (double, real)
-// );
+BOOST_PHOENIX_DYNAMIC(
+ my_dynamic,
+ (int, num)
+ (std::string, message)
+ (double, real)
+);
int
main()
@@ -66,7 +68,7 @@
(std::cout << clos.message << clos.num << ", " << clos.real << '\n')();
BOOST_TEST(clos.num() == 987);
BOOST_TEST(clos.real() == clos.num() * 1e30);
- BOOST_TEST(clos.message() == "Abracadabra ");
+ BOOST_TEST(clos.message() == "Abracadabra ");
}
(std::cout << clos.message << clos.num << ", " << clos.real << '\n')();
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/lambda_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/lambda_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/lambda_tests.cpp 2010-12-23 06:50:31 EST (Thu, 23 Dec 2010)
@@ -79,22 +79,6 @@
{
int x = 1;
- long x2 = 2;
- short x3 = 3;
- char const* y = "hello";
- zzz z;
-
- //BOOST_TEST(lambda[_1](x)(y) == y);
- //BOOST_TEST(lambda(_a = _1)[_a](x)(y) == x);
- lambda(_a = _1)[lambda[_a]](x)(y)(z);
- //BOOST_TEST(lambda(_a = _1)[lambda[_a]](x)(y)(z) == x);
- //BOOST_TEST(lambda(_a = _1)[lambda[_a + _1]](x)(y)(x) == 2);
- //BOOST_TEST(lambda(_a = _1)[lambda(_b = _1)[_a + _b + _1]](x)(x2)(x3) == 6);
- }
-
-#if 0
- {
- int x = 1;
int y = lambda[_1]()(x);
BOOST_TEST(x == y);
}
@@ -137,9 +121,9 @@
BOOST_TEST(lambda[_1](x)(y) == y);
BOOST_TEST(lambda(_a = _1)[_a](x)(y) == x);
- //BOOST_TEST(lambda(_a = _1)[lambda[_a]](x)(y)(z) == x);
- //BOOST_TEST(lambda(_a = _1)[lambda[_a + _1]](x)(y)(x) == 2);
- //BOOST_TEST(lambda(_a = _1)[lambda(_b = _1)[_a + _b + _1]](x)(x2)(x3) == 6);
+ BOOST_TEST(lambda(_a = _1)[lambda[_a]](x)(y)(z) == x);
+ BOOST_TEST(lambda(_a = _1)[lambda[_a + _1]](x)(y)(x) == 2);
+ BOOST_TEST(lambda(_a = _1)[lambda(_b = _1)[_a + _b + _1]](x)(x2)(x3) == 6);
}
{
@@ -149,7 +133,6 @@
);
}
- /*
{
int x = 1, y = 10;
BOOST_TEST(
@@ -157,23 +140,12 @@
_1 +
lambda(_a = _1)
[
- //_a + lambda[_a + 2]
_a + lambda[_a + 2]
]
)
(x)(y)(y) == 1+1+1+2
);
- std::cout << (
- _1 +
- lambda(_a = _1)
- [
- //_a + lambda[_a + 2]
- _1 + lambda(_b = _1)[_a + 2]
- ]
- )
- (x)(y)(y) << "\n";
}
- */
{
using boost::phoenix::for_each;
@@ -213,7 +185,7 @@
}
{
- int x = (let(_a = lambda[val(1)])[_a])()();
+ int x = (let(_a = lambda[val(1)])[_a])();
BOOST_TEST(x == 1);
}
@@ -223,7 +195,6 @@
BOOST_TEST(lambda[let(_a = _1)[_a = _2]]()(i, j) == j);
BOOST_TEST(i == j);
}
-#endif
return boost::report_errors();
}
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