|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r56662 - trunk/boost/spirit/home/karma/operator
From: hartmut.kaiser_at_[hidden]
Date: 2009-10-08 20:32:55
Author: hkaiser
Date: 2009-10-08 20:32:55 EDT (Thu, 08 Oct 2009)
New Revision: 56662
URL: http://svn.boost.org/trac/boost/changeset/56662
Log:
Spirit: fixing special case for sequences
Text files modified:
trunk/boost/spirit/home/karma/operator/sequence.hpp | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 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 2009-10-08 20:32:55 EDT (Thu, 08 Oct 2009)
@@ -121,9 +121,9 @@
// standard case. Attribute is a fusion tuple
template <
typename OutputIterator, typename Context, typename Delimiter
- , typename Attribute>
+ , typename Attribute, typename Pred1, typename Pred2>
bool generate_impl(OutputIterator& sink, Context& ctx
- , Delimiter const& d, Attribute& attr_, mpl::false_) const
+ , Delimiter const& d, Attribute& attr_, Pred1, Pred2) const
{
typedef detail::fail_function<
OutputIterator, Context, Delimiter> fail_function;
@@ -141,12 +141,14 @@
, predicate());
}
- // Special case when Attribute is an stl container
+ // Special case when Attribute is an stl container and the sequence's
+ // attribute is not a one element sequence
template <
typename OutputIterator, typename Context, typename Delimiter
, typename Attribute>
bool generate_impl(OutputIterator& sink, Context& ctx
- , Delimiter const& d, Attribute const& attr_, mpl::true_) const
+ , Delimiter const& d, Attribute const& attr_
+ , mpl::true_, mpl::false_) const
{
// return false if *any* of the generators fail
typedef detail::fail_function<
@@ -164,8 +166,15 @@
bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
, Attribute const& attr) const
{
- return generate_impl(sink, ctx, d, attr
- , traits::is_container<Attribute>());
+ typedef typename traits::is_container<Attribute>::type
+ is_container;
+
+ typedef typename attribute<Context>::type_ attr_type_;
+ typedef typename traits::one_element_sequence<attr_type_>::type
+ is_one_element_sequence;
+
+ return generate_impl(sink, ctx, d, attr, is_container()
+ , is_one_element_sequence());
}
template <typename Context>
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