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.

3553. Useless constraint in split_view::outer-iterator::value_type::begin()

Section: 99 [range.split.outer.value] Status: WP Submitter: Hewill Kang Opened: 2021-05-18 Last modified: 2021-06-12

Priority: Not Prioritized

View all other issues in [range.split.outer.value].

View all issues with WP status.


The copyable constraint in split_view::outer-iterator::value_type::begin() is useless because outer-iterator always satisfies copyable.

When V does not model forward_range, the outer-iterator only contains a pointer, so it is obviously copyable; When V is a forward_range, the iterator_t<Base> is a forward_iterator, so it is copyable, which makes outer-iterator also copyable.

Suggested resolution: Remove the no-const begin() and useless copyable constraint in 99 [range.split.outer.value].

[2021-05-26; 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 N4885.

  1. Modify 99 [range.split.outer.value], class split_view::outer-iterator::value_type synopsis, as indicated:

    namespace std::ranges {
      template<input_range V, forward_range Pattern>
        requires view<V> && view<Pattern> &&
                 indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to> &&
                 (forward_range<V> || tiny-range<Pattern>)
      template<bool Const>
      struct split_view<V, Pattern>::outer-iterator<Const>::value_type
        : view_interface<value_type> {
        outer-iterator i_ = outer-iterator(); // exposition only
        value_type() = default;
        constexpr explicit value_type(outer-iterator i);
        constexpr inner-iterator<Const> begin() const requires copyable<outer-iterator>;
        constexpr inner-iterator<Const> begin() requires (!copyable<outer-iterator>);
        constexpr default_sentinel_t end() const;
    constexpr inner-iterator<Const> begin() const requires copyable<outer-iterator>;

    -2- Effects: Equivalent to: return inner-iterator<Const>{i_};

    constexpr inner-iterator<Const> begin() requires (!copyable<outer-iterator>);

    -3- Effects: Equivalent to: return inner-iterator<Const>{std::move(i_)};