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

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

Section: 99 [range.split.inner] Status: WP Submitter: Casey Carter Opened: 2021-03-11 Last modified: 2021-06-12

Priority: Not Prioritized

View all issues with WP status.

Discussion:

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

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