Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58563 - in trunk/boost/spirit/home: karma/detail qi/detail
From: hartmut.kaiser_at_[hidden]
Date: 2009-12-29 11:36:38


Author: hkaiser
Date: 2009-12-29 11:36:37 EST (Tue, 29 Dec 2009)
New Revision: 58563
URL: http://svn.boost.org/trac/boost/changeset/58563

Log:
Spirit: fixing a problem in sequences if the attribute is a container of containers
Text files modified:
   trunk/boost/spirit/home/karma/detail/pass_container.hpp | 9 ++++++---
   trunk/boost/spirit/home/qi/detail/pass_container.hpp | 13 ++++++++-----
   2 files changed, 14 insertions(+), 8 deletions(-)

Modified: trunk/boost/spirit/home/karma/detail/pass_container.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/detail/pass_container.hpp (original)
+++ trunk/boost/spirit/home/karma/detail/pass_container.hpp 2009-12-29 11:36:37 EST (Tue, 29 Dec 2009)
@@ -108,9 +108,12 @@
         template <typename Component>
         bool dispatch_attribute(Component const& component, mpl::true_) const
         {
- typedef traits::is_container<
- typename traits::attribute_of<Component, context_type>::type
- > predicate;
+ typedef typename traits::attribute_of<
+ Component, context_type>::type attribute_type;
+
+ typedef mpl::and_<
+ traits::is_container<attribute_type>
+ , is_convertible<Attr, attribute_type> > predicate;
 
             return dispatch_attribute_element(component, predicate());
         }

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 2009-12-29 11:36:37 EST (Tue, 29 Dec 2009)
@@ -1,5 +1,6 @@
 /*=============================================================================
     Copyright (c) 2001-2009 Joel de Guzman
+ Copyright (c) 2001-2009 Hartmut Kaiser
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -16,6 +17,7 @@
 #include <boost/type_traits/is_base_of.hpp>
 #include <boost/type_traits/is_convertible.hpp>
 #include <boost/mpl/bool.hpp>
+#include <boost/mpl/and.hpp>
 
 namespace boost { namespace spirit { namespace qi { namespace detail
 {
@@ -98,11 +100,12 @@
         template <typename Component>
         bool dispatch_attribute(Component const& component, mpl::true_) const
         {
- typedef traits::is_container<
- typename traits::attribute_of<
- Component, context_type, iterator_type
- >::type
- > predicate;
+ typedef typename traits::attribute_of<
+ Component, context_type, iterator_type>::type attribute_type;
+
+ typedef mpl::and_<
+ traits::is_container<attribute_type>
+ , is_convertible<attribute_type, Attr> > predicate;
 
             return dispatch_attribute_element(component, predicate());
         }


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