diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-09-23 19:30:47 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-09-23 19:30:47 +0100 |
| commit | b5972cd6475e354c4432f2adf94fff73807daad3 (patch) | |
| tree | 88c258576fe8d2e881b4c18911161db7a01de356 /src/utf8_iterator.hh | |
| parent | 6ec693d598da1b2c7aaa4530644dc55a2f5ab8e1 (diff) | |
Tweak utf8::iterator::distance implementation, remove unused advance method
Diffstat (limited to 'src/utf8_iterator.hh')
| -rw-r--r-- | src/utf8_iterator.hh | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/utf8_iterator.hh b/src/utf8_iterator.hh index 1e359f17..43242a73 100644 --- a/src/utf8_iterator.hh +++ b/src/utf8_iterator.hh @@ -36,12 +36,6 @@ public: return save; } - void advance(CharCount count, const iterator& end) - { - while (*this != end and count-- > 0) - ++*this; - } - iterator& operator--() { m_it = utf8::previous(m_it, Iterator{}); @@ -101,18 +95,9 @@ public: return m_it >= other.m_it; } - CharCount operator-(iterator other) const + CharCount operator-(const iterator& other) const { - //kak_assert(other < *this); - check_invariant(); - other.check_invariant(); - CharCount dist = 0; - while (other.m_it < m_it) - { - ++dist; - ++other; - } - return dist; + return utf8::distance(other.m_it, m_it); } Codepoint operator*() const |
