From ed68d1ff287d43c5293abb4d41e908aa8e50afec Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 2 Jul 2014 21:14:01 +0100 Subject: utf8: use end of sequence iterators for more security --- src/utf8_iterator.hh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/utf8_iterator.hh') diff --git a/src/utf8_iterator.hh b/src/utf8_iterator.hh index c7ea102f..d2d8fa6a 100644 --- a/src/utf8_iterator.hh +++ b/src/utf8_iterator.hh @@ -12,7 +12,7 @@ namespace utf8 // adapter for an iterator on bytes which permits to iterate // on unicode codepoints instead. template + typename InvalidPolicy = utf8::InvalidPolicy::Assert> class iterator { public: @@ -21,7 +21,7 @@ public: iterator& operator++() { - m_it = utf8::next(m_it); + m_it = utf8::next(m_it, Iterator{}); invalidate_value(); return *this; } @@ -41,7 +41,7 @@ public: iterator& operator--() { - m_it = utf8::previous(m_it); + m_it = utf8::previous(m_it, Iterator{}); invalidate_value(); return *this; } @@ -132,7 +132,7 @@ private: Codepoint get_value() const { if (m_value == -1) - m_value = utf8::codepoint(m_it); + m_value = utf8::codepoint(m_it, Iterator{}); return m_value; } @@ -140,7 +140,7 @@ private: mutable Codepoint m_value = -1; }; -template +template iterator make_iterator(Iterator it) { return iterator{std::move(it)}; -- cgit v1.2.3