Title
Missing preconditions for take_view constructor
Status
new
Section
[range.take.view]
Submitter
Hewill Kang

Created on 2022-07-15.00:00:00 last changed 4 weeks ago

Messages

Date: 2022-07-16.16:33:08

Proposed resolution:

This wording is relative to N4910.

  1. Modify [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.

Date: 2022-07-15.00:00:00

When V does not model sized_range, take_view::begin returns counted_iterator(ranges::begin(base_), count_). Since the counted_iterator constructor ([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.

History
Date User Action Args
2022-07-16 16:33:08adminsetmessages: + msg12592
2022-07-15 00:00:00admincreate