-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathP0433R3.html
607 lines (501 loc) · 35.2 KB
/
P0433R3.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<style type="text/css">
.comment { color: #999999; font-style: italic; }
.pre { color: #000099; }
.string { color: #009900; }
.char { color: #009900; }
.float { color: #996600; }
.int { color: #999900; }
.bool { color: #000000; font-weight: bold; }
.type { color: #FF6633; }
.flow { color: #FF0000; }
.keyword { color: #990000; }
.operator { color: #663300; font-weight: bold; }
.operator { color: #663300; font-weight: bold; }
pre.code {
border: 2px solid #666;
background-color: #F4F4F4;
padding-left: 10px;
padding-top: 0px;
}
code {
border: 2px solid #d0d0d0;
background-color: LightYellow;
padding: 2px;
padding-left: 10px;
display:table;
white-space:pre;
margin:2px;
margin-bottom:10px;
}
dt {
font-weight: bold;
}
.ins {
background-color:#A0FFA0;
}
.del {
background-color:#FFA0A0;
text-decoration:line-through
}
.TODO {
background-color: LightYellow;
color: red;
}
</style>
<title>Toward a resolution of US7 and US14: Integrating template
deduction for class templates into the standard library</title>
</head>
<body>
<p>Document number: P0433R3 <br>
Date: 2017-06-18<br>
Reply-To:<br>
Mike Spertus, Symantec (<a href="mailto:[email protected]">[email protected]</a>)<br>
Walter E. Brown (<a href="mailto:[email protected]"> [email protected]</a>)<br>
Stephan T. Lavavej (<a href="mailto:[email protected]">[email protected]</a>)<br>
Audience: {Library Evolution, Library} Working Group
</p>
<h1>Toward a resolution of US7 and US14: Integrating template
deduction for class templates into the standard library</h1>
<h2>Introduction</h2>
<p>
National body comments US7 and US14 request analysis of the standard library
to determine what changes might be desirable
in light of the C++17 adoption of <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0091r3.html">P0091R3</a>
(Template argument deduction for class templates (rev. 6)).
The <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0433r2.html">previous revision</a> of this paper describes
the changes that were adopted into the C++17 standard libraries. In this paper, we describe some additional changes
that we believe could improve the feature hope may be considered for adoption as a DR.</p>
Note that, in addition to the proposals in this paper, there
are two LWG issues relating to deduction guides in the standard library that should be addressed in LWG issue processing:
<ol><li><a href="http://cplusplus.github.io/LWG/lwg-active.html#2981">2981. Remove redundant deduction guides from standard library</a></li>
<li><a href="http://cplusplus.github.io/LWG/lwg-active.html#2982">2982. Making <tt>size_type</tt> consistent in associative container deduction guides</a></li></ol>
<h2><tt>scoped_lock</tt> argument order</h2>
As Jonathan Wakely has noted, code like the following does not work:
<code> mutex m;
scoped_lock l(m, adopt_lock);
</code>
The point here is that when the compiler attempts to deduce <tt>scoped_lock<m1, adopt_lock></tt>, there is a
hard error outside the immediate context as <tt>adopt_lock</tt> is not lockable. Note that the same
code works fine if <tt>scoped_lock</tt> is replaced by <tt>lock_guard</tt> because <tt>lock_guard</tt>
does not have a variadic argument. <p>
We recommend fixing this by moving the <tt>adopt_lock_t</tt> parameter to the front of the parameter list. This
was not done originally because <tt>scoped_lock</tt> was originally named <tt>lock_guard</tt> and
had to remain compatible to avoid code breakage, which is no longer a requirement now that <tt>scoped_lock</tt>
is a different class than <tt>lock_guard</tt>. This is useful to fix because it will encourage
programmers to migrate to consistent use of <tt>scoped_lock</tt> rather than choosing one or the other
based on circumstances.
<h3>Wording</h3>
In the definition of <tt>class scoped_lock</tt> in §33.4.4.2 [thread.lock.scoped], make the
following change:
<blockquote><pre> explicit scoped_lock(MutexTypes&... m);
<span class="del">explicit scoped_lock(MutexTypes&... m, adopt_lock_t);</span>
<span class="ins">explicit scoped_lock(adopt_lock_t, MutexTypes&... m);</span>
~scoped_lock();</pre></blockquote>
Likewise, change §33.4.4.2 [thread.lock.scoped] starting immediately before paragraph 4 as follows:
<blockquote><pre><span class="del">explicit scoped_lock(MutexTypes&... m, adopt_lock_t);</span>
<span class="ins">explicit scoped_lock(adopt_lock_t, MutexTypes&... m);</span></pre>
<blockquote><em>Requires:</em> The calling thread owns all the mutexes in <tt>m</tt>.</blockquote></blockquote>
<h2>Enable <tt>variant</tt> support</h2>
The following code fails to compile
<code>variant<int, double> v1(3);
variant v2 = v1; <span class="comment">// Ill-formed!</span></code>
As this natural code is useful and its failure is confusing, we propose that it be supported.
Indeed, prior to the adoption of p0510r0 banning <tt>variant<></tt>,
the above code worked as expected since <tt>variant<></tt> occurs in some deduction
guides in the overload set. As it is not clear that constructor template argument deduction
was considered in adopting p0510r0, we would like to consider allowing <tt>variant<></tt>
not to produce a hard error in such cases.
<h2>Restoring missing container deduction guides</h2>
A number of associative container guides were removed in the late stages of the Kona meeting
when it was realized that the <tt>size_type</tt> member may or may not be a deduced context,
and different compilers handle “most specialized” differently when some candidates
are deducible and others are non-deducible for the same argument (expect a paper on this in the future!).
In addition, construction from allocators was removed from all other containers for consistency.
<p>
Using <tt>size_t</tt> is a nice way to do this (although note that the original concern
may have been an hallucination to begin with), allowing the full set of deduction guides to be restored.
Note that using <tt>size_t</tt> does not assume that the container's <tt>size_type</tt> is <tt>size_t</tt>,
since it is just an integral type being used for overload resolution. We adopt this in the wording below,
which also simplifies and strengthens the existing language. While one could reasonably
argue that constructing from a container is not the most important use case, perhaps a better
argument is that consistently
providing deduction guides to support all of the STL container constructors that make sense
for deduction rather than picking and choosing is less surprising and artificial.
<h3>Wording</h3>
While this wording appears rather long, note that it mainly consists of undoing the removal of
deduction guides that were apparently uncontroversial in prior versions of this paper until the above, now addressed,
concern arose late in the Kona meeting. The only other change is the consistent adoption of <tt>size_t</tt>,
which is a simplification (that also increases robustness)<p>
Add the following deduction guide to the definition of class <tt>basic_string</tt> in
§24.3.2 [basic.string]:
<blockquote><pre> int compare(size_type pos1, size_type n1,
const charT* s, size_type n2) const;
};
<span class="ins">template<typename Allocator>
basic_string(Allocator) -> basic_string<typename Allocator::value_type,
char_traits<typename Allocator::value_type>, Allocator>;
</span></pre></blockquote>
In §24.3.2.2 [string.cons], insert the following:
<blockquote><pre><span class="ins">template<typename Allocator>
basic_string(Allocator) -> basic_string<typename Allocator::value_type,
char_traits<typename Allocator::value_type>, Allocator>;
</span></pre>
<blockquote><span class="ins"><em>Remarks:</em> Shall not participate in overload resolution if <tt>Allocator</tt> is called with a type that does not qualify as an allocator [sequence.reqmts].</span></blockquote></blockquote>
At the end of the definition of class <tt>deque</tt> in §26.3.8.1 [deque.overview], add
the following deduction guides:
<blockquote><pre> void clear() noexcept;
};
<span class="ins">template<class Allocator>
deque(Allocator) -> deque<typename Allocator::value_type, Allocator>;
template<class Allocator>
deque(size_t, Allocator) -> deque<typename Allocator::value_type, Allocator>;</span></pre></blockquote>
At the end of the definition of class <tt>forward_list</tt> in §26.3.9.1 [forwardlist.overview],
add the following deduction guides:
<blockquote><pre> void reverse() noexcept;
};
<span class="ins"> template<class Allocator>
forward_list(Allocator) -> forward_list<typename Allocator::value_type, Allocator>;
template<class Allocator>
forward_list(size_t, Allocator) -> forward_list<typename Allocator::value_type, Allocator>;</span></pre></blockquote>
At the end of the definition of class <tt>list</tt> in §26.3.10.1 [list.overview],
add the following deduction guides:
<blockquote><pre> void reverse() noexcept;
};
<span class="ins"> template<class Allocator>
list(Allocator) -> list<typename Allocator::value_type, Allocator>;
template<class Allocator>
list(size_t, Allocator) -> list<typename Allocator::value_type, Allocator>;</span></pre></blockquote>
At the end of the definition of class <tt>vector</tt> in §26.3.11.1 [vector.overview],
add the following <em>deduction-guide</em>:
<blockquote><pre> void clear() noexcept;
};
<span class="ins"> template<class Allocator>
vector(Allocator) -> vector<typename Allocator::value_type, Allocator>;
template<class Allocator>
vector(size_t, Allocator)
-> vector<typename Allocator::value_type, Allocator>;</span></pre></blockquote>
Add the following to the end of §26.4.1p2 [associative.general]
<blockquote><pre>template<class InputIterator>
using iter_to_alloc_t = pair<add_const_t<typename iterator_traits<InputIterator>::value_type::first_type>,
typename iterator_traits<InputIterator>::value_type::second_type> <span class="comment">// exposition only</span>
<span class="ins">template<class Allocator>
using alloc_key_t = remove_const_t<typename Allocator::value_type::first_type>; <span class="comment">// exposition only</span>
template<class Allocator>
using alloc_val_t = typename Allocator::value_type::second_type; <span class="comment">// exposition only</span></span></pre></blockquote>
At the end of the definition of class <tt>map</tt> in §26.4.4.1 [map.overview],
add the following deduction guides:
<blockquote><pre> pair<const_iterator, const_iterator> equal_range(const K& x) const;
};
<span class="ins"> template<class Compare, class Allocator>
map(Compare, Allocator)
-> map<alloc_key_t<Allocator>, alloc_val_t<Allocator>, Compare, Allocator>;</span>
template <class InputIterator,
class Compare = less<iter_key_t<InputIterator>>,
class Allocator = allocator<iter_to_alloc_t<InputIterator>>>
map(InputIterator, InputIterator, Compare = Compare(), Allocator = Allocator())
-> map<iter_key_t<InputIterator>, iter_val_t<InputIterator>, Compare, Allocator>;
<span class="ins"> template<class Allocator>
map(Allocator)
-> map<alloc_key_t<Allocator>, alloc_val_t<Allocator>,
less<alloc_key_t<Allocator>>, Allocator>;</span></pre></blockquote>
At the end of the definition of class <tt>multimap</tt> in §26.4.4.1 [multimap.overview],
add the following deduction guides:
<blockquote><pre> pair<const_iterator, const_iterator> equal_range(const K& x) const;
};
<span class="ins"> template<class Compare, class Allocator>
multimap(Compare, Allocator)
-> multimap<alloc_key_t<Allocator>, alloc_val_t<Allocator>, Compare, Allocator>;</span>
template <class InputIterator,
class Compare = less<iter_key_t<InputIterator>>,
class Allocator = allocator<iter_to_alloc_t<InputIterator>>>
multimap(InputIterator, InputIterator, Compare = Compare(), Allocator = Allocator())
-> multimap<iter_key_t<InputIterator>, iter_val_t<InputIterator>, Compare, Allocator>;
<span class="ins"> template<class Allocator>
multimap(Allocator)
-> multimap<alloc_key_t<Allocator>, alloc_val_t<Allocator>,
less<alloc_key_t<Allocator>>, Allocator>;</span></pre></blockquote>
At the end of the definition of class <tt>set</tt> in §26.4.6.1 [set.overview],
add the following <em>deduction-guide</em>s:
<blockquote><pre> template <class K>
pair<const_iterator, const_iterator> equal_range(const K& x) const;
};
<span class="ins"> template<class Compare, class Allocator>
set(Compare, Allocator)
-> set<typename Allocator::value_type, Compare, Allocator>;</span>
template <class InputIterator,
class Compare = less<typename iterator_traits<InputIterator>::value_type>,
class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
set(InputIterator, InputIterator,
Compare = Compare(), Allocator = Allocator())
-> set<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>;
<span class="ins"> template<class Allocator>
set(Allocator)
-> set<typename Allocator::value_type, less<typename Allocator::value_type>, Allocator%gt;;</span></pre></blockquote>
At the end of the definition of class <tt>multiset</tt> in §27.4.6.1 [multiset.overview],
add the following deduction guides:
<blockquote><pre> template <class K>
pair<const_iterator, const_iterator> equal_range(const K& x) const;
};
<span class="ins"> template<class Compare, class Allocator>
multiset(Compare, Allocator)
-> multiset<typename Allocator::value_type, Compare, Allocator>;</span>
template <class InputIterator,
class Compare = less<typename iterator_traits<InputIterator>::value_type>,
class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
multiset(InputIterator, InputIterator,
Compare = Compare(), Allocator = Allocator())
-> multiset<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>;
<span class="ins"> template<class Allocator>
multiset(Allocator)
-> multiset<typename Allocator::value_type, less<typename Allocator::value_type>, Allocator>;</span></pre></blockquote>
Modify §26.5.1p2 [unord.general] as follows:
<blockquote>The exposition-only alias templates <tt>iter_key_t</tt>, <tt>iter_val_t</tt>, <span class="ins"><tt>alloc_key_t</tt>, <tt>alloc_val_t</tt>,</span> and <tt>iter_to_alloc_t</tt> defined in 26.4.1 may
appear in deduction guides for unordered containers.</blockquote>
Modify §26.5.4.1 [unord.map.overview],
add the following <em>deduction-guide</em>s:
<blockquote><pre> void reserve(size_type n);
};
<span class="ins"> template<class Hash, class Pred, class Allocator>
unordered_map(size_t, Hash, Pred, Allocator)
-> unordered_map<alloc_key_t<Allocator>, alloc_val_t<Allocator>,
Hash, Pred, Allocator>;</span>
template<class InputIterator,
class Hash = hash<iter_key_t<InputIterator>>, class Pred = equal_to<iter_key_t<InputIterator>>,
class Allocator = allocator<iter_to_alloc_t<InputIterator>>>
unordered_map(InputIterator, InputIterator, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span> = <span class="comment">see below</span>,
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
-> unordered_map<iter_key_t<InputIterator>, iter_value_t<InputIterator>, Hash, Pred, Allocator>;
<span class="ins"> template<class Allocator>
unordered_map(Allocator)
-> unordered_map<alloc_key_t<Allocator>, alloc_val_t<Allocator>,
hash<alloc_key_t<Allocator>>, equal_to<alloc_key_t<Allocator>>, Allocator>;</span>
template<class Key, class T, class Hash = hash<Key>,
class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>>
unordered_map(initializer_list<pair<const Key, T>>, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span> = <span class="comment">see below</span>,
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
-> unordered_map<Key, T, Hash, Pred, Allocator>;
<span class="ins"> template<class Allocator>
unordered_map(size_t, Allocator)
-> unordered_map<alloc_key_t<Allocator>, alloc_val_t<Allocator>,
hash<alloc_key_t<Allocator>>, equal_to<alloc_key_t<Allocator>>, Allocator>;
template<class Hash, class Allocator>
unordered_map(size_t, Hash, Allocator)
-> unordered_map<alloc_key_t<Allocator>, alloc_val_t<Allocator>,
Hash, equal_to<alloc_key_t<Allocator>>, Allocator>;</span>
template<class InputIterator, class Allocator>
unordered_map(InputIterator, InputIterator, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Allocator)
-> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>,
hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>;
template<class InputIterator, class Allocator>
unordered_map(InputIterator, InputIterator, Allocator)
-> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>,
hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>;
template<class InputIterator, class Hash, class Allocator>
unordered_map(InputIterator, InputIterator, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Hash, Allocator)
-> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>, Hash,
equal_to<iter_key_t<InputIterator>>, Allocator>;
template<class Key, class T, typename Allocator>
unordered_map(initializer_list<pair<const Key, T>>, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Allocator)
-> unordered_map<Key, T, hash<Key>, equal_to<Key>, Allocator>;
template<class Key, class T, typename Allocator>
unordered_map(initializer_list<pair<const Key, T>>, Allocator)
-> unordered_map<Key, T, hash<Key>, equal_to<Key>, Allocator>;
template<class Key, class T, class Hash, class Allocator>
unordered_map(initializer_list<pair<const Key, T>>, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Hash, Allocator)
-> unordered_map<Key, T, Hash, equal_to<Key>, Allocator>;</pre></blockquote>
Delete §26.5.4.1p4 [unord.map.overview]:
<blockquote><span class="del">A <tt>size_type</tt> parameter type in an <tt>unordered_map</tt> deduction
guide refers to the <tt>size_type</tt> member type of the type deduced by the deduction guide.</span></blockquote>
Modify §26.5.5.1 [unord.map.overview],
add the following <em>deduction-guide</em>s:
<blockquote><pre> void reserve(size_type n);
};
<span class="ins"> template<class Hash, class Pred, class Allocator>
unordered_multimap(size_t, Hash, Pred, Allocator)
-> unordered_multimap<alloc_key_t<Allocator>, alloc_val_t<Allocator>,
Hash, Pred, Allocator>;</span>
template<class InputIterator,
class Hash = hash<iter_key_t<InputIterator>>, class Pred = equal_to<iter_key_t<InputIterator>>,
class Allocator = allocator<iter_to_alloc_t<InputIterator>>>
unordered_multimap(InputIterator, InputIterator, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span> = <span class="comment">see below</span>,
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
-> unordered_multimap<iter_key_t<InputIterator>, iter_value_t<InputIterator>, Hash, Pred, Allocator>;
<span class="ins"> template<class Allocator>
unordered_multimap(Allocator)
-> unordered_multimap<alloc_key_t<Allocator>, alloc_val_t<Allocator>,
hash<alloc_key_t<Allocator>>, equal_to<alloc_key_t<Allocator>>, Allocator>;</span>
template<class Key, class T, class Hash = hash<Key>,
class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>>
unordered_multimap(initializer_list<pair<const Key, T>>, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span> = <span class="comment">see below</span>,
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
-> unordered_multimap<Key, T, Hash, Pred, Allocator>;
<span class="ins"> template<class Allocator>
unordered_multimap(size_t, Allocator)
-> unordered_multimap<alloc_key_t<Allocator>, alloc_val_t<Allocator>,
hash<alloc_key_t<Allocator>>, equal_to<alloc_key_t<Allocator>>, Allocator>;
template<class Hash, class Allocator>
unordered_multimap(size_t, Hash, Allocator)
-> unordered_multimap<alloc_key_t<Allocator>, alloc_val_t<Allocator>,
Hash, equal_to<alloc_key_t<Allocator>>, Allocator>;</span>
template<class InputIterator, class Allocator>
unordered_multimap(InputIterator, InputIterator, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Allocator)
-> unordered_multimap<iter_key_t<InputIterator>, iter_val_t<InputIterator>,
hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>;
template<class InputIterator, class Allocator>
unordered_multimap(InputIterator, InputIterator, Allocator)
-> unordered_multimap<iter_key_t<InputIterator>, iter_val_t<InputIterator>,
hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>;
template<class InputIterator, class Hash, class Allocator>
unordered_multimap(InputIterator, InputIterator, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Hash, Allocator)
-> unordered_multimap<iter_key_t<InputIterator>, iter_val_t<InputIterator>, Hash,
equal_to<iter_key_t<InputIterator>>, Allocator>;
template<class Key, class T, typename Allocator>
unordered_multimap(initializer_list<pair<const Key, T>>, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Allocator)
-> unordered_multimap<Key, T, hash<Key>, equal_to<Key>, Allocator>;
template<class Key, class T, typename Allocator>
unordered_multimap(initializer_list<pair<const Key, T>>, Allocator)
-> unordered_multimap<Key, T, hash<Key>, equal_to<Key>, Allocator>;
template<class Key, class T, class Hash, class Allocator>
unordered_multimap(initializer_list<pair<const Key, T>>, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Hash, Allocator)
-> unordered_multimap<Key, T, Hash, equal_to<Key>, Allocator>;</pre></blockquote>
Delete §26.5.5.1p4 [unord.multimap.overview]:
<blockquote><span class="del">A <tt>size_type</tt> parameter type in an <tt>unordered_multimap</tt> deduction
guide refers to the <tt>size_type</tt> member type of the type deduced by the deduction guide.</span></blockquote>
Modify §26.5.6.1 [unord.set.overview] as follows:
<blockquote><pre> void reserve(size_type n);
};
<span class="ins"> template<class Hash, class Pred, class Allocator>
unordered_set(size_t, Hash, Pred, Allocator)
-> unordered_set<typename Allocator::value_type, Hash, Pred, Allocator>;</span>
template<class InputIterator,
class Hash = hash<typename iterator_traits<InputIterator>::value_type>,
class Pred = equal_to<typename iterator_traits<InputIterator>::value_type>,
class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
unordered_set(InputIterator, InputIterator, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span> = <em>see below</em>,
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
-> unordered_set<typename iterator_traits<InputIterator>::value_type,
Hash, Pred, Allocator>;
template<class T, class Hash = hash<T>,
class Pred = equal_to<T>, class Allocator = allocator<T>>
unordered_set(initializer_list<T>, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span> = <em>see below</em>,
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
-> unordered_set<T, Hash, Pred, Allocator>;
<span class="ins"> template<class Allocator>
unordered_set(<span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Allocator)
-> unordered_set<typename Allocator::value_type, hash<typename Allocator::value_type>,
equal_to<typename Allocator::value_type>, Allocator>;
template<class Hash, class Allocator>
unordered_set(<span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Hash, Allocator)
-> unordered_set<typename Allocator::value_type, Hash,
equal_to<typename Allocator::value_type>, Allocator>;</span>
template<class InputIterator, class Allocator>
unordered_set(InputIterator, InputIterator, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Allocator)
-> unordered_set<typename iterator_traits<InputIterator>::value_type,
hash<typename iterator_traits<InputIterator>::value_type>,
equal_to<typename iterator_traits<InputIterator>::value_type>,
Allocator>;
template<class InputIterator, class Hash, class Allocator>
unordered_set(InputIterator, InputIterator, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>,
Hash, Allocator)
-> unordered_set<typename iterator_traits<InputIterator>::value_type, Hash,
equal_to<typename iterator_traits<InputIterator>::value_type>,
Allocator>;
template<class T, class Allocator>
unordered_set(initializer_list<T>, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Allocator)
-> unordered_set<T, hash<T>, equal_to<T>, Allocator>;
template<class T, class Hash, class Allocator>
unordered_set(initializer_list<T>, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Hash, Allocator)
-> unordered_set<T, Hash, equal_to<T>, Allocator>;
</pre></blockquote>
Delete §26.5.6.1p4 [unord.set.overview]:
<blockquote><span class="del">A <tt>size_type</tt> parameter type in an <tt>unordered_set</tt> deduction
guide refers to the <tt>size_type</tt> member type of the primary <tt>unordered_set</tt> template.</span></blockquote>
xxx
Modify §26.5.7.1 [unord.multiset.overview] as follows:
<blockquote><pre> void reserve(size_type n);
};
<span class="ins"> template<class Hash, class Pred, class Allocator>
unordered_multiset(size_t, Hash, Pred, Allocator)
-> unordered_multiset<typename Allocator::value_type, Hash, Pred, Allocator>;</span>
template<class InputIterator,
class Hash = hash<typename iterator_traits<InputIterator>::value_type>,
class Pred = equal_to<typename iterator_traits<InputIterator>::value_type>,
class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
unordered_multiset(InputIterator, InputIterator, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span> = <em>see below</em>,
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
-> unordered_multiset<typename iterator_traits<InputIterator>::value_type,
Hash, Pred, Allocator>;
template<class T, class Hash = hash<T>,
class Pred = equal_to<T>, class Allocator = allocator<T>>
unordered_multiset(initializer_list<T>, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span> = <em>see below</em>,
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
-> unordered_multiset<T, Hash, Pred, Allocator>;
<span class="ins"> template<class Allocator>
unordered_multiset(<span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Allocator)
-> unordered_multiset<typename Allocator::value_type, hash<typename Allocator::value_type>,
equal_to<typename Allocator::value_type>, Allocator>;
template<class Hash, class Allocator>
unordered_multiset(<span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Hash, Allocator)
-> unordered_multiset<typename Allocator::value_type, Hash,
equal_to<typename Allocator::value_type>, Allocator>;</span>
template<class InputIterator, class Allocator>
unordered_multiset(InputIterator, InputIterator, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Allocator)
-> unordered_multiset<typename iterator_traits<InputIterator>::value_type,
hash<typename iterator_traits<InputIterator>::value_type>,
equal_to<typename iterator_traits<InputIterator>::value_type>,
Allocator>;
template<class InputIterator, class Hash, class Allocator>
unordered_multiset(InputIterator, InputIterator, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>,
Hash, Allocator)
-> unordered_multiset<typename iterator_traits<InputIterator>::value_type, Hash,
equal_to<typename iterator_traits<InputIterator>::value_type>,
Allocator>;
template<class T, class Allocator>
unordered_multiset(initializer_list<T>, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Allocator)
-> unordered_multiset<T, hash<T>, equal_to<T>, Allocator>;
template<class T, class Hash, class Allocator>
unordered_multiset(initializer_list<T>, <span class="del">typename <span class="comment">see below</span>::size_type</span><span class="ins">size_t</span>, Hash, Allocator)
-> unordered_multiset<T, Hash, equal_to<T>, Allocator>;
</pre></blockquote>
Delete §26.5.7.1p4 [unord.multiset.overview]:
<blockquote><span class="del">A <tt>size_type</tt> parameter type in an <tt>unordered_multiset</tt> deduction
guide refers to the <tt>size_type</tt> member type of the primary <tt>unordered_multiset</tt> template.</span></blockquote>
At the end of the definition of class <tt>queue</tt> in §26.6.4.1 [queue.defn], add the following deduction guide
<blockquote><pre> void swap(queue& q) noexcept(is_nothrow_swappable_v<Container>)
{ using std::swap; swap(c, q.c); }
};
<span class="ins"> template<class Allocator>
queue(Allocator) -> queue<typename Allocator::value_type>;</span></pre></blockquote>
At the end of the definition of class <tt>priority_queue</tt> in §26.6.6.5 [priority.queue], add the
following deduction guides:
<blockquote><pre> void swap(priority_queue& q) noexcept(is_nothrow_swappable_v<Container> &&
is_nothrow_swappable_v<Compare>)
{ using std::swap; swap(c, q.c); swap(comp, q.comp); }
};
<span class="ins"> template<class Allocator>
priority_queue(Allocator) -> priority_queue<typename Allocator::value_type>;
template<class Compare, class Allocator>
priority_queue(Compare, Allocator)
-> priority_queue<typename Allocator::value_type, vector<typename Allocator::value_type>, Compare>;</span>
At the end of the definition of class <tt>stack</tt> in §26.6.6.1 [stack], add the following deduction guide:
<blockquote><pre> void swap(stack& q) noexcept(is_nothrow_swappable_v<Container>)
{ using std::swap; swap(c, q.c); }
};
<span class="ins"> template<class Allocator>
stack(Allocator) -> stack<typename Allocator::value_type>;
</span>
At the end of the
definition of class <tt>promise</tt> in §33.6.6 [futures.promise], insert the following:
<blockquote><pre> <span class="comment">// setting the result with deferred notification</span>
void set_value_at_thread_exit(<em>see below</em>);
void set_exception_at_thread_exit(exception_ptr p);
};
<span class="ins"> template <class Alloc> promise(allocator_arg_t, Alloc)
-> promise<typename Alloc::value_type>;</span>
template <class R>
void swap(promise<R>& x, promise<R>& y) noexcept;
</pre></blockquote>
</body></html>