Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52688 - trunk/boost/spirit/home/support/iterators/detail
From: hartmut.kaiser_at_[hidden]
Date: 2009-04-30 14:46:54


Author: hkaiser
Date: 2009-04-30 14:46:53 EDT (Thu, 30 Apr 2009)
New Revision: 52688
URL: http://svn.boost.org/trac/boost/changeset/52688

Log:
Spirit: Fixed assertion in multi_pass iterator
Text files modified:
   trunk/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp | 14 +++++---------
   1 files changed, 5 insertions(+), 9 deletions(-)

Modified: trunk/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp (original)
+++ trunk/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp 2009-04-30 14:46:53 EDT (Thu, 30 Apr 2009)
@@ -53,9 +53,12 @@
             dereference(MultiPass const& mp)
             {
                 queue_type& queue = mp.shared->queued_elements;
+ typename queue_type::size_type size = queue.size();
+
+ BOOST_ASSERT(mp.queued_position <= size);
                 if (0 == mp.queued_position)
                 {
- if (queue.empty())
+ if (0 == size)
                     {
                         queue.push_back(Value());
                         return MultiPass::advance_input(mp, queue[mp.queued_position++]);
@@ -78,14 +81,7 @@
                 queue_type& queue = mp.shared->queued_elements;
                 typename queue_type::size_type size = queue.size();
 
- // The following assertion fires if the iterator gets
- // incremented before being dereferenced for the first time.
- // This may happen if you use the postincrement operator
- // at the same time as you dereference it: *it++, which is
- // invalid for this input iterator because the data storage
- // is shared between its copies and incrementing affects all
- // copies at the same time.
- BOOST_ASSERT(0 != size && mp.queued_position <= size);
+ BOOST_ASSERT(mp.queued_position <= size);
                 if (mp.queued_position == size)
                 {
                     // check if this is the only iterator


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