Update of /cvsroot/boost/boost/boost/xpressive/proto
In directory
sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12267/boost/xpressive/proto
Modified Files:
context.hpp deep_copy.hpp expr.hpp extends.hpp fusion.hpp
proto.hpp traits.hpp
Added Files:
eval.hpp
Log Message:
make eval() a free function, make xpressive deep_copy semantic actions
--- NEW FILE: eval.hpp ---
///////////////////////////////////////////////////////////////////////////////
/// \file eval.hpp
/// Contains the eval() expression evaluator.
//
// Copyright 2004 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_EVAL_HPP_EAN_03_29_2007
#define BOOST_PROTO_EVAL_HPP_EAN_03_29_2007
#include <boost/xpressive/proto/detail/prefix.hpp> // must be first include
#include <boost/type_traits/remove_reference.hpp>
#include <boost/xpressive/proto/detail/suffix.hpp> // must be last include
namespace boost { namespace proto
{
namespace result_of
{
template<typename Expr, typename Context>
struct eval
{
typedef typename Context::template eval<Expr>::result_type type;
};
}
namespace op
{
struct eval
{
template<typename Sig>
struct result;
template<typename This, typename Expr, typename Context>
struct result<This(Expr, Context)>
: proto::result_of::eval<
typename remove_reference<Expr>::type
, typename remove_reference<Context>::type
>
{};
template<typename Expr, typename Context>
typename Context::template eval<Expr>::result_type
operator ()(Expr &expr, Context &context) const
{
return typename Context::template eval<Expr>()(expr, context);
}
template<typename Expr, typename Context>
typename Context::template eval<Expr>::result_type
operator ()(Expr &expr, Context const &context) const
{
return typename Context::template eval<Expr>()(expr, context);
}
};
}
op::eval const eval = {};
}}
#endif
Index: context.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/context.hpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- context.hpp 28 Mar 2007 08:35:56 -0000 1.16
+++ context.hpp 29 Mar 2007 22:19:38 -0000 1.17
@@ -13,6 +13,8 @@
#define BOOST_PROTO_CONTEXT_HPP_EAN_01_08_2007
#include <boost/xpressive/proto/detail/prefix.hpp> // must be first include
+ #include <boost/config.hpp>
+ #include <boost/detail/workaround.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>
@@ -24,24 +26,35 @@
#include <boost/mpl/if.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/utility/result_of.hpp>
- //#include <boost/type_traits/is_same.hpp>
+ #include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_function.hpp>
#include <boost/xpressive/proto/proto_fwd.hpp>
#include <boost/xpressive/proto/tags.hpp>
+ #include <boost/xpressive/proto/eval.hpp>
#include <boost/xpressive/proto/detail/suffix.hpp> // must be last include
- /// INTERNAL ONLY
- ///
- #define BOOST_PROTO_DECLTYPE_NESTED_TYPEDEF_TPL(Nested, Expr)\
- BOOST_TYPEOF_NESTED_TYPEDEF_TPL(BOOST_PP_CAT(nested_and_hidden_,
Nested), Expr)\
- struct Nested\
- : mpl::if_c<\
- 1==sizeof(detail::check_reference(Expr))\
- , typename BOOST_PP_CAT(nested_and_hidden_, Nested)::type &\
- , typename BOOST_PP_CAT(nested_and_hidden_, Nested)::type\
- >\
- {};\
- /**/
+ // If we're generating doxygen documentation, hide all the nasty
+ // Boost.Typeof gunk.
+ #ifndef BOOST_PROTO_DOXYGEN_INVOKED
+ #define BOOST_PROTO_DECLTYPE_NESTED_TYPEDEF_TPL(Nested, Expr)\
+ BOOST_TYPEOF_NESTED_TYPEDEF_TPL(BOOST_PP_CAT(nested_and_hidden_,
Nested), Expr)\
+ struct Nested\
+ : mpl::if_c<\
+ 1==sizeof(detail::check_reference(Expr))\
+ , typename BOOST_PP_CAT(nested_and_hidden_, Nested)::type &\
+ , typename BOOST_PP_CAT(nested_and_hidden_, Nested)::type\
+ >\
+ {};
+
+ #define BOOST_PROTO_TYPEOF(Expr, Type)\
+ BOOST_PROTO_DECLTYPE_NESTED_TYPEDEF_TPL(BOOST_PP_CAT(nested_,
Type), (Expr))\
+ typedef typename BOOST_PP_CAT(nested_, Type)::type Type;
+ #else
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_TYPEOF(Expr, Type)\
+ typedef detail::unspecified Type;
+ #endif
namespace boost { namespace proto
{
@@ -65,8 +78,7 @@
template<typename A0, typename A1>
struct comma_result
{
- BOOST_PROTO_DECLTYPE_NESTED_TYPEDEF_TPL(nested,
(detail::make<A0>(), detail::make<A1>()))
- typedef typename nested::type type;
+ BOOST_PROTO_TYPEOF((detail::make<A0>(), detail::make<A1>()),
type)
};
template<typename A0>
@@ -124,14 +136,15 @@
dont_care(T const &)
{}
};
- }
- /// INTERNAL ONLY
- ///
- #define BOOST_PROTO_TYPEOF(Expr, Type)\
- BOOST_PROTO_DECLTYPE_NESTED_TYPEDEF_TPL(BOOST_PP_CAT(nested_, Type),
(Expr))\
- typedef typename BOOST_PP_CAT(nested_, Type)::type Type;\
- /**/
+ #if BOOST_WORKAROUND(BOOST_MSVC, == 1400)
+ template<typename T> T &ref_(T &t);
+ template<typename T> T const &ref_(T const &t);
+ #define BOOST_PROTO_REF(x) detail::ref_(x)
+ #else
+ #define BOOST_PROTO_REF(x) x
+ #endif
+ }
/// INTERNAL ONLY
///
@@ -139,12 +152,14 @@
template<typename Expr, typename Context>\
struct default_eval<Expr, Context, Tag, 1>\
{\
- static Expr const &sexpr;\
+ private:\
+ static Expr &sexpr;\
static Context &sctx;\
- BOOST_PROTO_TYPEOF(Op proto::arg_c<0>(sexpr).eval(sctx),
result_type)\
- result_type operator()(Expr const &expr, Context &ctx) const\
+ public:\
+ BOOST_PROTO_TYPEOF(Op
proto::eval(BOOST_PROTO_REF(proto::arg_c<0>(sexpr)), sctx), result_type)\
+ result_type operator()(Expr &expr, Context &ctx) const\
{\
- return Op proto::arg_c<0>(expr).eval(ctx);\
+ return Op proto::eval(proto::arg_c<0>(expr), ctx);\
}\
};\
/**/
@@ -155,12 +170,14 @@
template<typename Expr, typename Context>\
struct default_eval<Expr, Context, Tag, 2>\
{\
- static Expr const &sexpr;\
+ private:\
+ static Expr &sexpr;\
static Context &sctx;\
- BOOST_PROTO_TYPEOF(proto::arg_c<0>(sexpr).eval(sctx) Op
proto::arg_c<1>(sexpr).eval(sctx), result_type)\
- result_type operator()(Expr const &expr, Context &ctx) const\
+ public:\
+
BOOST_PROTO_TYPEOF(proto::eval(BOOST_PROTO_REF(proto::arg_c<0>(sexpr)), sctx)
Op proto::eval(BOOST_PROTO_REF(proto::arg_c<1>(sexpr)), sctx), result_type)\
+ result_type operator()(Expr &expr, Context &ctx) const\
{\
- return proto::arg_c<0>(expr).eval(ctx) Op
proto::arg_c<1>(expr).eval(ctx);\
+ return proto::eval(proto::arg_c<0>(expr), ctx) Op
proto::eval(proto::arg_c<1>(expr), ctx);\
}\
};\
/**/
@@ -193,7 +210,6 @@
BOOST_PROTO_BINARY_OP_RESULT(|, proto::tag::bitwise_or)
BOOST_PROTO_BINARY_OP_RESULT(^, proto::tag::bitwise_xor)
BOOST_PROTO_BINARY_OP_RESULT(->*, proto::tag::mem_ptr)
- BOOST_PROTO_BINARY_OP_RESULT(=, proto::tag::assign)
BOOST_PROTO_BINARY_OP_RESULT(<<=, proto::tag::left_shift_assign)
BOOST_PROTO_BINARY_OP_RESULT(>>=, proto::tag::right_shift_assign)
@@ -209,23 +225,47 @@
template<typename Expr, typename Context>
struct default_eval<Expr, Context, proto::tag::terminal, 1>
{
- typedef typename proto::result_of::arg<Expr>::const_reference
result_type;
- result_type operator()(Expr const &expr, Context &) const
+ typedef
+ typename mpl::if_<
+ is_const<Expr>
+ , typename proto::result_of::arg<Expr>::const_reference
+ , typename proto::result_of::arg<Expr>::reference
+ >::type
+ result_type;
+
+ result_type operator()(Expr &expr, Context &) const
{
return proto::arg(expr);
}
};
+ // Handle assignment specially.
+ template<typename Expr, typename Context>
+ struct default_eval<Expr, Context, proto::tag::assign, 2>
+ {
+ private:
+ static Expr &sexpr;
+ static Context &sctx;
+ public:
+
BOOST_PROTO_TYPEOF(proto::eval(BOOST_PROTO_REF(proto::arg_c<0>(sexpr)), sctx) =
proto::eval(BOOST_PROTO_REF(proto::arg_c<1>(sexpr)), sctx), result_type)
+ result_type operator()(Expr &expr, Context &ctx) const
+ {
+ return proto::eval(proto::arg_c<0>(expr), ctx) =
proto::eval(proto::arg_c<1>(expr), ctx);
+ }
+ };
+
// Handle post-increment specially.
template<typename Expr, typename Context>
struct default_eval<Expr, Context, proto::tag::post_inc, 1>
{
- static Expr const &sexpr;
+ private:
+ static Expr &sexpr;
static Context &sctx;
- BOOST_PROTO_TYPEOF(proto::arg_c<0>(sexpr).eval(sctx) ++,
result_type)
- result_type operator()(Expr const &expr, Context &ctx) const
+ public:
+
BOOST_PROTO_TYPEOF(proto::eval(BOOST_PROTO_REF(proto::arg_c<0>(sexpr)), sctx)
++, result_type)
+ result_type operator()(Expr &expr, Context &ctx) const
{
- return proto::arg_c<0>(expr).eval(ctx) ++;
+ return proto::eval(proto::arg_c<0>(expr), ctx) ++;
}
};
@@ -233,12 +273,14 @@
template<typename Expr, typename Context>
struct default_eval<Expr, Context, proto::tag::post_dec, 1>
{
- static Expr const &sexpr;
+ private:
+ static Expr &sexpr;
static Context &sctx;
- BOOST_PROTO_TYPEOF(proto::arg_c<0>(sexpr).eval(sctx) --,
result_type)
- result_type operator()(Expr const &expr, Context &ctx) const
+ public:
+
BOOST_PROTO_TYPEOF(proto::eval(BOOST_PROTO_REF(proto::arg_c<0>(sexpr)), sctx)
--, result_type)
+ result_type operator()(Expr &expr, Context &ctx) const
{
- return proto::arg_c<0>(expr).eval(ctx) --;
+ return proto::eval(proto::arg_c<0>(expr), ctx) --;
}
};
@@ -246,12 +288,14 @@
template<typename Expr, typename Context>
struct default_eval<Expr, Context, proto::tag::subscript, 2>
{
- static Expr const &sexpr;
+ private:
+ static Expr &sexpr;
static Context &sctx;
-
BOOST_PROTO_TYPEOF(proto::arg_c<0>(sexpr).eval(sctx)[proto::arg_c<1>(sexpr).eval(sctx)],
result_type)
- result_type operator()(Expr const &expr, Context &ctx) const
+ public:
+
BOOST_PROTO_TYPEOF(proto::eval(BOOST_PROTO_REF(proto::arg_c<0>(sexpr)),
sctx)[proto::eval(BOOST_PROTO_REF(proto::arg_c<1>(sexpr)), sctx)], result_type)
+ result_type operator()(Expr &expr, Context &ctx) const
{
- return
proto::arg_c<0>(expr).eval(ctx)[proto::arg_c<1>(expr).eval(ctx)];
+ return proto::eval(proto::arg_c<0>(expr),
ctx)[proto::eval(proto::arg_c<1>(expr), ctx)];
}
};
@@ -262,9 +306,9 @@
typedef typename proto::result_of::eval<typename
proto::result_of::arg_c<Expr, 0>::type, Context>::type arg0_type;
typedef typename proto::result_of::eval<typename
proto::result_of::arg_c<Expr, 1>::type, Context>::type arg1_type;
typedef typename detail::comma_result<arg0_type, arg1_type>::type
result_type;
- result_type operator()(Expr const &expr, Context &ctx) const
+ result_type operator()(Expr &expr, Context &ctx) const
{
- return proto::arg_c<0>(expr).eval(ctx),
proto::arg_c<1>(expr).eval(ctx);
+ return proto::eval(proto::arg_c<0>(expr), ctx),
proto::eval(proto::arg_c<1>(expr), ctx);
}
};
@@ -281,7 +325,7 @@
>::type
#define BOOST_PROTO_EVAL_N(Z, N, Data)\
- proto::arg_c<N>(BOOST_PP_TUPLE_ELEM(2, 0,
Data)).eval(BOOST_PP_TUPLE_ELEM(2, 1, Data))
+ proto::eval(proto::arg_c<N>(BOOST_PP_TUPLE_ELEM(2, 0, Data)),
BOOST_PP_TUPLE_ELEM(2, 1, Data))
#define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY,
<boost/xpressive/proto/context.hpp>))
#include BOOST_PP_ITERATE()
@@ -295,6 +339,8 @@
///
struct default_context
{
+ /// default_context::eval
+ ///
template<typename Expr>
struct eval
: default_eval<Expr, default_context>
@@ -306,6 +352,8 @@
template<typename Context>
struct callable_context
{
+ /// callable_context::eval
+ ///
template<typename Expr>
struct eval
: callable_eval<Expr, Context>
@@ -338,7 +386,7 @@
>::type
result_type;
- result_type operator ()(Expr const &expr, Context &context) const
+ result_type operator ()(Expr &expr, Context &context) const
{
return BOOST_PROTO_EVAL_N(1, 0, (expr, context))(
BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_EVAL_N, (expr,
context))
@@ -349,6 +397,9 @@
template<typename Expr, typename Context>
struct callable_eval<Expr, Context, N>
{
+ private:
+ /// INTERNAL ONLY
+ ///
struct inner_context : Context
{
inner_context();
@@ -358,10 +409,12 @@
operator pointer_to_function() const;
};
+ /// INTERNAL ONLY
+ ///
struct has_proper_function_overload
{
static inner_context &sprivate_;
- static Expr const &sexpr_;
+ static Expr &sexpr_;
typedef char yes_type;
typedef char (&no_type)[2];
template<typename T> static yes_type check(T const &);
@@ -380,6 +433,7 @@
typedef mpl::bool_<value> type;
};
+ public:
typedef
typename boost::result_of<
Context(
@@ -389,12 +443,15 @@
>::type
result_type;
- result_type operator ()(Expr const &expr, Context &context) const
+ result_type operator ()(Expr &expr, Context &context) const
{
return (*this)(expr, context, typename
has_proper_function_overload::type());
}
- result_type operator ()(Expr const &expr, Context &context,
mpl::true_) const
+ private:
+ /// INTERNAL ONLY
+ ///
+ result_type operator ()(Expr &expr, Context &context, mpl::true_)
const
{
return context(
typename Expr::tag_type()
@@ -402,7 +459,9 @@
);
}
- result_type operator ()(Expr const &expr, Context &context,
mpl::false_) const
+ /// INTERNAL ONLY
+ ///
+ result_type operator ()(Expr &expr, Context &context, mpl::false_)
const
{
return default_eval<Expr, Context>()(expr, context);
}
Index: deep_copy.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/deep_copy.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- deep_copy.hpp 3 Feb 2007 00:14:33 -0000 1.10
+++ deep_copy.hpp 29 Mar 2007 22:19:38 -0000 1.11
@@ -33,7 +33,8 @@
typename result_of::arg<Expr>::type
>::type type;
- static type call(Expr const &expr)
+ template<typename Expr2>
+ static type call(Expr2 const &expr)
{
type that = {proto::arg(expr)};
return that;
@@ -104,7 +105,8 @@
BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_DEEP_COPY_TYPE, ~)
> > type;
- static type call(Expr const &expr)
+ template<typename Expr2>
+ static type call(Expr2 const &expr)
{
type that = {
BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_DEEP_COPY_FUN, ~)
Index: expr.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/expr.hpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- expr.hpp 26 Mar 2007 06:06:25 -0000 1.27
+++ expr.hpp 29 Mar 2007 22:19:39 -0000 1.28
@@ -142,18 +142,20 @@
return that;
}
- template<typename Fun>
- typename Fun::template eval<expr>::result_type
- eval(Fun &fun) const
+ template<typename A>
+ expr<tag::assign, args2<ref<expr>, typename
result_of::as_arg<A>::type> > const
+ operator =(A &a)
{
- return typename Fun::template eval<expr>()(*this, fun);
+ expr<tag::assign, args2<ref<expr>, typename
result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
+ return that;
}
- template<typename Fun>
- typename Fun::template eval<expr>::result_type
- eval(Fun const &fun) const
+ template<typename A>
+ expr<tag::assign, args2<ref<expr>, typename result_of::as_arg<A
const>::type> > const
+ operator =(A const &a)
{
- return typename Fun::template eval<expr>()(*this, fun);
+ expr<tag::assign, args2<ref<expr>, typename
result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
+ return that;
}
template<typename A>
@@ -173,6 +175,22 @@
}
template<typename A>
+ expr<tag::subscript, args2<ref<expr>, typename
result_of::as_arg<A>::type> > const
+ operator [](A &a)
+ {
+ expr<tag::subscript, args2<ref<expr>, typename
result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
+ return that;
+ }
+
+ template<typename A>
+ expr<tag::subscript, args2<ref<expr>, typename result_of::as_arg<A
const>::type> > const
+ operator [](A const &a)
+ {
+ expr<tag::subscript, args2<ref<expr>, typename
result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
+ return that;
+ }
+
+ template<typename A>
expr<tag::subscript, args2<ref<expr const>, typename
result_of::as_arg<A>::type> > const
operator [](A &a) const
{
@@ -214,14 +232,14 @@
template<typename This BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
struct result<This(BOOST_PP_ENUM_PARAMS(N, A))>
- : result_of::BOOST_PP_CAT(funop, N)<expr
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, typename remove_reference<A, >::type
BOOST_PP_INTERCEPT)>
+ : result_of::BOOST_PP_CAT(funop, N)<expr const
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, typename remove_reference<A, >::type
BOOST_PP_INTERCEPT)>
{};
template<BOOST_PP_ENUM_PARAMS(N, typename A)>
- typename result_of::BOOST_PP_CAT(funop, N)<expr
BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)>::type const
+ typename result_of::BOOST_PP_CAT(funop, N)<expr const
BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)>::type const
operator ()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const &a)) const
{
- return result_of::BOOST_PP_CAT(funop, N)<expr
BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)>
+ return result_of::BOOST_PP_CAT(funop, N)<expr const
BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)>
::call(*this BOOST_PP_ENUM_TRAILING_PARAMS(N, a));
}
Index: extends.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/extends.hpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- extends.hpp 12 Mar 2007 22:11:30 -0000 1.25
+++ extends.hpp 29 Mar 2007 22:19:39 -0000 1.26
@@ -36,7 +36,7 @@
: boost::proto::generate<\
BOOST_PP_TUPLE_ELEM(3, 2, Data)\
, typename boost::proto::result_of::BOOST_PP_CAT(funop, N)<\
- BOOST_PP_TUPLE_ELEM(3, 1, Data)\
+ BOOST_PP_TUPLE_ELEM(3, 1, Data) const\
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(\
Z\
, N\
@@ -51,14 +51,14 @@
typename boost::proto::generate<\
BOOST_PP_TUPLE_ELEM(3, 2, Data)\
, typename boost::proto::result_of::BOOST_PP_CAT(funop, N)<\
- BOOST_PP_TUPLE_ELEM(3, 1, Data)\
+ BOOST_PP_TUPLE_ELEM(3, 1, Data) const\
BOOST_PP_ENUM_TRAILING_PARAMS_Z(Z, N, const A)\
>::type\
>::type const\
operator ()(BOOST_PP_ENUM_BINARY_PARAMS_Z(Z, N, A, const &a)) const\
{\
typedef boost::proto::result_of::BOOST_PP_CAT(funop, N)<\
- BOOST_PP_TUPLE_ELEM(3, 1, Data)\
+ BOOST_PP_TUPLE_ELEM(3, 1, Data) const\
BOOST_PP_ENUM_TRAILING_PARAMS_Z(Z, N, const A)\
> funop;\
return boost::proto::generate<BOOST_PP_TUPLE_ELEM(3, 2, Data),
typename funop::type>::make(\
@@ -105,23 +105,27 @@
{\
return this->expr;\
}\
- \
- template<typename Fun>\
- typename boost::proto::result_of::eval<Expr, Fun>::type\
- eval(Fun &fun) const\
+ /**/
+
+ #define BOOST_PROTO_EXTENDS_ASSIGN(Expr, Derived, Domain)\
+ template<typename A>\
+ typename boost::proto::generate<Domain,
boost::proto::expr<boost::proto::tag::assign,
boost::proto::args2<boost::proto::ref<Derived >, typename
boost::proto::result_of::as_arg<A>::type> > >::type const\
+ operator =(A &a)\
{\
- return this->expr.eval(fun);\
+ typedef boost::proto::expr<boost::proto::tag::assign,
boost::proto::args2<boost::proto::ref<Derived >, typename
boost::proto::result_of::as_arg<A>::type> > that_type;\
+ that_type that = {{*static_cast<Derived *>(this)},
boost::proto::as_arg(a)};\
+ return boost::proto::generate<Domain, that_type>::make(that);\
}\
\
- template<typename Fun>\
- typename boost::proto::result_of::eval<Expr, Fun const>::type\
- eval(Fun const &fun) const\
+ template<typename A>\
+ typename boost::proto::generate<Domain,
boost::proto::expr<boost::proto::tag::assign,
boost::proto::args2<boost::proto::ref<Derived >, typename
boost::proto::result_of::as_arg<A const>::type> > >::type const\
+ operator =(A const &a)\
{\
- return this->expr.eval(fun);\
+ typedef boost::proto::expr<boost::proto::tag::assign,
boost::proto::args2<boost::proto::ref<Derived >, typename
boost::proto::result_of::as_arg<A const>::type> > that_type;\
+ that_type that = {{*static_cast<Derived *>(this)},
boost::proto::as_arg(a)};\
+ return boost::proto::generate<Domain, that_type>::make(that);\
}\
- /**/
-
- #define BOOST_PROTO_EXTENDS_ASSIGN(Expr, Derived, Domain)\
+ \
template<typename A>\
typename boost::proto::generate<Domain,
boost::proto::expr<boost::proto::tag::assign,
boost::proto::args2<boost::proto::ref<Derived const>, typename
boost::proto::result_of::as_arg<A>::type> > >::type const\
operator =(A &a) const\
@@ -143,6 +147,24 @@
#define BOOST_PROTO_EXTENDS_SUBSCRIPT(Expr, Derived, Domain)\
template<typename A>\
+ typename boost::proto::generate<Domain,
boost::proto::expr<boost::proto::tag::subscript,
boost::proto::args2<boost::proto::ref<Derived >, typename
boost::proto::result_of::as_arg<A>::type> > >::type const\
+ operator [](A &a)\
+ {\
+ typedef boost::proto::expr<boost::proto::tag::subscript,
boost::proto::args2<boost::proto::ref<Derived >, typename
boost::proto::result_of::as_arg<A>::type> > that_type;\
+ that_type that = {{*static_cast<Derived *>(this)},
boost::proto::as_arg(a)};\
+ return boost::proto::generate<Domain, that_type>::make(that);\
+ }\
+ \
+ template<typename A>\
+ typename boost::proto::generate<Domain,
boost::proto::expr<boost::proto::tag::subscript,
boost::proto::args2<boost::proto::ref<Derived >, typename
boost::proto::result_of::as_arg<A const>::type> > >::type const\
+ operator [](A const &a)\
+ {\
+ typedef boost::proto::expr<boost::proto::tag::subscript,
boost::proto::args2<boost::proto::ref<Derived >, typename
boost::proto::result_of::as_arg<A const>::type> > that_type;\
+ that_type that = {{*static_cast<Derived *>(this)},
boost::proto::as_arg(a)};\
+ return boost::proto::generate<Domain, that_type>::make(that);\
+ }\
+ \
+ template<typename A>\
typename boost::proto::generate<Domain,
boost::proto::expr<boost::proto::tag::subscript,
boost::proto::args2<boost::proto::ref<Derived const>, typename
boost::proto::result_of::as_arg<A>::type> > >::type const\
operator [](A &a) const\
{\
Index: fusion.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/fusion.hpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- fusion.hpp 27 Mar 2007 07:13:55 -0000 1.24
+++ fusion.hpp 29 Mar 2007 22:19:39 -0000 1.25
@@ -90,7 +90,7 @@
typename result<Expr>::type
operator()(Expr const &expr) const
{
- return expr.eval(this->ctx_);
+ return proto::eval(expr, this->ctx_);
}
private:
Index: proto.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/proto.hpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- proto.hpp 14 Feb 2007 08:03:06 -0000 1.16
+++ proto.hpp 29 Mar 2007 22:19:39 -0000 1.17
@@ -14,6 +14,7 @@
#include <boost/xpressive/proto/ref.hpp>
#include <boost/xpressive/proto/args.hpp>
#include <boost/xpressive/proto/tags.hpp>
+#include <boost/xpressive/proto/eval.hpp>
#include <boost/xpressive/proto/expr.hpp>
#include <boost/xpressive/proto/traits.hpp>
#include <boost/xpressive/proto/domain.hpp>
Index: traits.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/traits.hpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- traits.hpp 26 Mar 2007 06:06:25 -0000 1.44
+++ traits.hpp 29 Mar 2007 22:19:39 -0000 1.45
@@ -84,24 +84,40 @@
>::type arg0_type;
typedef expr<proto::tag::terminal, args1<arg0_type> > type;
-
typedef type result_type;
+
+ #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
+ template<typename T2>
+ static result_type call(T2 &t)
+ {
+ return type::make(t);
+ }
+ #else
static result_type call(T &t)
{
return type::make(t);
}
+ #endif
};
template<typename T>
struct as_expr<T, typename T::is_boost_proto_expr_>
{
typedef typename T::boost_proto_expr_type_ type;
-
typedef T &result_type;
+
+ #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
+ template<typename T2>
+ static result_type call(T2 &t)
+ {
+ return t;
+ }
+ #else
static result_type call(T &t)
{
return t;
}
+ #endif
};
// as_arg
@@ -137,13 +153,6 @@
: unref<typename Expr::arg1_type>
{};
- // eval
- template<typename Expr, typename Context>
- struct eval
- {
- typedef typename Context::template eval<Expr>::result_type
type;
- };
-
}
namespace detail
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs