Fix comparison operators in utf8_iterator and tag it as bidirectional
This commit is contained in:
parent
d5a8d9bf3a
commit
21644d17d6
|
@ -15,10 +15,12 @@ namespace utf8
|
||||||
// on unicode codepoints instead.
|
// on unicode codepoints instead.
|
||||||
template<typename Iterator,
|
template<typename Iterator,
|
||||||
typename InvalidPolicy = utf8::InvalidPolicy::Pass>
|
typename InvalidPolicy = utf8::InvalidPolicy::Pass>
|
||||||
class iterator : public std::iterator<std::forward_iterator_tag,
|
class iterator : public std::iterator<std::bidirectional_iterator_tag,
|
||||||
Codepoint, CharCount>
|
Codepoint, CharCount>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
iterator() = default;
|
||||||
|
|
||||||
iterator(Iterator it, Iterator begin, Iterator end)
|
iterator(Iterator it, Iterator begin, Iterator end)
|
||||||
: m_it{std::move(it)}, m_begin{std::move(begin)}, m_end{std::move(end)}
|
: m_it{std::move(it)}, m_begin{std::move(begin)}, m_end{std::move(end)}
|
||||||
{}
|
{}
|
||||||
|
@ -78,8 +80,8 @@ public:
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
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) { 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; }
|
bool operator<= (const iterator& other) const { return m_it <= other.m_it; }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user