diff --git a/include/beman/utf_view/to_utf_view.hpp b/include/beman/utf_view/to_utf_view.hpp index 83ba580..b50fbaa 100644 --- a/include/beman/utf_view/to_utf_view.hpp +++ b/include/beman/utf_view/to_utf_view.hpp @@ -201,31 +201,19 @@ class exposition_only_to_utf_view_impl { /* PAPER */ constexpr void exposition_only_advance_one() // @*exposition only*@ - requires std::forward_iterator { - if (buf_index_ + 1 < buf_last_) { - ++buf_index_; - } else { - std::advance(base(), to_increment_); - to_increment_ = 0; + ++buf_index_; + if (buf_index_ == buf_last_) { + if constexpr (std::forward_iterator) { + buf_index_ = 0; + std::advance(base(), to_increment_); + } if (base() != end()) { read(); - } else { - buf_index_ = 0; } } } - constexpr void exposition_only_advance_one() // @*exposition only*@ - requires (!std::forward_iterator) - { - if (buf_index_ + 1 == buf_last_ && base() != end()) { - read(); - } else { - ++buf_index_; - } - } - constexpr exposition_only_utf_iterator& operator++() requires(OrError) { if (!exposition_only_success()) { @@ -262,7 +250,7 @@ class exposition_only_to_utf_view_impl { { if (!buf_index_) read_reverse(); - else if (buf_index_) + else --buf_index_; return *this; } @@ -280,18 +268,7 @@ class exposition_only_to_utf_view_impl { requires std::forward_iterator || requires(exposition_only_iter i) { i != i; } { - if constexpr (std::forward_iterator) { - return lhs.base() == rhs.base() && lhs.buf_index_ == rhs.buf_index_; - } else { - if (lhs.base() != rhs.base()) - return false; - - if (lhs.buf_index_ == rhs.buf_index_ && lhs.buf_last_ == rhs.buf_last_) { - return true; - } - - return lhs.buf_index_ == lhs.buf_last_ && rhs.buf_index_ == rhs.buf_last_; - } + return lhs.base() == rhs.base() && lhs.buf_index_ == rhs.buf_index_; } friend constexpr bool operator==(exposition_only_utf_iterator const& lhs,