Files
2025-10-25 03:02:53 +03:00

1.2 KiB

[diff.cpp23.containers]

Annex C (informative) Compatibility [diff]

C.1 C++ and ISO C++ 2023 [diff.cpp23]

C.1.8 [containers]: containers library [diff.cpp23.containers]

1

#

Affected subclause: [span.overview]

Change: span is constructible from initializer_list.

Rationale: Permit passing a braced initializer list to a function taking span.

Effect on original feature: Valid C++ 2023 code that relies on the lack of this constructor may refuse to compile, or change behavior in this revision of C++.

[Example 1: void one(pair<int, int>); // #1void one(span); // #2void t1() { one({1, 2}); } // ambiguous between #1 and #2; previously called #1void two(span<const int, 2>);void t2() { two({{1, 2}}); } // ill-formed; previously well-formedvoid a[10];int x = span<void const>{a, 0}.size(); // x is 2; previously 0 any b[10];int y = span{b, b + 10}.size(); // y is 2; previously 10 — end example]