From b5972cd6475e354c4432f2adf94fff73807daad3 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 23 Sep 2015 19:30:47 +0100 Subject: [PATCH] Tweak utf8::iterator::distance implementation, remove unused advance method --- src/utf8_iterator.hh | 19 ++----------------- 1 file 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