|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r59355 - in trunk/boost/spirit/home: karma/operator qi/operator support
From: hartmut.kaiser_at_[hidden]
Date: 2010-01-29 21:15:23
Author: hkaiser
Date: 2010-01-29 21:15:22 EST (Fri, 29 Jan 2010)
New Revision: 59355
URL: http://svn.boost.org/trac/boost/changeset/59355
Log:
Spirit: proper support for sequences taking one element attribute sequence
Text files modified:
trunk/boost/spirit/home/karma/operator/sequence.hpp | 5 ++++-
trunk/boost/spirit/home/qi/operator/sequence_base.hpp | 5 ++++-
trunk/boost/spirit/home/support/attributes.hpp | 13 ++++---------
3 files changed, 12 insertions(+), 11 deletions(-)
Modified: trunk/boost/spirit/home/karma/operator/sequence.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/operator/sequence.hpp (original)
+++ trunk/boost/spirit/home/karma/operator/sequence.hpp 2010-01-29 21:15:22 EST (Fri, 29 Jan 2010)
@@ -133,7 +133,10 @@
// attribute of this sequence is a single element tuple
typedef typename attribute<Context>::type_ attr_type_;
typename traits::wrap_if_not_tuple<Attribute
- , typename traits::one_element_sequence<attr_type_>::type
+ , typename mpl::and_<
+ traits::one_element_sequence<attr_type_>
+ , mpl::not_<traits::one_element_sequence<Attribute> >
+ >::type
>::type attr(attr_);
// return false if *any* of the generators fail
Modified: trunk/boost/spirit/home/qi/operator/sequence_base.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/sequence_base.hpp (original)
+++ trunk/boost/spirit/home/qi/operator/sequence_base.hpp 2010-01-29 21:15:22 EST (Fri, 29 Jan 2010)
@@ -74,7 +74,10 @@
// attribute of this sequence is a single element tuple
typedef typename attribute<Context, Iterator>::type_ attr_type_;
typename traits::wrap_if_not_tuple<Attribute
- , typename traits::one_element_sequence<attr_type_>::type
+ , typename mpl::and_<
+ traits::one_element_sequence<attr_type_>
+ , mpl::not_<traits::one_element_sequence<Attribute> >
+ >::type
>::type attr(attr_);
// return false if *any* of the parsers fail
Modified: trunk/boost/spirit/home/support/attributes.hpp
==============================================================================
--- trunk/boost/spirit/home/support/attributes.hpp (original)
+++ trunk/boost/spirit/home/support/attributes.hpp 2010-01-29 21:15:22 EST (Fri, 29 Jan 2010)
@@ -688,19 +688,14 @@
// meta function to return whether the argument is a one element fusion
// sequence
///////////////////////////////////////////////////////////////////////////
- template <typename T>
+ template <typename T, bool IsSeq = fusion::traits::is_sequence<T>::value>
struct one_element_sequence
- : mpl::false_
- {};
-
- template <typename T>
- struct one_element_sequence<fusion::vector1<T> >
- : mpl::true_
+ : mpl::false_
{};
template <typename T>
- struct one_element_sequence<fusion::vector<T> >
- : mpl::true_
+ struct one_element_sequence<T, true>
+ : mpl::bool_<mpl::size<T>::value == 1>
{};
///////////////////////////////////////////////////////////////////////////
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