Update of /cvsroot/boost/boost/boost/xpressive/detail/core/matcher
In directory
sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30506/boost/xpressive/detail/core/matcher
Modified Files:
action_matcher.hpp
Log Message:
in xpressive actions, foo(x,y) and x->*foo(y) are equivalent
Index: action_matcher.hpp
===================================================================
RCS file:
/cvsroot/boost/boost/boost/xpressive/detail/core/matcher/action_matcher.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- action_matcher.hpp 26 Mar 2007 06:06:25 -0000 1.11
+++ action_matcher.hpp 27 Mar 2007 07:13:55 -0000 1.12
@@ -25,6 +25,54 @@
{
///////////////////////////////////////////////////////////////////////////////
+ // action_context
+ //
+ struct action_context
+ {
+ template<typename Expr, typename Tag = typename Expr::tag_type>
+ struct eval
+ : proto::default_eval<Expr, action_context>
+ {};
+
+ template<typename Expr>
+ struct eval<Expr, proto::tag::mem_ptr>
+ {
+ typedef typename proto::result_of::right<Expr>::type right_type;
+
+ typedef
+ typename proto::result_of::arg<
+ typename proto::result_of::arg_c<right_type, 0>::type
+ >::type
+ function_type;
+
+ typedef
+ fusion::transform_view<
+ typename fusion::result_of::push_front<
+ typename
fusion::result_of::pop_front<proto::children<right_type const> >::type const
+ , typename proto::result_of::left<Expr>::type
+ >::type const
+ , proto::eval_fun<action_context>
+ >
+ evaluated_args;
+
+ typedef
+ typename fusion::result_of::invoke<function_type,
evaluated_args>::type
+ result_type;
+
+ result_type operator()(Expr const &expr, action_context &ctx) const
+ {
+ return fusion::invoke<function_type>(
+ proto::arg(proto::arg_c<0>(proto::right(expr)))
+ , evaluated_args(
+
fusion::push_front(fusion::pop_front(proto::children_of(proto::right(expr))),
proto::left(expr))
+ , proto::eval_fun<action_context>(ctx)
+ )
+ );
+ }
+ };
+ };
+
+
///////////////////////////////////////////////////////////////////////////////
// action
//
template<typename BidiIter, typename Actor>
@@ -39,7 +87,7 @@
virtual void execute() const
{
- proto::default_context ctx;
+ action_context ctx;
this->actor_.eval(ctx);
}
-------------------------------------------------------------------------
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