|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r86206 - in trunk: boost/algorithm/string libs/algorithm/string/test
From: marshall_at_[hidden]
Date: 2013-10-08 13:59:44
Author: marshall
Date: 2013-10-08 13:59:44 EDT (Tue, 08 Oct 2013)
New Revision: 86206
URL: http://svn.boost.org/trac/boost/changeset/86206
Log:
Revert to old behavior for find_iterator; will not find overlapping matches. Fixes #9063
Text files modified:
trunk/boost/algorithm/string/find_iterator.hpp | 7 +------
trunk/libs/algorithm/string/test/find_test.cpp | 28 +++++++++++++++-------------
2 files changed, 16 insertions(+), 19 deletions(-)
Modified: trunk/boost/algorithm/string/find_iterator.hpp
==============================================================================
--- trunk/boost/algorithm/string/find_iterator.hpp Tue Oct 8 13:17:27 2013 (r86205)
+++ trunk/boost/algorithm/string/find_iterator.hpp 2013-10-08 13:59:44 EDT (Tue, 08 Oct 2013) (r86206)
@@ -132,12 +132,7 @@
// increment
void increment()
{
- if(m_Match.begin() == m_Match.end())
- m_Match=this->do_find(m_Match.end(),m_End);
- else {
- input_iterator_type last = m_Match.begin();
- m_Match=this->do_find(++last,m_End);
- }
+ m_Match=this->do_find(m_Match.end(),m_End);
}
// comparison
Modified: trunk/libs/algorithm/string/test/find_test.cpp
==============================================================================
--- trunk/libs/algorithm/string/test/find_test.cpp Tue Oct 8 13:17:27 2013 (r86205)
+++ trunk/libs/algorithm/string/test/find_test.cpp 2013-10-08 13:59:44 EDT (Tue, 08 Oct 2013) (r86206)
@@ -181,6 +181,21 @@
( (cv_result.begin()-str1.begin()) == 3) &&
( (cv_result.end()-str1.begin()) == 6) );
+ string s1("abc def ghi jkl");
+ find_iterator<string::iterator> fEnd;
+
+ find_iterator<string::iterator> fxIt = make_find_iterator(s1,
+ token_finder(is_alnum(), token_compress_on));
+ BOOST_CHECK((fxIt != fEnd) && (*fxIt == string("abc")));
+ ++fxIt;
+ BOOST_CHECK((fxIt != fEnd) && (*fxIt == string("def")));
+ ++fxIt;
+ BOOST_CHECK((fxIt != fEnd) && (*fxIt == string("ghi")));
+ ++fxIt;
+ BOOST_CHECK((fxIt != fEnd) && (*fxIt == string("jkl")));
+ ++fxIt;
+ BOOST_CHECK(fxIt == fEnd);
+
nc_result=find_token( str1, is_any_of("abc"), token_compress_off );
BOOST_CHECK(
( (nc_result.begin()-str1.begin()) == 3) &&
@@ -251,19 +266,6 @@
osstr << find_first( str1, "abc" );
BOOST_CHECK( osstr.str()=="abc" );
- // Empty string test
- BOOST_TEST_CHECKPOINT( "overlapping" );
-
- std::string overlap_target("aaaa");
- std::vector<boost::iterator_range<std::string::iterator> > overlap_results;
- boost::algorithm::find_all(overlap_results, overlap_target, string("aaa"));
- BOOST_CHECK( overlap_results.size() == 2 );
-
- std::string overlap_target2("aaaabbbbaaaa");
- boost::algorithm::find_all(overlap_results, overlap_target2, string("bb"));
- BOOST_CHECK( overlap_results.size() == 3 );
- boost::algorithm::find_all(overlap_results, overlap_target2, string("aa"));
- BOOST_CHECK( overlap_results.size() == 6 );
}
// test main
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