This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
4276.front()
and back()
are not hardened for zero-length std::array
s
Section: 23.3.3.5 [array.zero] Status: New Submitter: Jan Schultke Opened: 2025-06-08 Last modified: 2025-06-14
Priority: Not Prioritized
View other active issues in [array.zero].
View all other issues in [array.zero].
View all issues with New status.
Discussion:
The intent of P3471 "Standard library hardening" is clearly to provide hardened preconditions for members of sequence containers, including std::array
. However, a zero-length std::array
dodges this hardening by having undefined behavior for front()
and back()
explicitly specified in 23.3.3.5 [array.zero] paragraph 3.
front()
and back()
would be hardened as well, as specified in 23.2.4 [sequence.reqmts].
Proposed resolution:
This wording is relative to N5008.
Modify 23.3.3.5 [array.zero] as indicated:
-3- The effect of calling
front()
orback()
for a zero-sized array is undefined.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4