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.

4079. Missing Preconditions in concat_view::iterator's conversion constructor

Section: 26.7.18.3 [range.concat.iterator] Status: WP Submitter: Hewill Kang Opened: 2024-04-26 Last modified: 2024-07-08

Priority: Not Prioritized

View other active issues in [range.concat.iterator].

View all other issues in [range.concat.iterator].

View all issues with WP status.

Discussion:

This conversion constructor obtains the alternative iterator of the argument through std::get, which will throw when the variant is valueless. We seem to be missing a Preconditions element here.

[2024-05-08; Reflector poll]

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

[St. Louis 2024-06-29; Status changed: Voting → WP.]

Proposed resolution:

This wording is relative to N4981.

  1. Modify 26.7.18.3 [range.concat.iterator] as indicated:

    constexpr iterator(iterator<!Const> it)
      requires Const &&
               (convertible_to<iterator_t<Views>, iterator_t<const Views>> && ...);
    

    -?- Preconditions: it.it_.valueless_by_exception() is false.

    -8- Effects: Initializes parent_ with it.parent_, and let i be it.it_.index(), initializes it_ with base-iter(in_place_index<i>, std::get<i>(std::move(it.it_))).