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: 26.7.16.4 [range.lazy.split.outer.value] Status: WP Submitter: Hewill Kang Opened: 2021-05-18 Last modified: 2023-02-07

Priority: Not Prioritized

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

View all issues with WP status.

Discussion:

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 [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 [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> {
      private:
        outer-iterator i_ = outer-iterator(); // exposition only
      public:
        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_)};

    […]