Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80926 - in branches/release: . boost boost/proto
From: eric_at_[hidden]
Date: 2012-10-09 22:05:16


Author: eric_niebler
Date: 2012-10-09 22:05:16 EDT (Tue, 09 Oct 2012)
New Revision: 80926
URL: http://svn.boost.org/trac/boost/changeset/80926

Log:
proto: make proto::flat_view play nice with segmented fusion. merge [80820] from trunk
Properties modified:
   branches/release/ (props changed)
   branches/release/boost/ (props changed)
Text files modified:
   branches/release/boost/proto/expr.hpp | 2 +
   branches/release/boost/proto/fusion.hpp | 62 ++++++++++++++++++++-------------------
   branches/release/boost/proto/generate.hpp | 2 +
   branches/release/boost/proto/proto_fwd.hpp | 3 +
   4 files changed, 39 insertions(+), 30 deletions(-)

Modified: branches/release/boost/proto/expr.hpp
==============================================================================
--- branches/release/boost/proto/expr.hpp (original)
+++ branches/release/boost/proto/expr.hpp 2012-10-09 22:05:16 EDT (Tue, 09 Oct 2012)
@@ -90,6 +90,8 @@
             return that;
         }
 
+ // Work-around for:
+ // https://connect.microsoft.com/VisualStudio/feedback/details/765449/codegen-stack-corruption-using-runtime-checks-when-aggregate-initializing-struct
     #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1700))
         template<typename T, typename Expr, typename C, typename U>
         BOOST_FORCEINLINE

Modified: branches/release/boost/proto/fusion.hpp
==============================================================================
--- branches/release/boost/proto/fusion.hpp (original)
+++ branches/release/boost/proto/fusion.hpp 2012-10-09 22:05:16 EDT (Tue, 09 Oct 2012)
@@ -21,7 +21,8 @@
 #include <boost/fusion/include/iterator_base.hpp>
 #include <boost/fusion/include/intrinsic.hpp>
 #include <boost/fusion/include/single_view.hpp>
-#include <boost/fusion/include/transform_view.hpp>
+#include <boost/fusion/include/transform.hpp>
+#include <boost/fusion/include/as_list.hpp>
 #include <boost/fusion/include/is_segmented.hpp>
 #include <boost/fusion/sequence/comparison/enable_comparison.hpp>
 #include <boost/proto/proto_fwd.hpp>
@@ -61,25 +62,6 @@
             Expr &expr;
         };
 
- template<typename Expr>
- struct flat_view
- {
- typedef Expr expr_type;
- typedef fusion::forward_traversal_tag category;
- typedef
- tag::proto_flat_view<
- typename Expr::proto_tag
- , typename Expr::proto_domain
- >
- fusion_tag;
-
- explicit flat_view(Expr &e)
- : expr_(e)
- {}
-
- Expr &expr_;
- };
-
         template<typename Tag>
         struct as_element
         {
@@ -114,6 +96,33 @@
                 return typename result<as_element(Expr const &)>::type(e);
             }
         };
+
+ template<typename Expr>
+ struct flat_view
+ : fusion::sequence_base<flat_view<Expr> >
+ {
+ typedef fusion::forward_traversal_tag category;
+ typedef
+ tag::proto_flat_view<
+ typename Expr::proto_tag
+ , typename Expr::proto_domain
+ >
+ fusion_tag;
+ typedef
+ typename fusion::result_of::as_list<
+ typename fusion::result_of::transform<
+ Expr
+ , as_element<typename Expr::proto_tag>
+ >::type
+ >::type
+ segments_type;
+
+ explicit flat_view(Expr &e)
+ : segs_(fusion::as_list(fusion::transform(e, as_element<typename Expr::proto_tag>())))
+ {}
+
+ segments_type segs_;
+ };
     }
 
     namespace result_of
@@ -637,18 +646,11 @@
             template<typename Sequence>
             struct apply
             {
- typedef typename Sequence::expr_type::proto_tag proto_tag;
-
- typedef
- fusion::transform_view<
- typename Sequence::expr_type
- , proto::detail::as_element<proto_tag>
- >
- type;
-
+ typedef typename Sequence::segments_type const &type;
+
                 static type call(Sequence &sequence)
                 {
- return type(sequence.expr_, proto::detail::as_element<proto_tag>());
+ return sequence.segs_;
                 }
             };
         };

Modified: branches/release/boost/proto/generate.hpp
==============================================================================
--- branches/release/boost/proto/generate.hpp (original)
+++ branches/release/boost/proto/generate.hpp 2012-10-09 22:05:16 EDT (Tue, 09 Oct 2012)
@@ -228,6 +228,8 @@
             return that;
         }
 
+ // Work-around for:
+ // https://connect.microsoft.com/VisualStudio/feedback/details/765449/codegen-stack-corruption-using-runtime-checks-when-aggregate-initializing-struct
     #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1700))
         template<typename Class, typename Member>
         BOOST_FORCEINLINE

Modified: branches/release/boost/proto/proto_fwd.hpp
==============================================================================
--- branches/release/boost/proto/proto_fwd.hpp (original)
+++ branches/release/boost/proto/proto_fwd.hpp 2012-10-09 22:05:16 EDT (Tue, 09 Oct 2012)
@@ -222,6 +222,9 @@
 
         template<typename T, typename Void = void>
         struct is_aggregate_;
+
+ template<typename Expr>
+ struct flat_view;
     }
 
     typedef detail::ignore const ignore;


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