This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++23 status.

3532. split_view<V, P>::inner-iterator<true>::operator++(int) should depend on Base

Section: 25.7.16.5 [range.lazy.split.inner] Status: C++23 Submitter: Casey Carter Opened: 2021-03-11 Last modified: 2023-11-22

Priority: Not Prioritized

View all other issues in [range.lazy.split.inner].

View all issues with C++23 status.

Discussion:

split_view<V, P>::inner-iterator<Const>::operator++(int) is specified directly in the synopsis in [range.split.inner] as:

constexpr decltype(auto) operator++(int) {
  if constexpr (forward_range<V>) {
    auto tmp = *this;
    ++*this;
    return tmp;
  } else
    ++*this;
}

The dependency on the properties of V here is odd given that we are wrapping an iterator obtained from a maybe-const<Const, V> (aka Base). It seems like this function should instead be concerned with forward_range<Base>.

[2021-04-20; Reflector poll]

Set status to Tentatively Ready after five votes in favour during reflector poll.

[2021-06-07 Approved at June 2021 virtual plenary. Status changed: Voting → WP.]

Proposed resolution:

This wording is relative to N4878.

  1. Modify [range.split.inner] as indicated:

    constexpr decltype(auto) operator++(int) {
      if constexpr (forward_range<VBase>) {
        auto tmp = *this;
        ++*this;
        return tmp;
      } else
        ++*this;
    }