Split iterator fixed. Now it returns also last empty match if appropriate

[SVN r28096]
This commit is contained in:
Pavol Droba
2005-04-11 07:39:34 +00:00
parent 1489b70457
commit 3b889db8d1

View File

@ -246,7 +246,9 @@ namespace boost {
base_type(Other),
m_Match(Other.m_Match),
m_Next(Other.m_Next),
m_End(Other.m_End) {}
m_End(Other.m_End),
m_bEof(false)
{}
//! Constructor
/*!
@ -261,7 +263,8 @@ namespace boost {
detail::find_iterator_base<IteratorT>(Finder,0),
m_Match(Begin,Begin),
m_Next(Begin),
m_End(End)
m_End(End),
m_bEof(false)
{
increment();
}
@ -277,7 +280,8 @@ namespace boost {
detail::find_iterator_base<IteratorT>(Finder,0),
m_Match(begin(Col),begin(Col)),
m_Next(begin(Col)),
m_End(end(Col))
m_End(end(Col)),
m_bEof(false)
{
increment();
}
@ -296,6 +300,16 @@ namespace boost {
void increment()
{
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_Next=FindMatch.end();
}
@ -310,7 +324,7 @@ namespace boost {
(
m_Match==Other.m_Match &&
m_Next==Other.m_Next &&
m_End==Other.m_End
m_End==Other.m_End
);
}
@ -325,12 +339,7 @@ namespace boost {
*/
bool eof() const
{
return
this->is_null() ||
(
m_Match.begin() == m_End &&
m_Match.end() == m_End
);
return this->is_null() || m_bEof;
}
private:
@ -338,6 +347,7 @@ namespace boost {
match_type m_Match;
input_iterator_type m_Next;
input_iterator_type m_End;
bool m_bEof;
};
//! split iterator construction helper