Skip to content

Commit 568e49f

Browse files
committed
[diff.cpp23] Fix order of subclauses.
This was accidentally broken by the application of the previous motion.
1 parent 8862c9e commit 568e49f

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

source/compatibility.tex

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,31 @@
107107
// changed according to the global C locale
108108
\end{codeblock}
109109

110+
\rSec2[diff.cpp23.containers]{\ref{containers}: containers library}
111+
112+
\diffref{span.overview}
113+
\change
114+
\tcode{span<const T>} is constructible from \tcode{initializer_list<T>}.
115+
\rationale
116+
Permit passing a braced initializer list to a function taking \tcode{span}.
117+
\effect
118+
Valid \CppXXIII{} code that relies on the lack of this constructor
119+
may refuse to compile, or change behavior in this revision of \Cpp{}.
120+
For example:
121+
\begin{codeblock}
122+
void one(pair<int, int>); // \#1
123+
void one(span<const int>); // \#2
124+
void t1() { one({1, 2}); } // ambiguous between \#1 and \#2; previously called \#1
125+
126+
void two(span<const int, 2>);
127+
void t2() { two({{1, 2}}); } // ill-formed; previously well-formed
128+
129+
void *a[10];
130+
int x = span<void* const>{a, 0}.size(); // \tcode{x} is \tcode{2}; previously \tcode{0}
131+
any b[10];
132+
int y = span<const any>{b, b + 10}.size(); // \tcode{y} is \tcode{2}; previously \tcode{10}
133+
\end{codeblock}
134+
110135
\rSec2[diff.cpp23.depr]{\ref{depr}: compatibility features}
111136

112137
\nodiffref
@@ -141,31 +166,6 @@
141166
The old functionality can be achieved by calling \tcode{shrink_to_fit()} instead,
142167
or the function call can be safely eliminated with no side effects.
143168

144-
\rSec2[diff.cpp23.containers]{\ref{containers}: containers library}
145-
146-
\diffref{span.overview}
147-
\change
148-
\tcode{span<const T>} is constructible from \tcode{initializer_list<T>}.
149-
\rationale
150-
Permit passing a braced initializer list to a function taking \tcode{span}.
151-
\effect
152-
Valid \CppXXIII{} code that relies on the lack of this constructor
153-
may refuse to compile, or change behavior in this revision of \Cpp{}.
154-
For example:
155-
\begin{codeblock}
156-
void one(pair<int, int>); // \#1
157-
void one(span<const int>); // \#2
158-
void t1() { one({1, 2}); } // ambiguous between \#1 and \#2; previously called \#1
159-
160-
void two(span<const int, 2>);
161-
void t2() { two({{1, 2}}); } // ill-formed; previously well-formed
162-
163-
void *a[10];
164-
int x = span<void* const>{a, 0}.size(); // \tcode{x} is \tcode{2}; previously \tcode{0}
165-
any b[10];
166-
int y = span<const any>{b, b + 10}.size(); // \tcode{y} is \tcode{2}; previously \tcode{10}
167-
\end{codeblock}
168-
169169
\rSec1[diff.cpp20]{\Cpp{} and ISO \CppXX{}}
170170

171171
\rSec2[diff.cpp20.general]{General}

0 commit comments

Comments
 (0)