Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49820 - in branches/release: . boost/proto libs/proto/test
From: eric_at_[hidden]
Date: 2008-11-17 22:03:46


Author: eric_niebler
Date: 2008-11-17 22:03:45 EST (Mon, 17 Nov 2008)
New Revision: 49820
URL: http://svn.boost.org/trac/boost/changeset/49820

Log:
fix bug 2407
Added:
   branches/release/libs/proto/test/bug2407.cpp
      - copied unchanged from r49812, /trunk/libs/proto/test/bug2407.cpp
Properties modified:
   branches/release/ (props changed)
Text files modified:
   branches/release/boost/proto/generate.hpp | 16 --------
   branches/release/boost/proto/operators.hpp | 74 +++++++++++++++++++++++++++++++--------
   branches/release/libs/proto/test/Jamfile.v2 | 1
   3 files changed, 59 insertions(+), 32 deletions(-)

Modified: branches/release/boost/proto/generate.hpp
==============================================================================
--- branches/release/boost/proto/generate.hpp (original)
+++ branches/release/boost/proto/generate.hpp 2008-11-17 22:03:45 EST (Mon, 17 Nov 2008)
@@ -18,7 +18,6 @@
     #include <boost/utility/enable_if.hpp>
     #include <boost/proto/proto_fwd.hpp>
     #include <boost/proto/args.hpp>
- #include <boost/proto/matches.hpp>
     #include <boost/proto/detail/suffix.hpp>
 
     namespace boost { namespace proto
@@ -26,21 +25,6 @@
 
         namespace detail
         {
- template<typename Domain, typename Expr>
- struct generate_if
- : lazy_enable_if<
- matches<Expr, typename Domain::proto_grammar>
- , typename Domain::template result<void(Expr)>
- >
- {};
-
- // Optimization, generate fewer templates...
- template<typename Expr>
- struct generate_if<proto::default_domain, Expr>
- {
- typedef Expr type;
- };
-
             template<typename Expr>
             struct expr_params;
 

Modified: branches/release/boost/proto/operators.hpp
==============================================================================
--- branches/release/boost/proto/operators.hpp (original)
+++ branches/release/boost/proto/operators.hpp 2008-11-17 22:03:45 EST (Mon, 17 Nov 2008)
@@ -19,6 +19,7 @@
 #include <boost/proto/proto_fwd.hpp>
 #include <boost/proto/tags.hpp>
 #include <boost/proto/expr.hpp>
+#include <boost/proto/matches.hpp>
 #include <boost/proto/generate.hpp>
 #include <boost/proto/make_expr.hpp>
 #include <boost/proto/detail/suffix.hpp>
@@ -27,21 +28,66 @@
 {
     namespace detail
     {
+ template<typename Domain, typename Expr>
+ struct generate_if
+ : lazy_enable_if_c<
+ matches<Expr, typename Domain::proto_grammar>::value
+ , typename Domain::template result<void(Expr)>
+ >
+ {};
+
+ // Optimization, generate fewer templates...
+ template<typename Expr>
+ struct generate_if<proto::default_domain, Expr>
+ {
+ typedef Expr type;
+ };
+
+ template<typename Domain, typename Tag, typename Left, typename Right>
+ struct generate_if_left
+ : lazy_enable_if_c<
+ matches<proto::expr<Tag, proto::list2<Left &, Right> >, typename Domain::proto_grammar>::value
+ , typename Domain::template result<void(
+ proto::expr<Tag, proto::list2<Left &, typename Domain::template result<void(Right)>::type> >
+ )>
+ >
+ {};
+
+ // Optimization, generate fewer templates...
+ template<typename Tag, typename Left, typename Right>
+ struct generate_if_left<proto::default_domain, Tag, Left, Right>
+ {
+ typedef proto::expr<Tag, proto::list2<Left &, Right> > type;
+ };
+
+ template<typename Domain, typename Tag, typename Left, typename Right>
+ struct generate_if_right
+ : lazy_enable_if_c<
+ matches<proto::expr<Tag, proto::list2<Left, Right &> >, typename Domain::proto_grammar>::value
+ , typename Domain::template result<void(
+ proto::expr<Tag, proto::list2<typename Domain::template result<void(Left)>::type, Right &> >
+ )>
+ >
+ {};
+
+ // Optimization, generate fewer templates...
+ template<typename Tag, typename Left, typename Right>
+ struct generate_if_right<proto::default_domain, Tag, Left, Right>
+ {
+ typedef proto::expr<Tag, proto::list2<Left, Right &> > type;
+ };
+
         template<typename Tag, typename Left, typename Right, typename Enable1 = void, typename Enable2 = void>
         struct as_expr_if2
         {};
 
         template<typename Tag, typename Left, typename Right>
         struct as_expr_if2<Tag, Left, Right, typename Left::proto_is_expr_, void>
- : generate_if<
+ : generate_if_left<
                 typename Left::proto_domain
- , proto::expr<
- Tag
- , list2<
- Left &
- , typename Left::proto_domain::template result<void(proto::expr<tag::terminal, term<Right &> >)>::type
- >
- >
+ , Tag
+ , Left
+ , proto::expr<tag::terminal, term<Right &> >
>
         {
             typedef proto::expr<tag::terminal, term<Right &> > term_type;
@@ -58,15 +104,11 @@
 
         template<typename Tag, typename Left, typename Right>
         struct as_expr_if2<Tag, Left, Right, void, typename Right::proto_is_expr_>
- : generate_if<
+ : generate_if_right<
                 typename Right::proto_domain
- , proto::expr<
- Tag
- , list2<
- typename Right::proto_domain::template result<void(proto::expr<tag::terminal, term<Left &> >)>::type
- , Right &
- >
- >
+ , Tag
+ , proto::expr<tag::terminal, term<Left &> >
+ , Right
>
         {
             typedef proto::expr<tag::terminal, term<Left &> > term_type;

Modified: branches/release/libs/proto/test/Jamfile.v2
==============================================================================
--- branches/release/libs/proto/test/Jamfile.v2 (original)
+++ branches/release/libs/proto/test/Jamfile.v2 2008-11-17 22:03:45 EST (Mon, 17 Nov 2008)
@@ -29,5 +29,6 @@
         [ run proto_fusion_s.cpp ]
         [ run toy_spirit.cpp ]
         [ run toy_spirit2.cpp ]
+ [ compile bug2407.cpp ]
     ;
 


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