summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-11-01 21:05:09 +1100
committerMaxime Coste <mawww@kakoune.org>2018-11-01 21:05:09 +1100
commit8a751e1b57b07ff43739e69f395ee4dfc3431ba0 (patch)
treee71c010c6a4bac0f6e6466532d0afc1f7fe6a96d /src
parent4cd7583bbcd85671eea51c9d7b0d1c2fbcc65b6d (diff)
Remove caching from utf8_iterator
Diffstat (limited to 'src')
-rw-r--r--src/utf8_iterator.hh13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/utf8_iterator.hh b/src/utf8_iterator.hh
index 9d10df2a..0467c30e 100644
--- a/src/utf8_iterator.hh
+++ b/src/utf8_iterator.hh
@@ -38,7 +38,6 @@ public:
iterator& operator++() noexcept
{
utf8::to_next(m_it, m_end);
- invalidate_value();
return *this;
}
@@ -52,7 +51,6 @@ public:
iterator& operator--() noexcept
{
utf8::to_previous(m_it, m_begin);
- invalidate_value();
return *this;
}
@@ -127,7 +125,7 @@ public:
CodepointType operator*() const noexcept(noexcept_policy)
{
- return get_value();
+ return (CodepointType)utf8::codepoint<InvalidPolicy>(m_it, m_end);
}
CodepointType read() noexcept(noexcept_policy)
@@ -138,18 +136,9 @@ public:
const BaseIt& base() const noexcept(noexcept_policy) { return m_it; }
private:
- void invalidate_value() noexcept { m_value = -1; }
- CodepointType get_value() const noexcept(noexcept_policy)
- {
- if (m_value == (CodepointType)-1)
- m_value = (CodepointType)utf8::codepoint<InvalidPolicy>(m_it, m_end);
- return m_value;
- }
-
BaseIt m_it;
Sentinel m_begin;
Sentinel m_end;
- mutable CodepointType m_value = -1;
};
}