3592. lazy_split_view needs to check the simpleness of Pattern

Section: [range.lazy.split.view] Status: C++23 Submitter: Tim Song Opened: 2021-09-15 Last modified: 2023-11-22 15:47:43 UTC

Priority: Not Prioritized

View other active issues in [range.lazy.split.view].

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

View all issues with C++23 status.


For forward ranges, the non-const versions of lazy_split_view::begin() and lazy_split_view::end() returns an outer-iterator<simple-view<V>>, promoting to const if V models simple-view. However, this failed to take Pattern into account, even though that will also be accessed as const if const-promotion takes place. There is no requirement that const Pattern is a range, however.

[2021-09-24; Reflector poll]

Set status to Tentatively Ready after six 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 [range.lazy.split.view], class template lazy_split_view 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>)
      class lazy_split_view : public view_interface<lazy_split_view<V, Pattern>> {
        constexpr auto begin() {
          if constexpr (forward_range<V>)
            return outer-iterator<simple-view<V> &&
              simple-view<Pattern>>{*this, ranges::begin(base_)};
          else {
            current_ = ranges::begin(base_);
            return outer-iterator<false>{*this};
        constexpr auto end() requires forward_range<V> && common_range<V> {
          return outer-iterator<simple-view<V> &&
            simple-view<Pattern>>{*this, ranges::end(base_)};