4131. Including <optional> doesn't provide std::begin/end

Section: 24.7 [iterator.range] Status: New Submitter: Hewill Kang Opened: 2024-08-02 Last modified: 2024-08-21

Priority: 3

View other active issues in [iterator.range].

View all other issues in [iterator.range].

View all issues with New status.

Discussion:

Since optional now provides begin/end members, it is reasonable to ensure the validity of std::begin/end after including <optional>.

[2024-08-21; Reflector poll]

Set priority to 3 after reflector poll.

"I would like to hear opinion of P3168 authors, or have the change discussed as a part of P3016.

Proposed resolution:

This wording is relative to N4986.

  1. Modify 24.7 [iterator.range] as indicated:

    -1- In addition to being available via inclusion of the <iterator> header, the function templates in 24.7 [iterator.range] are available when any of the following headers are included: <array> (23.3.2 [array.syn]), <deque> (23.3.4 [deque.syn]), <flat_map> (23.6.7 [flat.map.syn]), <flat_set> (23.6.10 [flat.set.syn]), <forward_list> (23.3.6 [forward.list.syn]), <inplace_vector> (23.3.13 [inplace.vector.syn]), <list> (23.3.8 [list.syn]), <map> (23.4.2 [associative.map.syn]), <optional> (22.5.2 [optional.syn]), <regex> (28.6.3 [re.syn]), <set> (23.4.5 [associative.set.syn]), <span> (23.7.2.1 [span.syn]), <string> (27.4.2 [string.syn]), <string_view> (27.3.2 [string.view.synop]), <unordered_map> (23.5.2 [unord.map.syn]), <unordered_set> (23.5.5 [unord.set.syn]), and <vector> (23.3.10 [vector.syn]).