File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 275275Valid \CppXXIII {} code that calls \tcode {realloc}
276276with a non-null pointer and a size of zero is erroneous and may change behavior.
277277
278- \rSec 2[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\rSec 2[diff.cpp23.strings]{\ref {strings }: strings library}
305279
306280\diffref {string.conversions }
Original file line number Diff line number Diff line change 2040220402
2040320403\indexheader{span}%
2040420404\begin{codeblock}
20405- #include <initializer_list> // see \ref{initializer.list.syn}
20406-
2040720405// mostly freestanding
2040820406namespace std {
2040920407 // constants
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;
2074820745What 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}
2077420750constexpr span(const span& other) noexcept = default;
Original file line number Diff line number Diff line change 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}
You can’t perform that action at this time.
0 commit comments