Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2007-11-09 16:43:58


Author: eric_niebler
Date: 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
New Revision: 40973
URL: http://svn.boost.org/trac/boost/changeset/40973

Log:
lots of progress
Added:
   branches/proto/v3/boost/xpressive/proto3/debug.hpp (contents, props changed)
   branches/proto/v3/boost/xpressive/proto3/detail/
   branches/proto/v3/boost/xpressive/proto3/detail/dont_care.hpp (contents, props changed)
Text files modified:
   branches/proto/v3/boost/xpressive/proto3/args.hpp | 86 +++++++++++++++++++--
   branches/proto/v3/boost/xpressive/proto3/context/callable.hpp | 6 -
   branches/proto/v3/boost/xpressive/proto3/context/null.hpp | 153 ++++++++++++++++++---------------------
   branches/proto/v3/boost/xpressive/proto3/expr.hpp | 18 +++-
   branches/proto/v3/boost/xpressive/proto3/extends.hpp | 18 ++--
   branches/proto/v3/boost/xpressive/proto3/generate.hpp | 80 +++++++++++++-------
   branches/proto/v3/boost/xpressive/proto3/operators.hpp | 6
   branches/proto/v3/boost/xpressive/proto3/proto.hpp | 1
   branches/proto/v3/boost/xpressive/proto3/proto_fwd.hpp | 9 -
   branches/proto/v3/boost/xpressive/proto3/traits.hpp | 7 -
   branches/proto/v3/libs/xpressive/proto3/example/calc1.cpp | 4
   branches/proto/v3/libs/xpressive/proto3/example/calc2.cpp | 4
   branches/proto/v3/libs/xpressive/proto3/example/calc3.cpp | 97 +++---------------------
   branches/proto/v3/libs/xpressive/proto3/example/hello.cpp | 4
   branches/proto/v3/libs/xpressive/proto3/example/lazy_vector.cpp | 8 +-
   branches/proto/v3/libs/xpressive/proto3/example/mixed.cpp | 78 ++++++++++++-------
   branches/proto/v3/libs/xpressive/proto3/example/rgb.cpp | 8 +-
   branches/proto/v3/libs/xpressive/proto3/example/tarray.cpp | 4
   branches/proto/v3/libs/xpressive/proto3/example/vec3.cpp | 14 +-
   branches/proto/v3/libs/xpressive/proto3/example/vector.cpp | 6
   branches/proto/v3/libs/xpressive/proto3/test/lambda.cpp | 4
   branches/proto/v3/libs/xpressive/proto3/test/main.cpp | 48 ++++++++++--
   branches/proto/v3/libs/xpressive/proto3/test/toy_spirit.cpp | 2
   23 files changed, 360 insertions(+), 305 deletions(-)

Modified: branches/proto/v3/boost/xpressive/proto3/args.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/args.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/args.hpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -10,8 +10,19 @@
 #define BOOST_PROTO3_ARGS_HPP_EAN_10_28_2007
 
 #include <utility>
+#include <boost/type_traits.hpp>
+#include <boost/utility/result_of.hpp>
 #include <boost/xpressive/proto3/proto_fwd.hpp>
 
+#define UNCV(X) \
+ typename remove_cv<X>::type
+
+#define UNREF(X) \
+ typename remove_reference<X>::type
+
+#define UNCVREF(X) \
+ UNCV(UNREF(X))
+
 namespace boost { namespace proto
 {
 
@@ -83,22 +94,75 @@
         template<typename Head>
         cons<> const cons<Head>::cdr = {};
 
- template<typename Head, typename... Tail>
- inline cons<Head, Tail...> make_cons(Head &&head, Tail &&... tail)
+ struct make_cons_fun
         {
- cons<Head, Tail...> that = {head, make_cons(std::forward<Tail>(tail)...)};
- return that;
- }
+ template<typename Sig>
+ struct result;
 
- template<typename Head>
- inline cons<Head> make_cons(Head &&head)
- {
- cons<Head> that = {head};
- return that;
- }
+ template<typename This, typename... Args>
+ struct result<This(Args...)>
+ {
+ typedef cons<UNCV(Args)...> type;
+ };
+
+ template<typename Head, typename... Tail>
+ cons<UNCV(Head), UNCV(Tail)...> operator()(Head &&head, Tail &&... tail) const
+ {
+ cons<UNCV(Head), UNCV(Tail)...> that = {head, (*this)(std::forward<Tail>(tail)...)};
+ return that;
+ }
+
+ template<typename Head>
+ cons<UNCV(Head)> operator()(Head &&head) const
+ {
+ cons<UNCV(Head)> that = {head};
+ return that;
+ }
+ };
+
+ make_cons_fun const make_cons = {};
+
+ struct fanout_args_fun
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Fun, typename... Args>
+ struct result<This(Fun, cons<Args...>)>
+ : boost::result_of<UNCVREF(Fun)(UNCVREF(Args)...)>
+ {};
+
+ template<typename Fun, typename... Args>
+ typename boost::result_of<Fun(Args...)>::type
+ operator()(Fun const &fun, cons<Args...> const &cons) const
+ {
+ typedef typename boost::result_of<Fun(Args...)>::type type;
+ return this->call_<type>(fun, cons.cdr, cons.car);
+ }
+
+ private:
+
+ template<typename Ret, typename Fun, typename... Tail, typename... Head>
+ static Ret call_(Fun const &fun, cons<Tail...> const &cons, Head const &...head)
+ {
+ call_<Ret>(fun, cons.cdr, head..., cons.car);
+ }
+
+ template<typename Ret, typename Fun, typename... Head>
+ static Ret call_(Fun const &fun, cons<> const &, Head const &... head)
+ {
+ return fun(head...);
+ }
+ };
+
+ fanout_args_fun const fanout_args = {};
 
     }
 
 }}
 
+#undef UNCV
+#undef UNREF
+#undef UNCVREF
+
 #endif

Modified: branches/proto/v3/boost/xpressive/proto3/context/callable.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/context/callable.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/context/callable.hpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -20,6 +20,7 @@
 #include <boost/type_traits.hpp>
 #include <boost/xpressive/proto3/proto_fwd.hpp>
 #include <boost/xpressive/proto3/traits.hpp> // for arg_c
+#include <boost/xpressive/proto3/detail/dont_care.hpp>
 
 namespace boost { namespace proto
 {
@@ -28,11 +29,6 @@
         typedef char yes_type;
         typedef char (&no_type)[2];
 
- struct dont_care
- {
- dont_care(...);
- };
-
         struct private_type_
         {
             private_type_ const &operator,(int) const;

Modified: branches/proto/v3/boost/xpressive/proto3/context/null.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/context/null.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/context/null.hpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -1,83 +1,70 @@
-//#ifndef BOOST_PP_IS_ITERATING
-// ///////////////////////////////////////////////////////////////////////////////
-// /// \file null.hpp
-// /// Definintion of null_context\<\>, an evaluation context for
-// /// proto::eval() that simply evaluates each child expression, doesn't
-// /// combine the results at all, and returns void.
-// //
-// // Copyright 2007 Eric Niebler. Distributed under the Boost
-// // Software License, Version 1.0. (See accompanying file
-// // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-// #ifndef BOOST_PROTO_CONTEXT_NULL_HPP_EAN_06_24_2007
-// #define BOOST_PROTO_CONTEXT_NULL_HPP_EAN_06_24_2007
-//
-// #include <boost/xpressive/proto/detail/prefix.hpp> // must be first include
-// #include <boost/preprocessor/iteration/iterate.hpp>
-// #include <boost/preprocessor/repetition/repeat.hpp>
-// #include <boost/xpressive/proto/proto_fwd.hpp>
-// #include <boost/xpressive/proto/eval.hpp>
-// #include <boost/xpressive/proto/traits.hpp>
-// #include <boost/xpressive/proto/detail/suffix.hpp> // must be last include
-//
-// namespace boost { namespace proto { namespace context
-// {
-//
-// template<typename Expr, typename Context, long Arity>
-// struct null_eval
-// {};
-//
-// template<typename Expr, typename Context>
-// struct null_eval<Expr, Context, 0>
-// {
-// typedef void result_type;
-// void operator()(Expr &, Context &) const
-// {}
-// };
-//
-// #define BOOST_PROTO_EVAL_N(Z, N, DATA) \
-// proto::eval(proto::arg_c<N>(expr), ctx); \
-// /**/
-//
-// #define BOOST_PP_ITERATION_PARAMS_1 \
-// (3, (1, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/context/null.hpp>)) \
-// /**/
-//
-// #include BOOST_PP_ITERATE()
-//
-// #undef BOOST_PROTO_EVAL_N
-//
-// /// null_context
-// ///
-// struct null_context
-// {
-// /// null_context::eval
-// ///
-// template<typename Expr, typename ThisContext = null_context const>
-// struct eval
-// : null_eval<Expr, ThisContext>
-// {};
-// };
-//
-// }}}
-//
-// #endif
-//
-//#else
-//
-// #define N BOOST_PP_ITERATION()
-//
-// template<typename Expr, typename Context>
-// struct null_eval<Expr, Context, N>
-// {
-// typedef void result_type;
-//
-// void operator ()(Expr &expr, Context &ctx) const
-// {
-// BOOST_PP_REPEAT(N, BOOST_PROTO_EVAL_N, ~)
-// }
-// };
-//
-// #undef N
-//
-//#endif
+///////////////////////////////////////////////////////////////////////////////
+/// \file null.hpp
+/// Definintion of null_context\<\>, an evaluation context for
+/// proto::eval() that simply evaluates each child expression, doesn't
+/// combine the results at all, and returns void.
+//
+// Copyright 2007 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO3_CONTEXT_NULL_HPP_EAN_06_24_2007
+#define BOOST_PROTO3_CONTEXT_NULL_HPP_EAN_06_24_2007
+
+#include <boost/xpressive/proto3/proto_fwd.hpp>
+#include <boost/xpressive/proto3/eval.hpp>
+#include <boost/xpressive/proto3/args.hpp>
+
+namespace boost { namespace proto
+{
+ namespace context
+ {
+
+ /// null_eval
+ ///
+ template<typename Expr, typename Context, long Arity>
+ struct null_eval
+ {
+ typedef void result_type;
+ void operator()(Expr &expr, Context &ctx) const
+ {
+ this->call_(expr.proto_base().proto_args_, ctx);
+ }
+
+ private:
+ static void call_(argsns_::cons<> const &, Context &)
+ {}
+
+ template<typename... Args>
+ static void call_(argsns_::cons<Args...> const &args, Context &ctx)
+ {
+ proto::eval(args.car, ctx);
+ call_(args.cdr, ctx);
+ }
+ };
+
+ template<typename Expr, typename Context>
+ struct null_eval<Expr, Context, 0>
+ {
+ typedef void result_type;
+ void operator()(Expr &, Context &) const
+ {}
+ };
+
+ /// null_context
+ ///
+ struct null_context
+ {
+ /// null_context::eval
+ ///
+ template<typename Expr, typename ThisContext = null_context const>
+ struct eval
+ : null_eval<Expr, ThisContext>
+ {};
+ };
+
+ }
+
+}}
+
+#endif

Added: branches/proto/v3/boost/xpressive/proto3/debug.hpp
==============================================================================
--- (empty file)
+++ branches/proto/v3/boost/xpressive/proto3/debug.hpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -0,0 +1,184 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file debug.hpp
+/// Utilities for debugging proto expression trees
+//
+// Copyright 2007 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO3_DEBUG_HPP_EAN_12_31_2006
+#define BOOST_PROTO3_DEBUG_HPP_EAN_12_31_2006
+
+#if !defined(__WAVE__) || !defined(BOOST_PROTO_DOXYGEN_INVOKED)
+#include <iomanip>
+#include <iostream>
+#include <typeinfo>
+#include <boost/xpressive/proto3/proto_fwd.hpp>
+#include <boost/xpressive/proto3/expr.hpp>
+#include <boost/xpressive/proto3/traits.hpp>
+#include <boost/xpressive/proto3/detail/dont_care.hpp>
+#else
+/// INTERNAL ONLY
+/// Needed to work around doxygen bug
+struct a_dummy_global;
+#endif
+
+namespace boost { namespace proto
+{
+ namespace tag
+ {
+ namespace hidden_detail_
+ {
+ typedef char (&not_ostream)[sizeof(std::ostream)+1];
+ not_ostream operator<<(std::ostream &, proto::detail::dont_care);
+
+ template<typename Tag, std::size_t S>
+ struct printable_tag_
+ {
+ typedef char const *type;
+ static type call() { return typeid(Tag).name(); }
+ };
+
+ template<typename Tag>
+ struct printable_tag_<Tag, sizeof(std::ostream)>
+ {
+ typedef Tag type;
+ static type call() { return Tag(); }
+ };
+
+ template<typename Tag>
+ struct printable_tag
+ : printable_tag_<Tag, sizeof(std::cout << Tag())>
+ {};
+ }
+
+ template<typename Tag>
+ inline typename hidden_detail_::printable_tag<Tag>::type proto_tag_name(Tag)
+ {
+ return hidden_detail_::printable_tag<Tag>::call();
+ }
+
+ #define BOOST_PROTO_DEFINE_TAG_NAME(Tag)\
+ inline char const *proto_tag_name(tag::Tag)\
+ {\
+ return #Tag;\
+ }\
+ /**/
+
+ BOOST_PROTO_DEFINE_TAG_NAME(posit)
+ BOOST_PROTO_DEFINE_TAG_NAME(negate)
+ BOOST_PROTO_DEFINE_TAG_NAME(dereference)
+ BOOST_PROTO_DEFINE_TAG_NAME(complement)
+ BOOST_PROTO_DEFINE_TAG_NAME(address_of)
+ BOOST_PROTO_DEFINE_TAG_NAME(logical_not)
+ BOOST_PROTO_DEFINE_TAG_NAME(pre_inc)
+ BOOST_PROTO_DEFINE_TAG_NAME(pre_dec)
+ BOOST_PROTO_DEFINE_TAG_NAME(post_inc)
+ BOOST_PROTO_DEFINE_TAG_NAME(post_dec)
+ BOOST_PROTO_DEFINE_TAG_NAME(shift_left)
+ BOOST_PROTO_DEFINE_TAG_NAME(shift_right)
+ BOOST_PROTO_DEFINE_TAG_NAME(multiplies)
+ BOOST_PROTO_DEFINE_TAG_NAME(divides)
+ BOOST_PROTO_DEFINE_TAG_NAME(modulus)
+ BOOST_PROTO_DEFINE_TAG_NAME(plus)
+ BOOST_PROTO_DEFINE_TAG_NAME(minus)
+ BOOST_PROTO_DEFINE_TAG_NAME(less)
+ BOOST_PROTO_DEFINE_TAG_NAME(greater)
+ BOOST_PROTO_DEFINE_TAG_NAME(less_equal)
+ BOOST_PROTO_DEFINE_TAG_NAME(greater_equal)
+ BOOST_PROTO_DEFINE_TAG_NAME(equal_to)
+ BOOST_PROTO_DEFINE_TAG_NAME(not_equal_to)
+ BOOST_PROTO_DEFINE_TAG_NAME(logical_or)
+ BOOST_PROTO_DEFINE_TAG_NAME(logical_and)
+ BOOST_PROTO_DEFINE_TAG_NAME(bitwise_and)
+ BOOST_PROTO_DEFINE_TAG_NAME(bitwise_or)
+ BOOST_PROTO_DEFINE_TAG_NAME(bitwise_xor)
+ BOOST_PROTO_DEFINE_TAG_NAME(comma)
+ BOOST_PROTO_DEFINE_TAG_NAME(mem_ptr)
+ BOOST_PROTO_DEFINE_TAG_NAME(assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(shift_left_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(shift_right_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(multiplies_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(divides_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(modulus_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(plus_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(minus_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(bitwise_and_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(bitwise_or_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(bitwise_xor_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(subscript)
+ BOOST_PROTO_DEFINE_TAG_NAME(if_else_)
+ BOOST_PROTO_DEFINE_TAG_NAME(function)
+
+ #undef BOOST_PROTO_DEFINE_TAG_NAME
+ }
+
+ namespace functional
+ {
+ // Display a proto expression tree
+ struct display_expr
+ {
+ display_expr(int depth = 0, std::ostream &sout = std::cout)
+ : depth_(depth)
+ , first_(true)
+ , sout_(sout)
+ {}
+
+ template<typename Args>
+ void operator()(expr<tag::terminal, Args> const &expr) const
+ {
+ this->sout_ << std::setw(this->depth_) << (this->first_? "" : ", ")
+ << "terminal(" << proto::arg(expr) << ")\n";
+ this->first_ = false;
+ }
+
+ template<typename Tag, typename... Args>
+ void operator()(expr<Tag, args<Args...> > const &expr) const
+ {
+ using namespace tag;
+ this->sout_ << std::setw(this->depth_) << (this->first_? "" : ", ")
+ << proto_tag_name(Tag()) << "(\n";
+ display_expr display(this->depth_ + 4, this->sout_);
+ this->call_(display, expr.proto_args_);
+ this->sout_ << std::setw(this->depth_) << "" << ")\n";
+ this->first_ = false;
+ }
+
+ template<typename T>
+ void operator()(T const &t) const
+ {
+ (*this)(t.proto_base());
+ }
+
+ private:
+ static void call_(display_expr &, argsns_::cons<> const &)
+ {}
+
+ template<typename... Args>
+ static void call_(display_expr &display, argsns_::cons<Args...> const &args)
+ {
+ display(args.car);
+ call_(display, args.cdr);
+ }
+
+ int depth_;
+ mutable bool first_;
+ std::ostream &sout_;
+ };
+ }
+
+ template<typename Expr>
+ void display_expr(Expr const &expr)
+ {
+ functional::display_expr()(expr);
+ }
+
+ template<typename Expr>
+ void display_expr(Expr const &expr, std::ostream &sout)
+ {
+ functional::display_expr(0, sout)(expr);
+ }
+
+}}
+
+#endif

Added: branches/proto/v3/boost/xpressive/proto3/detail/dont_care.hpp
==============================================================================
--- (empty file)
+++ branches/proto/v3/boost/xpressive/proto3/detail/dont_care.hpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file dont_care.hpp
+/// Definintion of dont_care, a dummy parameter
+//
+// Copyright 2007 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO3_DETAIL_DONT_CARE_HPP_EAN_11_07_2007
+#define BOOST_PROTO3_DETAIL_DONT_CARE_HPP_EAN_11_07_2007
+
+namespace boost { namespace proto
+{
+ namespace detail
+ {
+ struct dont_care
+ {
+ dont_care(...);
+ };
+ }
+}}
+
+#endif

Modified: branches/proto/v3/boost/xpressive/proto3/expr.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/expr.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/expr.hpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -66,7 +66,8 @@
             {
                 expr<tag::assign, args<expr &, typename result_of::as_arg<A>::type> > that =
                     //{{*this, {proto::as_arg(std::forward<A>(a))}}};
- {{*this, {a}}};
+ {{*this, {result_of::as_arg<A>::call(a)}}};
+ //{{*this, {a}}};
                 return that;
             }
 
@@ -76,7 +77,8 @@
             {
                 expr<tag::assign, args<expr const &, typename result_of::as_arg<A>::type> > that =
                     //{{*this, {proto::as_arg(std::forward<A>(a))}}};
- {{*this, {a}}};
+ {{*this, {result_of::as_arg<A>::call(a)}}};
+ //{{*this, {a}}};
                 return that;
             }
 
@@ -86,7 +88,8 @@
             {
                 expr<tag::subscript, args<expr &, typename result_of::as_arg<A>::type> > that =
                     //{{*this, {proto::as_arg(std::forward<A>(a))}}};
- {{*this, {a}}};
+ {{*this, {result_of::as_arg<A>::call(a)}}};
+ //{{*this, {a}}};
                 return that;
             }
 
@@ -96,7 +99,8 @@
             {
                 expr<tag::subscript, args<expr const &, typename result_of::as_arg<A>::type> > that =
                     //{{*this, {proto::as_arg(std::forward<A>(a))}}};
- {{*this, {a}}};
+ {{*this, {result_of::as_arg<A>::call(a)}}};
+ //{{*this, {a}}};
                 return that;
             }
 
@@ -105,8 +109,9 @@
             operator()(A &&... a)
             {
                 expr<tag::function, args<expr &, typename result_of::as_arg<A>::type...> > that =
- {{*this, a...}};
                     //{argsns_::make_cons(*this, proto::as_arg(std::forward<A>(a))...)};
+ {argsns_::make_cons(*this, result_of::as_arg<A>::call(a)...)};
+ //{{*this, a...}};
                 return that;
             }
 
@@ -115,8 +120,9 @@
             operator()(A &&... a) const
             {
                 expr<tag::function, args<expr const &, typename result_of::as_arg<A>::type...> > that =
- {{*this, a...}};
                     //{argsns_::make_cons(*this, proto::as_arg(std::forward<A>(a))...)};
+ {argsns_::make_cons(*this, result_of::as_arg<A>::call(a)...)};
+ //{{*this, a...}};
                 return that;
             }
         };

Modified: branches/proto/v3/boost/xpressive/proto3/extends.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/extends.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/extends.hpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -72,11 +72,11 @@
         ///
     #define BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(Expr, Derived, Domain, Const)\
         template<typename A>\
- typename boost::mpl::apply_wrap1<Domain, boost::proto::expr<boost::proto::tag::assign, boost::proto::args<Derived BOOST_PROTO_CONST ## Const &, typename boost::proto::result_of::as_arg<A>::type> > >::type\
+ typename boost::mpl::apply_wrap1<Domain, boost::proto::expr<boost::proto::tag::assign, boost::proto::args<Derived BOOST_PROTO_CONST ## Const &, typename boost::proto::result_of::as_arg<A, Domain>::type> > >::type\
         operator =(A &&a) BOOST_PROTO_CONST ## Const\
         {\
- typedef boost::proto::expr<boost::proto::tag::assign, boost::proto::args<Derived BOOST_PROTO_CONST ## Const &, typename boost::proto::result_of::as_arg<A>::type> > that_type;\
- that_type that = {{*static_cast<Derived BOOST_PROTO_CONST ## Const *>(this), {boost::proto::result_of::as_arg<A>::call(a)}}};\
+ typedef boost::proto::expr<boost::proto::tag::assign, boost::proto::args<Derived BOOST_PROTO_CONST ## Const &, typename boost::proto::result_of::as_arg<A, Domain>::type> > that_type;\
+ that_type that = {{*static_cast<Derived BOOST_PROTO_CONST ## Const *>(this), {boost::proto::result_of::as_arg<A, Domain>::call(a)}}};\
             return Domain::make(that);\
         }\
         /**/
@@ -96,11 +96,11 @@
         ///
     #define BOOST_PROTO_EXTENDS_SUBSCRIPT_IMPL_(Expr, Derived, Domain, Const)\
         template<typename A>\
- typename boost::mpl::apply_wrap1<Domain, boost::proto::expr<boost::proto::tag::subscript, boost::proto::args<Derived BOOST_PROTO_CONST ## Const &, typename boost::proto::result_of::as_arg<A>::type> > >::type\
+ typename boost::mpl::apply_wrap1<Domain, boost::proto::expr<boost::proto::tag::subscript, boost::proto::args<Derived BOOST_PROTO_CONST ## Const &, typename boost::proto::result_of::as_arg<A, Domain>::type> > >::type\
         operator [](A &&a) BOOST_PROTO_CONST ## Const\
         {\
- typedef boost::proto::expr<boost::proto::tag::subscript, boost::proto::args<Derived BOOST_PROTO_CONST ## Const &, typename boost::proto::result_of::as_arg<A>::type> > that_type;\
- that_type that = {{*static_cast<Derived BOOST_PROTO_CONST ## Const *>(this), {boost::proto::result_of::as_arg<A>::call(a)}}};\
+ typedef boost::proto::expr<boost::proto::tag::subscript, boost::proto::args<Derived BOOST_PROTO_CONST ## Const &, typename boost::proto::result_of::as_arg<A, Domain>::type> > that_type;\
+ that_type that = {{*static_cast<Derived BOOST_PROTO_CONST ## Const *>(this), {boost::proto::result_of::as_arg<A, Domain>::call(a)}}};\
             return Domain::make(that);\
         }\
         /**/
@@ -120,11 +120,11 @@
         ///
     #define BOOST_PROTO_EXTENDS_FUNCTION_IMPL_(Expr, Derived, Domain, Const)\
         template<typename... A>\
- typename boost::mpl::apply_wrap1<Domain, boost::proto::expr<boost::proto::tag::function, boost::proto::args<Derived BOOST_PROTO_CONST ## Const &, typename boost::proto::result_of::as_arg<A>::type...> > >::type\
+ typename boost::mpl::apply_wrap1<Domain, boost::proto::expr<boost::proto::tag::function, boost::proto::args<Derived BOOST_PROTO_CONST ## Const &, typename boost::proto::result_of::as_arg<A, Domain>::type...> > >::type\
         operator ()(A &&... a) BOOST_PROTO_CONST ## Const\
         {\
- typedef boost::proto::expr<boost::proto::tag::function, boost::proto::args<Derived BOOST_PROTO_CONST ## Const &, typename boost::proto::result_of::as_arg<A>::type...> > that_type;\
- that_type that = {boost::proto::argsns_::make_cons(*static_cast<Derived BOOST_PROTO_CONST ## Const *>(this), boost::proto::result_of::as_arg<A>::call(a)...)};\
+ typedef boost::proto::expr<boost::proto::tag::function, boost::proto::args<Derived BOOST_PROTO_CONST ## Const &, typename boost::proto::result_of::as_arg<A, Domain>::type...> > that_type;\
+ that_type that = {boost::proto::argsns_::make_cons(*static_cast<Derived BOOST_PROTO_CONST ## Const *>(this), boost::proto::result_of::as_arg<A, Domain>::call(a)...)};\
             return Domain::make(that);\
         }\
         /**/

Modified: branches/proto/v3/boost/xpressive/proto3/generate.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/generate.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/generate.hpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -15,6 +15,12 @@
 #include <boost/xpressive/proto3/proto_fwd.hpp>
 #include <boost/xpressive/proto3/matches.hpp>
 
+#define UNREF(X) \
+ typename remove_reference<X>::type
+
+#define UNCVREF(X) \
+ typename remove_cv<UNREF(X)>::type
+
 namespace boost { namespace proto
 {
 
@@ -46,41 +52,52 @@
             typedef Args type;
         };
 
- template<typename Expr, long Arity = arity_<Expr>::value>
+ struct by_value_cons
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename... Args>
+ struct result<This(Args...)>
+ {
+ typedef argsns_::cons<UNCVREF(Args)...> type;
+ };
+
+ template<typename... Args>
+ argsns_::cons<Args...> operator()(Args const &... args) const
+ {
+ return argsns_::make_cons(std::move(args)...);
+ }
+ };
+
+ template<typename Expr>
         struct by_value_generator_;
 
- //#define BOOST_PROTO_DEFINE_BY_VALUE_TYPE(Z, N, Expr)\
- // typename result_of::unref<typename args_<Expr>::type::BOOST_PP_CAT(arg, N) >::type
+ template<typename Tag, typename... Args>
+ struct by_value_generator_<expr<Tag, args<Args...> > >
+ {
+ typedef expr<Tag, args<UNCVREF(Args)...> > type;
 
- //#define BOOST_PROTO_DEFINE_BY_VALUE(Z, N, expr)\
- // proto::unref(expr.BOOST_PP_CAT(arg, N))
+ static type make(expr<Tag, args<Args...> > const &expr)
+ {
+ type that = {
+ argsns_::fanout_args(by_value_cons(), expr.proto_base().proto_args_)
+ };
+ return that;
+ }
+ };
 
- //#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/generate.hpp>))
- //#include BOOST_PP_ITERATE()
+ template<typename T>
+ struct by_value_generator_<expr<tag::terminal, term<T>, 0> >
+ {
+ typedef expr<tag::terminal, term<UNCVREF(T)> > type;
 
- //#undef BOOST_PROTO_DEFINE_BY_VALUE
- //#undef BOOST_PROTO_DEFINE_BY_VALUE_TYPE
-
- // template<typename Expr>
- // struct by_value_generator_<Expr, N>
- // {
- // typedef expr<
- // typename tag_<Expr>::type
- // , BOOST_PP_CAT(args, N)<
- // // typename result_of::unref<typename args_<Expr>::type::arg0>::type, ...
- // BOOST_PP_ENUM(BOOST_PP_MAX(N, 1), BOOST_PROTO_DEFINE_BY_VALUE_TYPE, Expr)
- // >
- // > type;
-
- // static type const make(Expr const &expr)
- // {
- // type that = {
- // // proto::unref(expr.arg0), ...
- // BOOST_PP_ENUM(BOOST_PP_MAX(N, 1), BOOST_PROTO_DEFINE_BY_VALUE, expr)
- // };
- // return that;
- // }
- // };
+ static type make(expr<tag::terminal, term<T>, 0> const &expr)
+ {
+ type that = {{expr.proto_base().proto_args_.car}};
+ return that;
+ }
+ };
 
     }
 
@@ -155,4 +172,7 @@
 
 }}
 
+#undef UNREF
+#undef UNCVREF
+
 #endif // BOOST_PROTO3_GENERATE_HPP_EAN_02_13_2007

Modified: branches/proto/v3/boost/xpressive/proto3/operators.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/operators.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/operators.hpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -95,7 +95,7 @@
             typedef UNREF(A)::proto_domain D; \
             expr<TAG, args< \
                 typename result_of::as_arg<A, D>::type \
- > > that = {{a /*proto::as_arg<D>(std::forward<A>(a))*/}}; \
+ > > that = {{result_of::as_arg<A, D>::call(a)}}; \
             return D::make(that); \
         } \
         /**/
@@ -117,8 +117,8 @@
                 typename result_of::as_arg<A, D>::type \
               , typename result_of::as_arg<B, D>::type \
> > that = {{ \
- a /*proto::as_arg<D>(std::forward<A>(a))*/ \
- , {b /*proto::as_arg<D>(std::forward<B>(b))*/ } \
+ result_of::as_arg<A, D>::call(a) \
+ , {result_of::as_arg<B, D>::call(b)} \
             }}; \
             return D::make(that); \
         } \

Modified: branches/proto/v3/boost/xpressive/proto3/proto.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/proto.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/proto.hpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -14,6 +14,7 @@
 #include <boost/xpressive/proto3/tags.hpp>
 #include <boost/xpressive/proto3/eval.hpp>
 #include <boost/xpressive/proto3/expr.hpp>
+#include <boost/xpressive/proto3/debug.hpp>
 #include <boost/xpressive/proto3/traits.hpp>
 #include <boost/xpressive/proto3/domain.hpp>
 #include <boost/xpressive/proto3/extends.hpp>

Modified: branches/proto/v3/boost/xpressive/proto3/proto_fwd.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/proto_fwd.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/proto_fwd.hpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -11,9 +11,6 @@
 
 #include <climits> // for INT_MAX
 
-// BUGBUG
-#define BOOST_PROTO_MAX_ARITY 5
-
 namespace boost { namespace proto
 {
     namespace wildns_
@@ -383,10 +380,10 @@
 
     namespace context
     {
- //struct null_context;
+ struct null_context;
 
- //template<typename Expr, typename Context, long Arity = Expr::proto_arity::value>
- //struct null_eval;
+ template<typename Expr, typename Context, long Arity = Expr::proto_arity>
+ struct null_eval;
 
         struct default_context;
 

Modified: branches/proto/v3/boost/xpressive/proto3/traits.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/traits.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/traits.hpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -334,8 +334,7 @@
             typedef typename Domain::template apply<expr_type>::type type;
             typedef type const result_type;
 
- template<typename T2>
- static result_type call(T2 &&t)
+ static result_type call(CVREF(T) t)
             {
                 return Domain::make(expr_type::make(t));
             }
@@ -370,7 +369,7 @@
         {
             typedef expr<tag::terminal, term<CVREF(T) > > expr_type;
             typedef typename Domain::template apply<expr_type>::type type;
- static type call(T &&t)
+ static type call(CVREF(T) t)
             {
                 return Domain::make(expr_type::make(t));
             }
@@ -483,7 +482,7 @@
     template<typename T>
     typename result_of::as_arg<T>::type as_arg(T &&t)
     {
- return result_of::as_arg<T>::call(std::forward<T>(t));
+ return result_of::as_arg<T>::call(t);
     }
 
     template<typename Domain, typename T>

Modified: branches/proto/v3/libs/xpressive/proto3/example/calc1.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/example/calc1.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/example/calc1.cpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -8,8 +8,8 @@
 
 #include <iostream>
 #include <boost/mpl/int.hpp>
-#include <boost/xpressive/proto/proto.hpp>
-#include <boost/xpressive/proto/context.hpp>
+#include <boost/xpressive/proto3/proto.hpp>
+#include <boost/xpressive/proto3/context.hpp>
 using namespace boost;
 
 template<typename I> struct arg {};

Modified: branches/proto/v3/libs/xpressive/proto3/example/calc2.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/example/calc2.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/example/calc2.cpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -10,8 +10,8 @@
 
 #include <iostream>
 #include <boost/mpl/int.hpp>
-#include <boost/xpressive/proto/proto.hpp>
-#include <boost/xpressive/proto/context.hpp>
+#include <boost/xpressive/proto3/proto.hpp>
+#include <boost/xpressive/proto3/context.hpp>
 using namespace boost;
 
 // Will be used to define the placeholders _1 and _2

Modified: branches/proto/v3/libs/xpressive/proto3/example/calc3.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/example/calc3.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/example/calc3.cpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -13,63 +13,19 @@
 #include <boost/mpl/int.hpp>
 #include <boost/mpl/assert.hpp>
 #include <boost/mpl/min_max.hpp>
-#include <boost/xpressive/proto/proto.hpp>
-#include <boost/xpressive/proto/context.hpp>
-#include <boost/xpressive/proto/transform/arg.hpp>
-#include <boost/xpressive/proto/transform/fold.hpp>
-#include <boost/xpressive/proto/transform/apply.hpp>
+#include <boost/xpressive/proto3/proto.hpp>
+#include <boost/xpressive/proto3/context.hpp>
+#include <boost/xpressive/proto3/transform.hpp>
 using namespace boost;
 
 // Will be used to define the placeholders _1 and _2
-template<typename I> struct arg { typedef I arity; };
+template<typename I> struct arg : I {};
 
-// A meta-function for getting a placeholder terminal's arity.
-template<typename Arg>
-struct arg_arity
-{
- typedef typename Arg::arity type;
-};
-
-// A custom transform that fetches the arity of a placeholder terminal
-template<typename Grammar>
-struct placeholder_arity
- : Grammar
-{
- template<typename Expr, typename, typename>
- struct apply
- : arg_arity<typename proto::result_of::arg<Expr>::type>
- {};
-
- //// If this transform had a runtime counterpart, it would look like this:
- //template<typename Expr, typename State, typename Visitor>
- //static typename apply<Expr, State, Visitor>::type
- //call(Expr const &expr, State const &state, Visitor &visitor)
- //{
- // ... do stuff ...
- //}
-};
-
-// A custom transforms for calculating the max arity of a calculator expression
-template<typename Grammar>
-struct max_arity
- : Grammar
-{
- template<typename Expr, typename State, typename Visitor>
- struct apply
- {
- // Calculate the arity of the current expression.
- typedef typename Grammar::template apply<Expr, State, Visitor>::type arity;
- // The old maximum is passed along in the State parameter by
- // proto::transform::fold<> (see below). The new maximum is the
- // larger of the old maximum and the arity we just calculated.
- typedef typename mpl::max<arity, State>::type type;
- };
-
- // As with placeholder_arity<> above, placeholder_arity<> has no need
- // for a call() member function.
-};
+// needed only to work around a gcc bug.
+struct zero : mpl::int_<0> {};
 
 using proto::_;
+using namespace proto::transform;
 
 // This grammar basically says that a calculator expression is one of:
 // - A placeholder terminal
@@ -79,41 +35,18 @@
 // expression arity for each of the three cases.
 struct CalculatorGrammar
   : proto::or_<
- // placeholders have a non-zero arity ...
- placeholder_arity< proto::terminal< arg<_> > >
 
- //// This accomplishes the same thing without the need to
- //// define a separate placeholder_arity<> transform, but
- //// is a little more cryptic.
- //proto::transform::apply1<
- // proto::terminal< arg<_> >
- // , arg_arity< proto::result_of::arg<mpl::_> >
- //>
+ // placeholders have a non-zero arity ...
+ case_< proto::terminal< arg<_> >, _arg >
 
         // Any other terminals have arity 0 ...
- , proto::transform::always< proto::terminal<_>, mpl::int_<0> >
+ , case_< proto::terminal<_>, zero() >
+
         // For any non-terminals, find the arity of the children and
         // take the maximum. This is recursive.
- , proto::transform::fold<
- // This matches any non-terminal for which the children
- // are themselves calculator expressions.
- proto::nary_expr<_, proto::vararg< max_arity< CalculatorGrammar > > >
-
- //// This accomplishes the same thing without the need to
- //// define a separate max_arity<> transform, but is a little
- //// more cryptic.
- //proto::nary_expr<
- // _
- // , proto::vararg<
- // // Here, mpl::_1 will be replaced with the result of applying
- // // the CalculatorGrammar transform (i.e., the arity of the
- // // child node), and mpl::_2 will be replaced with the State of
- // // the transformation so far (i.e., the maximum arity found so
- // // far).
- // proto::transform::apply2<CalculatorGrammar, mpl::max<mpl::_1, mpl::_2> >
- // >
- //>
- >
+ , case_< proto::nary_expr<_, proto::vararg<_> >
+ , fold<_, zero(), mpl::max<CalculatorGrammar, _state>() > >
+
>
 {};
 
@@ -122,7 +55,7 @@
 // is not used, is mpl::void_.
 template<typename Expr>
 struct calculator_arity
- : CalculatorGrammar::apply<Expr, mpl::int_<0>, mpl::void_>
+ : CalculatorGrammar::apply<Expr, zero, mpl::void_>
 {};
 
 // For expressions in the calculator domain, operator()

Modified: branches/proto/v3/libs/xpressive/proto3/example/hello.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/example/hello.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/example/hello.cpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -5,8 +5,8 @@
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #include <iostream>
-#include <boost/xpressive/proto/proto.hpp>
-#include <boost/xpressive/proto/context.hpp>
+#include <boost/xpressive/proto3/proto.hpp>
+#include <boost/xpressive/proto3/context.hpp>
 #include <boost/typeof/std/ostream.hpp>
 using namespace boost;
 

Modified: branches/proto/v3/libs/xpressive/proto3/example/lazy_vector.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/example/lazy_vector.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/example/lazy_vector.cpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -15,8 +15,8 @@
 #include <vector>
 #include <iostream>
 #include <boost/mpl/int.hpp>
-#include <boost/xpressive/proto/proto.hpp>
-#include <boost/xpressive/proto/context.hpp>
+#include <boost/xpressive/proto3/proto.hpp>
+#include <boost/xpressive/proto3/context.hpp>
 using namespace boost;
 
 using proto::_;
@@ -27,8 +27,8 @@
 struct LazyVectorGrammar
   : proto::or_<
         proto::terminal< std::vector<_> >
- , proto::plus< LazyVectorGrammar, LazyVectorGrammar>
- , proto::minus< LazyVectorGrammar, LazyVectorGrammar>
+ , proto::plus< LazyVectorGrammar, LazyVectorGrammar >
+ , proto::minus< LazyVectorGrammar, LazyVectorGrammar >
>
 {};
 

Modified: branches/proto/v3/libs/xpressive/proto3/example/mixed.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/example/mixed.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/example/mixed.cpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -15,14 +15,15 @@
 #include <complex>
 #include <iostream>
 #include <stdexcept>
-#include <boost/xpressive/proto/proto.hpp>
-#include <boost/xpressive/proto/debug.hpp>
-#include <boost/xpressive/proto/context.hpp>
+#include <boost/xpressive/proto3/proto.hpp>
+//#include <boost/xpressive/proto3/debug.hpp>
+#include <boost/xpressive/proto3/context.hpp>
 #include <boost/typeof/std/list.hpp>
 #include <boost/typeof/std/vector.hpp>
 #include <boost/typeof/std/complex.hpp>
 
 using namespace boost;
+using namespace proto::transform;
 using proto::_;
 
 template<typename Expr>
@@ -38,30 +39,46 @@
     Iter it;
 };
 
-template<typename Cont>
-iterator_wrapper<typename Cont::const_iterator> cbegin(Cont const &cont)
-{
- return iterator_wrapper<typename Cont::const_iterator>(cont.begin());
-}
+//template<typename Cont>
+//iterator_wrapper<typename Cont::const_iterator> cbegin(Cont const &cont)
+//{
+// return iterator_wrapper<typename Cont::const_iterator>(cont.begin());
+//}
+//
+//template<typename Grammar>
+//struct begin
+// : Grammar
+//{
+// template<typename Expr, typename State, typename Visitor>
+// struct apply
+// : proto::terminal<
+// iterator_wrapper<
+// typename proto::result_of::arg<Expr>::type::const_iterator
+// >
+// >
+// {};
+//
+// template<typename Expr, typename State, typename Visitor>
+// static typename apply<Expr, State, Visitor>::type
+// call(Expr const &expr, State const &state, Visitor &visitor)
+// {
+// return proto::as_expr(cbegin(proto::arg(expr)));
+// }
+//};
 
-template<typename Grammar>
-struct begin
- : Grammar
+struct begin : proto::function_transform
 {
- template<typename Expr, typename State, typename Visitor>
- struct apply
- : proto::terminal<
- iterator_wrapper<
- typename proto::result_of::arg<Expr>::type::const_iterator
- >
- >
+ template<class Sig> struct result;
+ template<class This, class Cont>
+ struct result<This(Cont)>
+ : proto::result_of::as_expr<iterator_wrapper<typename Cont::const_iterator> >
     {};
-
- template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
+ template<typename Cont>
+ typename proto::as_expr<iterator_wrapper<typename Cont::const_iterator> >::type
+ operator()(Cont const &cont) const
     {
- return proto::as_expr(cbegin(proto::arg(expr)));
+ iterator_wrapper<typename Cont::const_iterator> it(cont.begin());
+ return proto::as_expr(it);
     }
 };
 
@@ -69,10 +86,10 @@
 // begin iterators
 struct Begin
   : proto::or_<
- begin< proto::terminal< std::vector<_, _> > >
- , begin< proto::terminal< std::list<_, _> > >
- , proto::terminal<_>
- , proto::nary_expr<_, proto::vararg<Begin> >
+ case_< proto::terminal< std::vector<_, _> >, begin(_arg) >
+ , case_< proto::terminal< std::list<_, _> >, begin(_arg) >
+ , case_< proto::terminal<_> >
+ , case_< proto::nary_expr<_, proto::vararg<Begin> > >
>
 {};
 
@@ -148,11 +165,14 @@
 };
 
 // A vector grammar is a terminal or some op that is not an
-// assignment op. (Assignment will be handles specially.)
+// assignment op. (Assignment will be handled specially.)
 struct MixedGrammar
   : proto::or_<
         proto::terminal<_>
- , proto::and_<proto::nary_expr<_, proto::vararg<MixedGrammar> >, proto::not_<AssignOps> >
+ , proto::and_<
+ proto::nary_expr<_, proto::vararg<MixedGrammar> >
+ , proto::not_<AssignOps>
+ >
>
 {};
 

Modified: branches/proto/v3/libs/xpressive/proto3/example/rgb.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/example/rgb.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/example/rgb.cpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -10,10 +10,10 @@
 // from PETE (http://www.codesourcery.com/pooma/download.html).
 
 #include <iostream>
-#include <boost/xpressive/proto/proto.hpp>
-#include <boost/xpressive/proto/transform/arg.hpp>
-#include <boost/xpressive/proto/transform/apply.hpp>
-#include <boost/xpressive/proto/transform/compose.hpp>
+#include <boost/xpressive/proto3/proto.hpp>
+#include <boost/xpressive/proto3/transform/arg.hpp>
+#include <boost/xpressive/proto3/transform/apply.hpp>
+#include <boost/xpressive/proto3/transform/compose.hpp>
 using namespace boost::proto;
 
 struct RedTag

Modified: branches/proto/v3/libs/xpressive/proto3/example/tarray.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/example/tarray.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/example/tarray.cpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -11,8 +11,8 @@
 
 #include <iostream>
 #include <boost/mpl/int.hpp>
-#include <boost/xpressive/proto/proto.hpp>
-#include <boost/xpressive/proto/context.hpp>
+#include <boost/xpressive/proto3/proto.hpp>
+#include <boost/xpressive/proto3/context.hpp>
 using namespace boost;
 
 // This grammar describes which TArray expressions

Modified: branches/proto/v3/libs/xpressive/proto3/example/vec3.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/example/vec3.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/example/vec3.cpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -13,13 +13,13 @@
 #include <iostream>
 #include <functional>
 #include <boost/mpl/int.hpp>
-#include <boost/xpressive/proto/proto.hpp>
-#include <boost/xpressive/proto/context.hpp>
-#include <boost/xpressive/proto/proto_typeof.hpp>
-#include <boost/xpressive/proto/transform/arg.hpp>
-#include <boost/xpressive/proto/transform/fold.hpp>
-#include <boost/xpressive/proto/transform/apply.hpp>
-#include <boost/xpressive/proto/transform/function.hpp>
+#include <boost/xpressive/proto3/proto.hpp>
+#include <boost/xpressive/proto3/context.hpp>
+#include <boost/xpressive/proto3/proto_typeof.hpp>
+#include <boost/xpressive/proto3/transform/arg.hpp>
+#include <boost/xpressive/proto3/transform/fold.hpp>
+#include <boost/xpressive/proto3/transform/apply.hpp>
+#include <boost/xpressive/proto3/transform/function.hpp>
 using namespace boost::proto;
 namespace mpl = boost::mpl;
 

Modified: branches/proto/v3/libs/xpressive/proto3/example/vector.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/example/vector.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/example/vector.cpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -11,9 +11,9 @@
 #include <vector>
 #include <iostream>
 #include <stdexcept>
-#include <boost/xpressive/proto/proto.hpp>
-#include <boost/xpressive/proto/debug.hpp>
-#include <boost/xpressive/proto/context.hpp>
+#include <boost/xpressive/proto3/proto.hpp>
+#include <boost/xpressive/proto3/debug.hpp>
+#include <boost/xpressive/proto3/context.hpp>
 
 using namespace boost;
 using proto::_;

Modified: branches/proto/v3/libs/xpressive/proto3/test/lambda.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/test/lambda.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/test/lambda.cpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -159,14 +159,14 @@
 template<typename T>
 lambda<typename proto::terminal<T>::type> const val(T const &t)
 {
- lambda<typename proto::terminal<T>::type> that = {{t}};
+ lambda<typename proto::terminal<T>::type> that = {{{t}}};
     return that;
 }
 
 template<typename T>
 lambda<typename proto::terminal<T &>::type> const var(T &t)
 {
- lambda<typename proto::terminal<T &>::type> that = {{t}};
+ lambda<typename proto::terminal<T &>::type> that = {{{t}}};
     return that;
 }
 

Modified: branches/proto/v3/libs/xpressive/proto3/test/main.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/test/main.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/test/main.cpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -9,14 +9,8 @@
 #include <boost/fusion/include/pop_front.hpp>
 #include <boost/fusion/include/reverse.hpp>
 #include <boost/xpressive/proto3/proto.hpp>
-#include <boost/xpressive/proto3/transform/arg.hpp>
-#include <boost/xpressive/proto3/transform/bind.hpp>
-#include <boost/xpressive/proto3/transform/fold.hpp>
-#include <boost/xpressive/proto3/transform/fold_tree.hpp>
-
-#include <boost/xpressive/proto3/eval.hpp>
-#include <boost/xpressive/proto3/context/default.hpp>
-#include <boost/xpressive/proto3/context/callable.hpp>
+#include <boost/xpressive/proto3/transform.hpp>
+#include <boost/xpressive/proto3/context.hpp>
 
 namespace boost { namespace fusion
 {
@@ -207,6 +201,30 @@
     }
 };
 
+
+template<typename E>
+struct byvalexpr;
+
+struct byvaldom
+ : domain<by_value_generator<generator<byvalexpr> > >
+{};
+
+template<typename E>
+struct byvalexpr
+ : extends<E, byvalexpr<E>, byvaldom>
+{
+ explicit byvalexpr(E const &e = E())
+ : extends<E, byvalexpr<E>, byvaldom>(e)
+ {}
+
+ using extends<E, byvalexpr<E>, byvaldom>::operator=;
+};
+
+byvalexpr<terminal<int>::type> A;
+byvalexpr<terminal<int>::type> B;
+byvalexpr<terminal<int>::type> C;
+
+
 int main()
 {
     int dummy=0;
@@ -320,5 +338,19 @@
     int r1 = eval(as_expr(1) + as_expr(2), ctx);
     std::cout << r1 << std::endl;
 
+ display_expr((_1 = 1, 'a', str));
+
+ byvalexpr<
+ expr<tag::plus
+ , args<
+ byvalexpr<expr<tag::terminal, term<int> > >
+ , byvalexpr<expr<tag::divides, args<
+ byvalexpr<expr<tag::terminal, term<int> > >
+ , byvalexpr<expr<tag::terminal, term<int> > >
+ > > >
+ >
+ >
+ > bve = A+B/C;
+
     return 0;
 }

Modified: branches/proto/v3/libs/xpressive/proto3/test/toy_spirit.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/test/toy_spirit.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/test/toy_spirit.cpp 2007-11-09 16:43:56 EST (Fri, 09 Nov 2007)
@@ -70,7 +70,7 @@
             FwdIter tmp = begin;
             std::string::const_iterator istr = str.begin(), estr = str.end();
             for(; istr != estr; ++tmp, istr += 2)
- if(tmp == end || *tmp != *istr && *tmp != *(istr+1))
+ if(tmp == end || (*tmp != *istr && *tmp != *(istr+1)))
                     return false;
             begin = tmp;
             return true;


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