|
107 | 107 | // changed according to the global C locale
|
108 | 108 | \end{codeblock}
|
109 | 109 |
|
| 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 | + |
110 | 135 | \rSec2[diff.cpp23.depr]{\ref{depr}: compatibility features}
|
111 | 136 |
|
112 | 137 | \nodiffref
|
|
141 | 166 | The old functionality can be achieved by calling \tcode{shrink_to_fit()} instead,
|
142 | 167 | or the function call can be safely eliminated with no side effects.
|
143 | 168 |
|
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 |
| - |
169 | 169 | \rSec1[diff.cpp20]{\Cpp{} and ISO \CppXX{}}
|
170 | 170 |
|
171 | 171 | \rSec2[diff.cpp20.general]{General}
|
|
0 commit comments