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.

3738. Missing preconditions for take_view constructor

Section: 26.7.10.2 [range.take.view] Status: WP Submitter: Hewill Kang Opened: 2022-07-15 Last modified: 2022-11-17

Priority: Not Prioritized

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

View all issues with WP status.

Discussion:

When V does not model sized_range, take_view::begin returns counted_iterator(ranges::begin(base_), count_). Since the counted_iterator constructor (25.5.7.2 [counted.iter.const]) already has a precondition that n >= 0, we should add this to take_view as well, which is consistent with drop_view.

[2022-08-23; Reflector poll]

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

[2022-11-12 Approved at November 2022 meeting in Kona. Status changed: Voting → WP.]

Proposed resolution:

This wording is relative to N4910.

  1. Modify 26.7.10.2 [range.take.view] as indicated:

    constexpr take_view(V base, range_difference_t<V> count);
    

    -?- Preconditions: count >= 0 is true.

    -1- Effects: Initializes base_ with std::move(base) and count_ with count.