Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67359 - in trunk/boost/spirit/home: karma/auto qi/auto support/auto
From: hartmut.kaiser_at_[hidden]
Date: 2010-12-20 09:06:41


Author: hkaiser
Date: 2010-12-20 09:06:05 EST (Mon, 20 Dec 2010)
New Revision: 67359
URL: http://svn.boost.org/trac/boost/changeset/67359

Log:
Spirit: fixing Spirit for breaking change in Proto (Proto expressions are now Fusion sequences)
Text files modified:
   trunk/boost/spirit/home/karma/auto/meta_create.hpp | 5 +++--
   trunk/boost/spirit/home/qi/auto/meta_create.hpp | 5 +++--
   trunk/boost/spirit/home/support/auto/meta_create.hpp | 17 +++++++++++++++++
   3 files changed, 23 insertions(+), 4 deletions(-)

Modified: trunk/boost/spirit/home/karma/auto/meta_create.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/auto/meta_create.hpp (original)
+++ trunk/boost/spirit/home/karma/auto/meta_create.hpp 2010-12-20 09:06:05 EST (Mon, 20 Dec 2010)
@@ -154,8 +154,9 @@
       : meta_create_string<T> {};
 
     template <typename T>
- struct meta_create_impl<T
- , typename enable_if<fusion::traits::is_sequence<T> >::type>
+ struct meta_create_impl<T, typename enable_if<
+ spirit::detail::is_fusion_sequence_but_not_proto_expr<T>
+ >::type>
       : meta_create_sequence<T> {};
 
     template <typename T, typename Enable = void>

Modified: trunk/boost/spirit/home/qi/auto/meta_create.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/auto/meta_create.hpp (original)
+++ trunk/boost/spirit/home/qi/auto/meta_create.hpp 2010-12-20 09:06:05 EST (Mon, 20 Dec 2010)
@@ -89,8 +89,9 @@
       : meta_create_container<T> {};
 
     template <typename T>
- struct meta_create_impl<T
- , typename enable_if<fusion::traits::is_sequence<T> >::type>
+ struct meta_create_impl<T, typename enable_if<
+ spirit::detail::is_fusion_sequence_but_not_proto_expr<T>
+ >::type>
       : meta_create_sequence<T> {};
 
     template <typename T, typename Enable = void>

Modified: trunk/boost/spirit/home/support/auto/meta_create.hpp
==============================================================================
--- trunk/boost/spirit/home/support/auto/meta_create.hpp (original)
+++ trunk/boost/spirit/home/support/auto/meta_create.hpp 2010-12-20 09:06:05 EST (Mon, 20 Dec 2010)
@@ -20,6 +20,8 @@
 #include <boost/type_traits/remove_const.hpp>
 #include <boost/type_traits/remove_reference.hpp>
 #include <boost/fusion/include/fold.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/not.hpp>
 
 // needed for workaround below
 #if defined(__GNUC__) && ((__GNUC__ < 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ < 3))
@@ -189,6 +191,21 @@
             return fusion::fold(Sequence(), unused, make_proto_expr());
         }
     };
+
+ ///////////////////////////////////////////////////////////////////////////
+ namespace detail
+ {
+ // Starting with newer versions of Proto, all Proto expressions are at
+ // the same time Fusion sequences. This is the correct behavior, but
+ // we need to distinguish between Fusion sequences and Proto
+ // expressions. This meta-function does exactly that.
+ template <typename T>
+ struct is_fusion_sequence_but_not_proto_expr
+ : mpl::and_<
+ fusion::traits::is_sequence<T>
+ , mpl::not_<proto::is_expr<T> > >
+ {};
+ }
 }}
 
 #endif


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