3590. split_view::base() const & is overconstrained

Section: 25.7.17.2 [range.split.view] Status: C++23 Submitter: Tim Song Opened: 2021-09-13 Last modified: 2023-11-22

Priority: Not Prioritized

View all issues with C++23 status.

Discussion:

Unlike every other range adaptor, split_view::base() const & is constrained on copyable<V> instead of copy_constructible<V>.

Since this function just performs a copy construction, there is no reason to require all of copyablecopy_constructible is sufficient.

[2021-09-24; Reflector poll]

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

[2021-10-14 Approved at October 2021 virtual plenary. Status changed: Voting → WP.]

Proposed resolution:

This wording is relative to N4892.

  1. Modify 25.7.17.2 [range.split.view], class template split_view synopsis, as indicated:

    namespace std::ranges {
      template<forward_range V, forward_range Pattern>
        requires view<V> && view<Pattern> &&
                 indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to>
      class split_view : public view_interface<split_view<V, Pattern>> {
      private:
        […]
      public:
        […]
    
        constexpr V base() const& requires copyablecopy_constructible<V> { return base_; }
        constexpr V base() && { return std::move(base_); }
    
        […]
      };