Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 8 additions & 31 deletions include/beman/utf_view/to_utf_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,31 +201,19 @@ class exposition_only_to_utf_view_impl {
/* PAPER */

constexpr void exposition_only_advance_one() // @*exposition only*@
requires std::forward_iterator<exposition_only_iter>
{
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<exposition_only_iter>) {
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<exposition_only_iter>)
{
if (buf_index_ + 1 == buf_last_ && base() != end()) {
read();
} else {
++buf_index_;
}
}

constexpr exposition_only_utf_iterator& operator++() requires(OrError)
{
if (!exposition_only_success()) {
Expand Down Expand Up @@ -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;
}
Expand All @@ -280,18 +268,7 @@ class exposition_only_to_utf_view_impl {
requires std::forward_iterator<exposition_only_iter> ||
requires(exposition_only_iter i) { i != i; }
{
if constexpr (std::forward_iterator<exposition_only_iter>) {
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,
Expand Down