$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r58407 - trunk/boost/spirit/home/qi/directive
From: hartmut.kaiser_at_[hidden]
Date: 2009-12-15 20:37:46
Author: hkaiser
Date: 2009-12-15 20:37:45 EST (Tue, 15 Dec 2009)
New Revision: 58407
URL: http://svn.boost.org/trac/boost/changeset/58407
Log:
Spirit: fixing problem in qi::repeat[]
Text files modified: 
   trunk/boost/spirit/home/qi/directive/repeat.hpp |    19 ++++++++++++-------                     
   1 files changed, 12 insertions(+), 7 deletions(-)
Modified: trunk/boost/spirit/home/qi/directive/repeat.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/directive/repeat.hpp	(original)
+++ trunk/boost/spirit/home/qi/directive/repeat.hpp	2009-12-15 20:37:45 EST (Tue, 15 Dec 2009)
@@ -20,6 +20,8 @@
 #include <boost/spirit/home/support/attributes.hpp>
 #include <boost/spirit/home/support/info.hpp>
 #include <boost/fusion/include/at.hpp>
+#include <boost/foreach.hpp>
+#include <vector>
 
 namespace boost { namespace spirit
 {
@@ -162,26 +164,29 @@
 
             // parse the minimum required
             if (!iter.got_min(i)) { 
-                // this scope allows save and save_attr to be reclaimed 
+                // this scope allows save and required_attr to be reclaimed 
                 // immediately after we're done with the required minimum 
                 // iteration.
                 Iterator save = first;
-                Attribute save_attr; traits::swap_impl(save_attr, attr);
+                std::vector<value_type> required_attr;
                 for (; !iter.got_min(i); ++i)
                 {
                     if (!subject.parse(save, last, context, skipper, val) ||
-                        !traits::push_back(attr, val))
+                        !traits::push_back(required_attr, val))
                     {
-                        // if we fail before reaching the minimum iteration
-                        // required, restore the iterator and the attribute
-                        // then return false
-                        traits::swap_impl(save_attr, attr);
                         return false;
                     }
 
                     first = save;
                     traits::clear(val);
                 }
+
+                // if we got the required number of items, these are copied 
+                // over (appended) to the 'real' attribute
+                BOOST_FOREACH(value_type const& v, required_attr)
+                {
+                    traits::push_back(attr, v);
+                }
             }
 
             // parse some more up to the maximum specified