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

4013. lazy_split_view::outer-iterator::value_type should not provide default constructor

Section: 25.7.16.4 [range.lazy.split.outer.value] Status: C++26 Submitter: Hewill Kang Opened: 2023-11-11 Last modified: 2026-06-09

Priority: Not Prioritized

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

View all issues with C++26 status.

Discussion:

After P2325, there is no reason for lazy_split_view::outer-iterator::value_type to provide a default constructor, which only leads to unexpected behavior:

#include 

constexpr int arr[] = {42};
constexpr auto split = arr | std::views::lazy_split(0);
static_assert(!std::ranges::range_value_t{});  // UB, dereferencing a null pointer

Also, the other constructor should be private because it makes no sense for the user to construct it arbitrarily, which is not the intention.

[2024-03-11; Reflector poll]

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

[Tokyo 2024-03-23; Status changed: Voting → WP.]

Proposed resolution:

This wording is relative to N4964.

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

    namespace std::ranges {
      template
        requires view && view &&
                 indirectly_comparable, iterator_t, ranges::equal_to> &&
                 (forward_range || tiny-range)
      template
      struct lazy_split_view::outer-iterator::value_type
        : view_interface {
      private:
        outer-iterator i_ = outer-iterator();               // exposition only
      
        constexpr explicit value_type(outer-iterator i);    // exposition only
    
      public:
        value_type() = default;
        constexpr explicit value_type(outer-iterator i);
    
        constexpr inner-iterator begin() const;
        constexpr default_sentinel_t end() const noexcept;
      };
    }