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.

3708. take_while_view::sentinel's conversion constructor should move

Section: 26.7.11.3 [range.take.while.sentinel] Status: C++23 Submitter: Hewill Kang Opened: 2022-06-03 Last modified: 2023-11-22

Priority: Not Prioritized

View all issues with C++23 status.

Discussion:

The conversion constructor of take_while_view::sentinel requires sentinel_t<V> must satisfy convertible_to<sentinel_t<Base>>, which indicates that the rvalue reference of sentinel_t<V> can be converted to sentinel_t<Base>, but in the Effects element, we assign the lvalue s.end_ to end_.

[2022-06-21; Reflector poll]

Set status to Tentatively Ready after seven 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 26.7.11.3 [range.take.while.sentinel] as indicated:

    constexpr sentinel(sentinel<!Const> s)
      requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
    

    -2- Effects: Initializes end_ with std::move(s.end_) and pred_ with s.pred_.