[diff.cpp23.containers] (original) (raw)

Affected subclause: [span.overview]

Change: span<const T> is constructible from initializer_list<T>.

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>); void one(span<const int>); void t1() { one({1, 2}); } void two(span<const int, 2>);void t2() { two({{1, 2}}); } void *a[10];int x = span<void* const>{a, 0}.size(); any b[10];int y = span<const any>{b, b + 10}.size(); — _end example_]