mirror of
https://github.com/boostorg/algorithm.git
synced 2025-06-26 04:21:58 +02:00
Compare commits
2 Commits
boost-1.45
...
boost-1.46
Author | SHA1 | Date | |
---|---|---|---|
9535d80b31 | |||
01492a93c6 |
@ -258,9 +258,13 @@ namespace boost {
|
|||||||
m_Next(Begin),
|
m_Next(Begin),
|
||||||
m_End(End),
|
m_End(End),
|
||||||
m_bEof(false)
|
m_bEof(false)
|
||||||
|
{
|
||||||
|
// force the correct behavior for empty sequences and yield at least one token
|
||||||
|
if(Begin!=End)
|
||||||
{
|
{
|
||||||
increment();
|
increment();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//! Constructor
|
//! Constructor
|
||||||
/*!
|
/*!
|
||||||
Construct new split_iterator for a given finder
|
Construct new split_iterator for a given finder
|
||||||
@ -278,8 +282,12 @@ namespace boost {
|
|||||||
m_Next=::boost::begin(lit_col);
|
m_Next=::boost::begin(lit_col);
|
||||||
m_End=::boost::end(lit_col);
|
m_End=::boost::end(lit_col);
|
||||||
|
|
||||||
|
// force the correct behavior for empty sequences and yield at least one token
|
||||||
|
if(m_Next!=m_End)
|
||||||
|
{
|
||||||
increment();
|
increment();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -40,6 +40,7 @@ void iterator_test()
|
|||||||
string str1("xx-abc--xx-abb");
|
string str1("xx-abc--xx-abb");
|
||||||
string str2("Xx-abc--xX-abb-xx");
|
string str2("Xx-abc--xX-abb-xx");
|
||||||
string str3("xx");
|
string str3("xx");
|
||||||
|
string strempty("");
|
||||||
const char* pch1="xx-abc--xx-abb";
|
const char* pch1="xx-abc--xx-abb";
|
||||||
vector<string> tokens;
|
vector<string> tokens;
|
||||||
vector< vector<int> > vtokens;
|
vector< vector<int> > vtokens;
|
||||||
@ -123,6 +124,25 @@ void iterator_test()
|
|||||||
BOOST_CHECK( tokens[3]==string("xx") );
|
BOOST_CHECK( tokens[3]==string("xx") );
|
||||||
BOOST_CHECK( tokens[4]==string("abb") );
|
BOOST_CHECK( tokens[4]==string("abb") );
|
||||||
|
|
||||||
|
split(
|
||||||
|
tokens,
|
||||||
|
str3,
|
||||||
|
is_any_of(","),
|
||||||
|
token_compress_off);
|
||||||
|
|
||||||
|
BOOST_REQUIRE( tokens.size()==1 );
|
||||||
|
BOOST_CHECK( tokens[0]==string("xx") );
|
||||||
|
|
||||||
|
split(
|
||||||
|
tokens,
|
||||||
|
strempty,
|
||||||
|
is_punct(),
|
||||||
|
token_compress_off);
|
||||||
|
|
||||||
|
BOOST_REQUIRE( tokens.size()==1 );
|
||||||
|
BOOST_CHECK( tokens[0]==string("") );
|
||||||
|
|
||||||
|
|
||||||
find_iterator<string::iterator> fiter=make_find_iterator(str1, first_finder("xx"));
|
find_iterator<string::iterator> fiter=make_find_iterator(str1, first_finder("xx"));
|
||||||
BOOST_CHECK(equals(*fiter, "xx"));
|
BOOST_CHECK(equals(*fiter, "xx"));
|
||||||
++fiter;
|
++fiter;
|
||||||
|
Reference in New Issue
Block a user