mirror of
https://github.com/boostorg/algorithm.git
synced 2025-07-06 09:16:33 +02:00
Split iterator fixed. Now it returns also last empty match if appropriate
[SVN r28096]
This commit is contained in:
@ -246,7 +246,9 @@ namespace boost {
|
|||||||
base_type(Other),
|
base_type(Other),
|
||||||
m_Match(Other.m_Match),
|
m_Match(Other.m_Match),
|
||||||
m_Next(Other.m_Next),
|
m_Next(Other.m_Next),
|
||||||
m_End(Other.m_End) {}
|
m_End(Other.m_End),
|
||||||
|
m_bEof(false)
|
||||||
|
{}
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
/*!
|
/*!
|
||||||
@ -261,7 +263,8 @@ namespace boost {
|
|||||||
detail::find_iterator_base<IteratorT>(Finder,0),
|
detail::find_iterator_base<IteratorT>(Finder,0),
|
||||||
m_Match(Begin,Begin),
|
m_Match(Begin,Begin),
|
||||||
m_Next(Begin),
|
m_Next(Begin),
|
||||||
m_End(End)
|
m_End(End),
|
||||||
|
m_bEof(false)
|
||||||
{
|
{
|
||||||
increment();
|
increment();
|
||||||
}
|
}
|
||||||
@ -277,7 +280,8 @@ namespace boost {
|
|||||||
detail::find_iterator_base<IteratorT>(Finder,0),
|
detail::find_iterator_base<IteratorT>(Finder,0),
|
||||||
m_Match(begin(Col),begin(Col)),
|
m_Match(begin(Col),begin(Col)),
|
||||||
m_Next(begin(Col)),
|
m_Next(begin(Col)),
|
||||||
m_End(end(Col))
|
m_End(end(Col)),
|
||||||
|
m_bEof(false)
|
||||||
{
|
{
|
||||||
increment();
|
increment();
|
||||||
}
|
}
|
||||||
@ -296,6 +300,16 @@ namespace boost {
|
|||||||
void increment()
|
void increment()
|
||||||
{
|
{
|
||||||
match_type FindMatch=this->do_find( m_Next, m_End );
|
match_type FindMatch=this->do_find( m_Next, m_End );
|
||||||
|
|
||||||
|
if(FindMatch.begin()==m_End && FindMatch.end()==m_End)
|
||||||
|
{
|
||||||
|
if(m_Match.end()==m_End)
|
||||||
|
{
|
||||||
|
// Mark iterator as eof
|
||||||
|
m_bEof=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_Match=match_type( m_Next, FindMatch.begin() );
|
m_Match=match_type( m_Next, FindMatch.begin() );
|
||||||
m_Next=FindMatch.end();
|
m_Next=FindMatch.end();
|
||||||
}
|
}
|
||||||
@ -325,12 +339,7 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
bool eof() const
|
bool eof() const
|
||||||
{
|
{
|
||||||
return
|
return this->is_null() || m_bEof;
|
||||||
this->is_null() ||
|
|
||||||
(
|
|
||||||
m_Match.begin() == m_End &&
|
|
||||||
m_Match.end() == m_End
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -338,6 +347,7 @@ namespace boost {
|
|||||||
match_type m_Match;
|
match_type m_Match;
|
||||||
input_iterator_type m_Next;
|
input_iterator_type m_Next;
|
||||||
input_iterator_type m_End;
|
input_iterator_type m_End;
|
||||||
|
bool m_bEof;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! split iterator construction helper
|
//! split iterator construction helper
|
||||||
|
Reference in New Issue
Block a user