File tree Expand file tree Collapse file tree
include/boost/algorithm/string Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -132,7 +132,10 @@ namespace boost {
132132 // increment
133133 void increment ()
134134 {
135- m_Match=this ->do_find (m_Match.end (),m_End);
135+ if (m_Match.begin () == m_Match.end ())
136+ m_Match=this ->do_find (m_Match.end (),m_End);
137+ else
138+ m_Match=this ->do_find (m_Match.begin ()+1 ,m_End);
136139 }
137140
138141 // comparison
Original file line number Diff line number Diff line change 99
1010#include < boost/algorithm/string/find.hpp>
1111#include < boost/algorithm/string/classification.hpp>
12+ #include < boost/algorithm/string/split.hpp>
1213
1314// Include unit test framework
1415#include < boost/test/included/test_exec_monitor.hpp>
@@ -248,6 +249,20 @@ void find_test()
248249 ostringstream osstr;
249250 osstr << find_first ( str1, " abc" );
250251 BOOST_CHECK ( osstr.str ()==" abc" );
252+
253+ // Empty string test
254+ BOOST_CHECKPOINT ( " overlapping" );
255+
256+ std::string overlap_target (" aaaa" );
257+ std::vector<boost::iterator_range<std::string::iterator> > overlap_results;
258+ boost::algorithm::find_all (overlap_results, overlap_target, string (" aaa" ));
259+ BOOST_CHECK ( overlap_results.size () == 2 );
260+
261+ std::string overlap_target2 (" aaaabbbbaaaa" );
262+ boost::algorithm::find_all (overlap_results, overlap_target2, string (" bb" ));
263+ BOOST_CHECK ( overlap_results.size () == 3 );
264+ boost::algorithm::find_all (overlap_results, overlap_target2, string (" aa" ));
265+ BOOST_CHECK ( overlap_results.size () == 6 );
251266}
252267
253268// test main
You can’t perform that action at this time.
0 commit comments