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

3711. Missing preconditions for slide_view constructor

Section: [range.slide.view] Status: C++23 Submitter: Hewill Kang Opened: 2022-06-10 Last modified: 2023-11-22

Priority: Not Prioritized

View all other issues in [range.slide.view].

View all issues with C++23 status.


It doesn't make sense for slide_view when n is not positive, we should therefore add a precondition for its constructor just like we did for chunk_view.


Indeed the accepted paper describes the intention in P2442R1 Section 4.2 by saying that "It is a precondition that N is positive" in the design wording but omitted to add a normative precondition in the proposed wording.

[2022-06-21; Reflector poll]

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

[2022-07-15; LWG telecon: move to Ready]

[2022-07-25 Approved at July 2022 virtual plenary. Status changed: Ready → WP.]

Proposed resolution:

This wording is relative to N4910.

  1. Modify [range.slide.view] as indicated:

    constexpr explicit slide_view(V base, range_difference_t<V> n);

    -?- Preconditions: n > 0 is true.

    -1- Effects: Initializes base_ with std::move(base) and n_ with n.