From 21644d17d6377a0e0eea6d6798f2b738504550d4 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 22 Apr 2016 20:43:29 +0100 Subject: [PATCH] Fix comparison operators in utf8_iterator and tag it as bidirectional --- src/utf8_iterator.hh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utf8_iterator.hh b/src/utf8_iterator.hh index 5980ea7c..eed250e9 100644 --- a/src/utf8_iterator.hh +++ b/src/utf8_iterator.hh @@ -15,10 +15,12 @@ namespace utf8 // on unicode codepoints instead. template -class iterator : public std::iterator { public: + iterator() = default; + iterator(Iterator it, Iterator begin, Iterator end) : m_it{std::move(it)}, m_begin{std::move(begin)}, m_end{std::move(end)} {} @@ -78,8 +80,8 @@ public: return res; } - bool operator==(const iterator& other) { return m_it == other.m_it; } - bool operator!=(const iterator& other) { return m_it != other.m_it; } + bool operator==(const iterator& other) const { return m_it == other.m_it; } + bool operator!=(const iterator& other) const { return m_it != other.m_it; } bool operator< (const iterator& other) const { return m_it < other.m_it; } bool operator<= (const iterator& other) const { return m_it <= other.m_it; }