Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55388 - trunk/boost/spirit/home/karma/operator
From: hartmut.kaiser_at_[hidden]
Date: 2009-08-03 11:48:35


Author: hkaiser
Date: 2009-08-03 11:48:33 EDT (Mon, 03 Aug 2009)
New Revision: 55388
URL: http://svn.boost.org/trac/boost/changeset/55388

Log:
Spirit: fixed karma alternative generator properties
Text files modified:
   trunk/boost/spirit/home/karma/operator/alternative.hpp | 31 ++++++++++++++++++++++++++++++-
   1 files changed, 30 insertions(+), 1 deletions(-)

Modified: trunk/boost/spirit/home/karma/operator/alternative.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/operator/alternative.hpp (original)
+++ trunk/boost/spirit/home/karma/operator/alternative.hpp 2009-08-03 11:48:33 EDT (Mon, 03 Aug 2009)
@@ -38,12 +38,41 @@
 }}
 
 ///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace traits
+{
+ // specialization for sequences
+ template <typename Elements>
+ struct alternative_properties
+ {
+ struct element_properties
+ {
+ template <typename T>
+ struct result;
+
+ template <typename F, typename Element>
+ struct result<F(Element)>
+ {
+ typedef properties_of<Element> type;
+ };
+ };
+
+ typedef typename mpl::accumulate<
+ typename fusion::result_of::transform<
+ Elements, element_properties>::type
+ , mpl::int_<karma::generator_properties::countingbuffer>
+ , mpl::bitor_<mpl::_2, mpl::_1>
+ >::type type;
+ };
+
+}}}
+
 namespace boost { namespace spirit { namespace karma
 {
     template <typename Elements>
     struct alternative : nary_generator<alternative<Elements> >
     {
- typedef mpl::int_<generator_properties::all_properties> properties;
+ typedef typename traits::alternative_properties<Elements>::type
+ properties;
 
         template <typename Context, typename Unused = unused_type>
         struct attribute


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