$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r70214 - in trunk/boost/spirit/home: qi/detail support
From: hartmut.kaiser_at_[hidden]
Date: 2011-03-19 22:06:27
Author: hkaiser
Date: 2011-03-19 22:06:25 EDT (Sat, 19 Mar 2011)
New Revision: 70214
URL: http://svn.boost.org/trac/boost/changeset/70214
Log:
Spirit: adding a workaround for strange behavior of fusion::vector, which is default constructible from any single type as long as that is convertible to the first type in the vector.
Text files modified: 
   trunk/boost/spirit/home/qi/detail/pass_container.hpp |     9 +++++----                               
   trunk/boost/spirit/home/support/attributes.hpp       |    19 +++++++++++++++----                     
   2 files changed, 20 insertions(+), 8 deletions(-)
Modified: trunk/boost/spirit/home/qi/detail/pass_container.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/detail/pass_container.hpp	(original)
+++ trunk/boost/spirit/home/qi/detail/pass_container.hpp	2011-03-19 22:06:25 EDT (Sat, 19 Mar 2011)
@@ -30,8 +30,9 @@
     template <typename Sequence, typename Attribute, typename ValueType>
     struct negate_weak_substitute_if_not
       : mpl::if_<
-            Sequence, traits::is_weak_substitute<Attribute, ValueType>
-          , mpl::not_<traits::is_weak_substitute<Attribute, ValueType> > >
+            Sequence
+          , typename traits::is_weak_substitute<Attribute, ValueType>::type
+          , typename mpl::not_<traits::is_weak_substitute<Attribute, ValueType> >::type>
     {};
 
     // pass_through_container: utility to check decide whether a provided 
@@ -134,8 +135,8 @@
             Container, ValueType, Attribute, Sequence
           , typename enable_if<traits::is_container<Attribute> >::type>
       : detail::pass_through_container_container<
-          Container, ValueType, Attribute, Sequence
-        , typename traits::container_value<Attribute>::type>
+            Container, ValueType, Attribute, Sequence
+          , typename traits::container_value<Attribute>::type>
     {};
 
     // Specialization for exposed optional attributes
Modified: trunk/boost/spirit/home/support/attributes.hpp
==============================================================================
--- trunk/boost/spirit/home/support/attributes.hpp	(original)
+++ trunk/boost/spirit/home/support/attributes.hpp	2011-03-19 22:06:25 EDT (Sat, 19 Mar 2011)
@@ -114,11 +114,23 @@
             mpl::and_<
                 fusion::traits::is_sequence<T>,
                 fusion::traits::is_sequence<Expected>,
-                mpl::equal<T, Expected, is_weak_substitute<mpl::_1, mpl::_2> >
-            >
+                mpl::equal<T, Expected, is_weak_substitute<mpl::_1, mpl::_2> > >
         >::type>
       : mpl::true_ {};
 
+    // If this is not defined, the main template definition above will return
+    // true if T is convertible to the first type in a fusion::vector. We
+    // globally declare any non-Fusion sequence T as not compatible with any
+    // Fusion sequence Expected.
+    template <typename T, typename Expected>
+    struct is_weak_substitute<T, Expected,
+        typename enable_if<
+            mpl::and_<
+                mpl::not_<fusion::traits::is_sequence<T> >
+              , fusion::traits::is_sequence<Expected> > 
+        >::type>
+      : mpl::false_ {};
+
     namespace detail
     {
         template <typename T, typename Expected>
@@ -135,8 +147,7 @@
             mpl::and_<
                 is_container<T>,
                 is_container<Expected>,
-                detail::value_type_is_weak_substitute<T, Expected>
-            >
+                detail::value_type_is_weak_substitute<T, Expected> >
         >::type>
       : mpl::true_ {};