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.

### 3490. `ranges::drop_while_view::begin()` is missing a precondition

Section: 26.7.13.2 [range.drop.while.view] Status: WP Submitter: Michael Schellenberger Costa Opened: 2020-10-13 Last modified: 2021-02-26

Priority: 0

View all other issues in [range.drop.while.view].

View all issues with WP status.

Discussion:

Similar to `ranges::filter_view` 26.7.8.2 [range.filter.view] p3, `ranges::drop_while_view` should have a precondition on its `begin()` method that the predicate is set.

I propose to add as 26.7.13.2 [range.drop.while.view] p3:

>     Preconditions: pred_.has_value().

[2020-11-07; Reflector prioritization]

Set priority to 0 and status to Tentatively Ready after six votes in favour during reflector discussions.

[2021-02-26 Approved at February 2021 virtual plenary. Status changed: Tentatively Ready → WP.]

Proposed resolution:

This wording is relative to N4868.

1. Modify 26.7.13.2 [range.drop.while.view] as indicated:

   > Since we usually don't rely on implicit `bool` conversion in Preconditions: elements an explicit "is `true`" has been added. Editorial fixes of the referenced paragraph 26.7.13.2 [range.drop.while.view] p3 and similar places have been requested separately.

   >     constexpr auto begin();

   > > -?- Preconditions: `pred_.has_value()` is `true`.

   > > -3- Returns: `ranges::find_if_not(base_, cref(*pred_))`.

   > > -4- […]