Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80820 - trunk/boost/proto
From: eric_at_[hidden]
Date: 2012-10-02 15:22:57


Author: eric_niebler
Date: 2012-10-02 15:22:56 EDT (Tue, 02 Oct 2012)
New Revision: 80820
URL: http://svn.boost.org/trac/boost/changeset/80820

Log:
flat_view doesn't cause segmented fusion to create invlalid iterators anymore
Text files modified:
   trunk/boost/proto/expr.hpp | 2 +
   trunk/boost/proto/fusion.hpp | 62 ++++++++++++++++++++-------------------
   trunk/boost/proto/generate.hpp | 2 +
   trunk/boost/proto/proto_fwd.hpp | 3 +
   4 files changed, 39 insertions(+), 30 deletions(-)

Modified: trunk/boost/proto/expr.hpp
==============================================================================
--- trunk/boost/proto/expr.hpp (original)
+++ trunk/boost/proto/expr.hpp 2012-10-02 15:22:56 EDT (Tue, 02 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: trunk/boost/proto/fusion.hpp
==============================================================================
--- trunk/boost/proto/fusion.hpp (original)
+++ trunk/boost/proto/fusion.hpp 2012-10-02 15:22:56 EDT (Tue, 02 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: trunk/boost/proto/generate.hpp
==============================================================================
--- trunk/boost/proto/generate.hpp (original)
+++ trunk/boost/proto/generate.hpp 2012-10-02 15:22:56 EDT (Tue, 02 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: trunk/boost/proto/proto_fwd.hpp
==============================================================================
--- trunk/boost/proto/proto_fwd.hpp (original)
+++ trunk/boost/proto/proto_fwd.hpp 2012-10-02 15:22:56 EDT (Tue, 02 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