Skip to content

Commit bc7be69

Browse files
authored
Merge 2026-03 LWG Motion 24
P4144R1 Remove `span`'s `initializer_list` constructor for C++26
2 parents d8a9f8f + dbd1b00 commit bc7be69

3 files changed

Lines changed: 0 additions & 51 deletions

File tree

source/compatibility.tex

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -275,32 +275,6 @@
275275
Valid \CppXXIII{} code that calls \tcode{realloc}
276276
with a non-null pointer and a size of zero is erroneous and may change behavior.
277277

278-
\rSec2[diff.cpp23.containers]{\ref{containers}: containers library}
279-
280-
\diffref{span.overview}
281-
\change
282-
\tcode{span<const T>} is constructible from \tcode{initializer_list<T>}.
283-
\rationale
284-
Permit passing a braced initializer list to a function taking \tcode{span}.
285-
\effect
286-
Valid \CppXXIII{} code that relies on the lack of this constructor
287-
may refuse to compile, or change behavior in this revision of \Cpp{}.
288-
\begin{example}
289-
\begin{codeblock}
290-
void one(pair<int, int>); // \#1
291-
void one(span<const int>); // \#2
292-
void t1() { one({1, 2}); } // ambiguous between \#1 and \#2; previously called \#1
293-
294-
void two(span<const int, 2>);
295-
void t2() { two({{1, 2}}); } // ill-formed; previously well-formed
296-
297-
void *a[10];
298-
int x = span<void* const>{a, 0}.size(); // \tcode{x} is \tcode{2}; previously \tcode{0}
299-
any b[10];
300-
int y = span<const any>{b, b + 10}.size(); // \tcode{y} is \tcode{2}; previously \tcode{10}
301-
\end{codeblock}
302-
\end{example}
303-
304278
\rSec2[diff.cpp23.strings]{\ref{strings}: strings library}
305279

306280
\diffref{string.conversions}

source/containers.tex

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20402,8 +20402,6 @@
2040220402

2040320403
\indexheader{span}%
2040420404
\begin{codeblock}
20405-
#include <initializer_list> // see \ref{initializer.list.syn}
20406-
2040720405
// mostly freestanding
2040820406
namespace std {
2040920407
// constants
@@ -20487,7 +20485,6 @@
2048720485
constexpr span(const array<T, N>& arr) noexcept;
2048820486
template<class R>
2048920487
constexpr explicit(extent != dynamic_extent) span(R&& r);
20490-
constexpr explicit(extent != dynamic_extent) span(std::initializer_list<value_type> il);
2049120488
constexpr span(const span& other) noexcept = default;
2049220489
template<class OtherElementType, size_t OtherExtent>
2049320490
constexpr explicit(@\seebelow@) span(const span<OtherElementType, OtherExtent>& s) noexcept;
@@ -20748,27 +20745,6 @@
2074820745
What and when \tcode{ranges::data(r)} and \tcode{ranges::size(r)} throw.
2074920746
\end{itemdescr}
2075020747

20751-
\indexlibraryctor{span}%
20752-
\begin{itemdecl}
20753-
constexpr explicit(extent != dynamic_extent) span(std::initializer_list<value_type> il);
20754-
\end{itemdecl}
20755-
20756-
\begin{itemdescr}
20757-
\pnum
20758-
\constraints
20759-
\tcode{is_const_v<element_type>} is \tcode{true}.
20760-
20761-
\pnum
20762-
\hardexpects
20763-
If \tcode{extent} is not equal to \tcode{dynamic_extent},
20764-
then \tcode{il.size() == extent} is \tcode{true}.
20765-
20766-
\pnum
20767-
\effects
20768-
Initializes \exposid{data_} with \tcode{il.data()} and
20769-
\exposid{size_} with \tcode{il.size()}.
20770-
\end{itemdescr}
20771-
2077220748
\indexlibraryctor{span}%
2077320749
\begin{itemdecl}
2077420750
constexpr span(const span& other) noexcept = default;

source/support.tex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,6 @@
842842
#define @\defnlibxname{cpp_lib_smart_ptr_owner_equality}@ 202306L // also in \libheader{memory}
843843
#define @\defnlibxname{cpp_lib_source_location}@ 201907L // freestanding, also in \libheader{source_location}
844844
#define @\defnlibxname{cpp_lib_span}@ 202311L // freestanding, also in \libheader{span}
845-
#define @\defnlibxname{cpp_lib_span_initializer_list}@ 202311L // freestanding, also in \libheader{span}
846845
#define @\defnlibxname{cpp_lib_spanstream}@ 202106L // also in \libheader{iosfwd}, \libheader{spanstream}
847846
#define @\defnlibxname{cpp_lib_ssize}@ 201902L // freestanding, also in \libheader{iterator}
848847
#define @\defnlibxname{cpp_lib_sstream_from_string_view}@ 202306L // also in \libheader{sstream}

0 commit comments

Comments
 (0)