Tweak utf8::iterator::distance implementation, remove unused advance method

This commit is contained in:
Maxime Coste 2015-09-23 19:30:47 +01:00
parent 6ec693d598
commit b5972cd647

View File

@ -36,12 +36,6 @@ public:
return save; return save;
} }
void advance(CharCount count, const iterator& end)
{
while (*this != end and count-- > 0)
++*this;
}
iterator& operator--() iterator& operator--()
{ {
m_it = utf8::previous(m_it, Iterator{}); m_it = utf8::previous(m_it, Iterator{});
@ -101,18 +95,9 @@ public:
return m_it >= other.m_it; return m_it >= other.m_it;
} }
CharCount operator-(iterator other) const CharCount operator-(const iterator& other) const
{ {
//kak_assert(other < *this); return utf8::distance(other.m_it, m_it);
check_invariant();
other.check_invariant();
CharCount dist = 0;
while (other.m_it < m_it)
{
++dist;
++other;
}
return dist;
} }
Codepoint operator*() const Codepoint operator*() const