Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66220 - trunk/boost/algorithm/string
From: droba_at_[hidden]
Date: 2010-10-27 16:40:49


Author: pavol_droba
Date: 2010-10-27 16:40:37 EDT (Wed, 27 Oct 2010)
New Revision: 66220
URL: http://svn.boost.org/trac/boost/changeset/66220

Log:
fixed the empty string handling for the split iterator

Text files modified:
   trunk/boost/algorithm/string/find_iterator.hpp | 12 ++++++++++--
   1 files changed, 10 insertions(+), 2 deletions(-)

Modified: trunk/boost/algorithm/string/find_iterator.hpp
==============================================================================
--- trunk/boost/algorithm/string/find_iterator.hpp (original)
+++ trunk/boost/algorithm/string/find_iterator.hpp 2010-10-27 16:40:37 EDT (Wed, 27 Oct 2010)
@@ -259,7 +259,11 @@
                 m_End(End),
                 m_bEof(false)
             {
- increment();
+ // force the correct behavior for empty sequences and yield at least one token
+ if(Begin!=End)
+ {
+ increment();
+ }
             }
             //! Constructor
             /*!
@@ -278,7 +282,11 @@
                 m_Next=::boost::begin(lit_col);
                 m_End=::boost::end(lit_col);
 
- increment();
+ // force the correct behavior for empty sequences and yield at least one token
+ if(m_Next!=m_End)
+ {
+ increment();
+ }
             }
 
 


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