Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66150 - trunk/boost/proto
From: eric_at_[hidden]
Date: 2010-10-22 17:07:28


Author: eric_niebler
Date: 2010-10-22 17:07:23 EDT (Fri, 22 Oct 2010)
New Revision: 66150
URL: http://svn.boost.org/trac/boost/changeset/66150

Log:
add nested which typedef for matches with switch_ and if_ for Phoenix-style extensible grammars
Text files modified:
   trunk/boost/proto/matches.hpp | 25 +++++++++++++++----------
   1 files changed, 15 insertions(+), 10 deletions(-)

Modified: trunk/boost/proto/matches.hpp
==============================================================================
--- trunk/boost/proto/matches.hpp (original)
+++ trunk/boost/proto/matches.hpp 2010-10-22 17:07:23 EDT (Fri, 22 Oct 2010)
@@ -391,15 +391,18 @@
                   , matches_<proto::basic_expr<Tag, Args, Arity>, typename Then::proto_grammar>
                   , matches_<proto::basic_expr<Tag, Args, Arity>, typename Else::proto_grammar>
>::type
- {};
-
- template<typename Tag, typename Args, long Arity, typename If>
- struct matches_<proto::basic_expr<Tag, Args, Arity>, proto::if_<If> >
- : detail::uncvref<
- typename when<_, If>::
- template impl<proto::expr<Tag, Args, Arity>, int, int>::result_type
- >::type
- {};
+ {
+ typedef
+ typename mpl::if_c<
+ remove_reference<
+ typename when<_, If>::
+ template impl<proto::expr<Tag, Args, Arity>, int, int>::result_type
+ >::type::value
+ , Then
+ , Else
+ >::type
+ which;
+ };
 
             // handle degenerate cases of proto::or_
             template<typename Expr>
@@ -440,7 +443,9 @@
                     proto::basic_expr<Tag, Args, Arity>
                   , typename Cases::template case_<Tag>::proto_grammar
>
- {};
+ {
+ typedef typename Cases::template case_<Tag> which;
+ };
         }
 
         /// \brief A Boolean metafunction that evaluates whether a given


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