forked from HowardHinnant/papers
-
Notifications
You must be signed in to change notification settings - Fork 5
/
alloc-aware-optional.html
1638 lines (1494 loc) · 109 KB
/
alloc-aware-optional.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
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>An allocator-aware optional type</title>
<style>
p {text-align:justify}
li {text-align:justify}
blockquote.note
{
background-color:#E0E0E0;
padding-left: 15px;
padding-right: 15px;
padding-top: 1px;
padding-bottom: 1px;
}
tab { padding-left: 2em; }
tab2 { padding-left: 4em; }
ins {background-color:#A0FFA0}
del {background-color:#FFA0A0}
</style>
</head>
<body>
<address align=right>
Document number: dxxxx
<br/>
Audience: LEWG
<br/>
<br/>
<a href="mailto:[email protected]">Ville Voutilainen</a><br/>
<a href="mailto:[email protected]">Nina Dinka Ranns</a><br/>
2019-08-19<br/>
</address>
<hr/>
<h1 align=center>An allocator-aware optional type</h1>
<h2>Abstract</h2>
<p>
This is a proposal for an allocator-aware optional type. For users
that use custom allocators, such a type is currently missing;
pair and tuple support allocators, but an optional type is also
deemed necessary, because some such users use optional types
as container elements. Therefore, an allocator-aware optional
type is necessary for the usual scoped-allocator use cases to work.
</p>
<p>
In this proposal, we propose a separate optional type that
works with a polymorphic allocator. The allocator is not
part of the type in the sense that it's not a template parameter.
</p>
<h2>Rationale for a separate type</h2>
<p>
An allocator-aware optional needs to store the allocator used
for object creation. This is because an optional can be disengaged
and re-engaged, so it needs to 'remember' the allocator used
when it's re-engaged. Storing an allocator incurs space overhead,
so we wish to avoid that overhead for types that are not allocator-aware.
Therefore, we are not proposing changing std::optional, but instead
adding a new std::pmr::optional that can handle allocator-aware
types.
</p>
<h2>Rationale for using polymorphic allocators only</h2>
<p>
The rationale for polymorphic allocators applies here in general.
Allocator-aware optionals are interoperable even if they use
different concrete allocators, because the concrete allocator
doesn't change the type, nor does it change the size of the type.
</p>
<h2>In general, some remarks about triviality</h2>
<p>
We propose std::pmr::optional being an alias template; if the element
of the optional is not allocator-aware, the alias template aliases
std::optional. Otherwise, it aliases an unspecified type that
adds allocator parameters to optional's constructor overload set.
</p>
<p>
When prototyping this proposal, we realized that an allocator-aware
optional is never trivially copyable. Copy constructor and copy
assignment always potentially invoke the allocator; these operations
are never bitwise copies. Move operations aren't trivial either, because
they may also end up doing uses-allocator construction.
</p>
<p>
This was an implementation-based reason for having an allocator-aware
type separate from the usual optional. All the complexity of conditional
triviality is in std::optional, and std::pmr::optional's allocator-aware
alias target has none of that. The interface of std::optional doesn't
have allocator parameters, whereas the interface of the allocator-aware
concrete optional always has them available.
</p>
<h2>Feedback item for LEWG: should the general alias and the
concrete allocator-aware optional type both be exposed?</h2>
<p>
This proposal doesn't expose the concrete allocator-aware optional
type. std::pmr::optional aliases it, and we specify it, but we don't
name it. Chances are that some users might want to use it as a named
type, in order to reason about their code. Furthermore, it's somewhat
questionable whether std::pmr::optional<AllocAware> and
std::pmr::optional<AllocUnaware> should even share a name; the APIs
are different, the semantics are different.
</p>
<p>
The reason why we chose to do it the current proposed way is that
practical users just want one vocabulary type that either does or
doesn't do allocators, depending on the element type's properties.
The users we've talked to didn't see much value in having a type
that is always allocator-aware; instead, it's allocator-aware when
it can be, and otherwise not.
</p>
<h2>Proposed wording</h2>
<p>
Add new paragraphs after 20.6.1/p1 [optional.general]
</p>
<p> <blockquote>
<ins>
[2] <tt>pmr::optional</tt> is an alias template such that for a type <tt>T</tt>, where
<tt>uses_allocator<T, polymorphic_allocator<>></tt> is true, <tt>pmr::optional<T></tt>
denotes a type which will construct the contained object with an allocator of type <tt>polymorphic_allocator<></tt>.
Otherwise, the alias template denotes <tt>std::optional</tt>. </ins></p></blockquote>
<br/>
<p>Modify 20.6.2 Header <optional> synopsisl [optional.syn] </p>
<p>
<blockquote>
<br/>namespace std {
<br/><tab/> // [optional.optional], class template optional
<br/><tab/> template<classT>
<br/><tab2/>class optional;
<ins>
<br/> }
<br/>namespace pmr {
<br/><tab/> // [alloc-optional.pmroptional], class template <i>alloc-optional</i>
<br/><tab/> template<classT>
<br/><tab2/>class <i>alloc-optional</i>;
<br/><tab></tab> template<typename T>
<br/><tab2></tab2> using optional = conditional_t<uses_allocator<T, polymorphic_allocator<>>::value,
<br/><tab2/><tab2/><i>alloc-optional</i><T> , std::optional<T>>;
<br/> }
<br/>namespace std {
</ins>
<br/> ...
</blockquote>
<p>Modify 20.6.3 Class template optional [optional.optional] </p>
<p>
<blockquote>
// [optional.ctor], constructors
...
<ins>
<br/><tab/> template<class U>
<br/><tab2/> explicit(see below) optional(const pmr::<i>alloc-optional</i><U>&);
<br/><tab/> template<class U>
<br/><tab2/> explicit(see below) optional(pmr::<i>alloc-optional</i><U>&&);
</ins>
...
// [optional.assign], assignment
...
<ins>
<br/><tab/> template<class U> optional& operator=(const <i>alloc-optional</i>&);
<br/><tab/> template<class U> optional& operator=(<i>alloc-optional</i>&&) noexcept(see below);
</ins>
</blockquote>
</p>
<p>Modify 20.6.3.1 Constructors [optional.ctor] </p>
<p>
<blockquote>
<p>
<br/><code>template<class U> explicit(see below) optional(const optional<U>& v);</code>
...
<br/><tab/><i>Remarks:</i> This constructor shall not participate in overload resolution unless
<br/><tab2/> - <tt>is_constructible_v<T, optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_constructible_v<T, optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_constructible_v<T, const optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_constructible_v<T, const optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_convertible_v<optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_convertible_v<<i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_convertible_v<optional<U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_convertible_v<<i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_convertible_v<const optional<U>&, T></tt> is <tt>false</tt>, <del>and</del>
<br/><tab2/><ins> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_convertible_v<const optional<U>&&, T></tt> is <tt>false</tt>,<ins>and</ins>
<br/><tab2/><ins> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt> </ins>
...
</p>
<p>
<br/><code>template<class U> explicit(see below) optional(optional<U>&& v);</code>
...
<br/><tab/><i>Remarks:</i> This constructor shall not participate in overload resolution unless
<br/><tab2/> - <tt>is_constructible_v<T, optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_constructible_v<T, optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_constructible_v<T, const optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_constructible_v<T, const optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_convertible_v<optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_convertible_v<<i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_convertible_v<optional<U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_convertible_v<<i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_convertible_v<const optional<U>&, T></tt> is <tt>false</tt>, <del>and</del>
<br/><tab2/><ins> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_convertible_v<const optional<U>&&, T></tt> is <tt>false</tt>, <ins>and</ins>
<br/><tab2/><ins> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt> </ins>
...
</p>
...
<p>
<ins>
<br/>
<br/><code>template<class U> explicit(see below) optional(const <i>alloc-optional</i><U>& rhs);</code>
<br/><tab/><i>Effects:</i> If <tt>rhs</tt> contains a value, initializes the contained value
as if direct-non-list-initializing an object of type <tt>T</tt> with the expression <tt>*rhs</tt>.
<br/><tab/><i>Ensures:</i> <tt>bool(rhs) == bool(*this)</tt>.
<br/><tab/><i>Throws:</i> Any exception thrown by the selected constructor of <tt>T</tt>.
<br/><tab/><i>Remarks:</i> This constructor shall not participate in overload resolution unless
<br/><tab2/> - <tt>is_constructible_v<T, const U&></tt> is <tt>true</tt>,
<br/><tab2/> - <tt>is_same<T,U></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<<i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<optional<U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<<i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const optional<U>&&, T></tt> is <tt>false</tt>, and
<br/><tab2/> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>
<br/><tab/>The expression inside <tt>explicit</tt> is equivalent to:
<br/><tab2/><tt>!is_convertible_v<const U&, T></tt>
<br/>
<br/>
<br/><code>template<class U> explicit(see below) optional(<i>alloc-optional</i><U>&& rhs);</code>
<br/><tab/><i>Effects:</i> If <tt>rhs</tt> contains a value, initializes the contained value
as if direct-non-list-initializing an object of type <tt>T</tt> with the expression <tt>std::move(*rhs)</tt>.
<tt>std::move(*rhs)</tt> as the constructor argument. <tt>bool(rhs)</tt> is unchanged.
<br/><tab/><i>Ensures:</i> <tt>bool(rhs) == bool(*this)</tt>.
<br/><tab/><i>Throws:</i> Any exception thrown by the selected constructor of <tt>T</tt>.
<br/><tab/><i>Remarks:</i> This constructor shall not participate in overload resolution unless
<br/><tab2/> - <tt>is_constructible_v<T,U&&></tt> is <tt>true</tt>,
<br/><tab2/> - <tt>is_same<T,U></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<<i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<optional<U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<<i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const optional<U>&&, T></tt> is <tt>false</tt>, and
<br/><tab2/> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>
<br/><tab/>The expression inside <tt>explicit</tt> is equivalent to:
<br/><tab2/><tt>!is_convertible_v<U, T></tt>
<br/>
</p>
</ins></blockquote>
<p>Modify 20.6.3.3 Assignment [optional.assign] </p>
<p>
<blockquote>
...
<br/><tt>template<class U> optional& operator=(const optional<U>& rhs);</tt>
...
<br/><tab/><i>Remarks:</i> ...
This operator shall not participate in overload resolution unless
<br/><tab2/> - <tt>is_constructible_v<T, const U&></tt> is <tt>true</tt>,
<br/><tab2/> - <tt>is_assignable<T&, const U&></tt> is <tt>true</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_constructible_v<T, optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_constructible_v<T, const optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_constructible_v<T, const optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_convertible_v<optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_convertible_v<<i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_convertible_v<optional<U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_convertible_v<<i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_convertible_v<const optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_convertible_v<const optional<U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_assignable_v<T&, optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_assignable_v<T&, <i>alloc-optional</i><U>&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_assignable_v<T&, optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_assignable_v<T&, <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_assignable_v<T&, const optional<U>&></tt> is <tt>false</tt>, <del>and</del>
<br/><tab2/><ins> - <tt>is_assignable_v<T&, const <i>alloc-optional</i><U>&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_assignable_v<T&, const optional<U>&&></tt> is <tt>false</tt>,<ins>and</ins>
<br/><tab2/><ins> - <tt>is_assignable_v<T&, const <i>alloc-optional</i><U>&&></tt> is <tt>false</tt> </ins>
</blockquote>
</p>
<p>
<blockquote>
<br/><tt>template<class U> optional& operator=(optional<U>&& rhs);</tt>
...
<br/><tab/><i>Remarks:</i> ...
This operator shall not participate in overload resolution unless
<br/><tab2/> - <tt>is_constructible_v<T, const U&></tt> is <tt>true</tt>,
<br/><tab2/> - <tt>is_assignable<T&, const U&></tt> is <tt>true</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_constructible_v<T, optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_constructible_v<T, const optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_constructible_v<T, const optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_convertible_v<optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_convertible_v<<i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_convertible_v<optional<U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_convertible_v<<i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_convertible_v<const optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_convertible_v<const optional<U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_assignable_v<T&, optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_assignable_v<T&, <i>alloc-optional</i><U>&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_assignable_v<T&, optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/><ins> - <tt>is_assignable_v<T&, <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_assignable_v<T&, const optional<U>&></tt> is <tt>false</tt>, <del>and</del>
<br/><tab2/><ins> - <tt>is_assignable_v<T&, const <i>alloc-optional</i><U>&></tt> is <tt>false</tt>, </ins>
<br/><tab2/> - <tt>is_assignable_v<T&, const optional<U>&&></tt> is <tt>false</tt>,<ins>and</ins>
<br/><tab2/><ins> - <tt>is_assignable_v<T&, const <i>alloc-optional</i><U>&&></tt> is <tt>false</tt> </ins>
</blockquote>
</p>
<blockquote><ins>
<br/>
<br/><tt>template<class U> optional& operator=(const <i>alloc-optional</i><U>& rhs);</tt>
<br/><tab/><i>Effects:</i> See Table
<blockquote>
<table border="1">
<caption><ins>Table — <tt>optional operator=(const <i>alloc-optional</i><U>&)</tt> effects</ins></caption>
<tr>
<th></th>
<th><ins><tt>*this</tt> contains a value</ins></th>
<th><ins><tt>*this</tt> does not contain a value</ins></th>
</tr>
<tr>
<td><ins><tt>rhs</tt> contains a value</ins></td>
<td><ins>assigns <tt>*rhs</tt> to the contained value</ins></td>
<td><ins>initializes the contained value as if direct-non-list-initializing an object of type <tt>T</tt> with <tt>*rhs</tt>.</ins></td>
</tr>
<tr>
<td><ins><tt>rhs</tt> does not contain a value</ins></td>
<td><ins>destroys the contained value by calling <tt>val->T::~T()</tt></ins></td>
<td><ins>no effect</ins></td>
</tr>
</table></blockquote>
<br/><tab/><i>Returns:</i> <tt>*this</tt>.
<br/><tab/><i>Ensures:</i> <tt>bool(rhs) == bool(*this)</tt>.
<br/><tab/><i>Remarks:</i> If any exception is thrown, the result of the expression <tt>bool(*this)</tt>
remains unchanged. If an exception is thrown during the call to <tt>T</tt>'s constructor,
the state of <tt>*rhs.val</tt> is determined by the exception safety guarantee of <tt>T</tt>'s constructor.
If an exception is thrown during the call to <tt>T</tt>'s assignment, the state of <tt>*val</tt> and <tt>*rhs.val</tt> is
determined by the exception safety guarantee of <tt>T</tt>'s assignment.
This operator shall not participate in overload resolution unless
<br/><tab2/> - <tt>is_same<T,U></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const U&></tt> is <tt>true</tt>,
<br/><tab2/> - <tt>is_assignable<T&, const U&></tt> is <tt>true</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const U&, T></tt> is <tt>true</tt>,
<br/><tab2/> - <tt>is_convertible_v<optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<<i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<optional<U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<<i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const optional<U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_assignable_v<T&, optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_assignable_v<T&, <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_assignable_v<T&, optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_assignable_v<T&, <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_assignable_v<T&, const optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_assignable_v<T&, const <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_assignable_v<T&, const optional<U>&&></tt> is <tt>false</tt>, and
<br/><tab2/> - <tt>is_assignable_v<T&, const <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>
<br/>
<br/><tt>template<class U> optional& operator=(<i>alloc-optional</i><U>&& rhs);</tt>
<br/><tab/><i>Effects:</i> See Table
<blockquote>
<table border="1">
<caption><ins>Table — <tt>optional operator=(<i>alloc-optional</i><U>&&)</tt> effects</ins></caption>
<tr>
<th></th>
<th><ins><tt>*this</tt> contains a value</ins></th>
<th><ins><tt>*this</tt> does not contain a value</ins></th>
</tr>
<tr>
<td><ins><tt>rhs</tt> contains a value</ins></td>
<td><ins>assigns <tt>*rhs</tt> to the contained value</ins></td>
<td><ins>initializes the contained value as if direct-non-list-initializing an object of type <tt>T</tt> with <tt>std::move(*rhs)</tt></ins></td>
</tr>
<tr>
<td><ins><tt>rhs</tt> does not contain a value</ins></td>
<td><ins>destroys the contained value by calling <tt>val->T::~T()</tt></ins></td>
<td><ins>no effect</ins></td>
</tr>
</table></blockquote>
<br/><tab/><i>Returns:</i> <tt>*this</tt>.
<br/><tab/><i>Ensures:</i> <tt>bool(rhs) == bool(*this)</tt>.
<br/><tab/><i>Remarks:</i> If any exception is thrown, the result of the expression <tt>bool(*this)</tt>
remains unchanged. If an exception is thrown during the call to <tt>T</tt>'s constructor,
the state of <tt>*rhs.val</tt> is determined by the exception safety guarantee of <tt>T</tt>'s constructor.
If an exception is thrown during the call to <tt>T</tt>'s assignment, the state of <tt>*val</tt> and <tt>*rhs.val</tt> is
determined by the exception safety guarantee of <tt>T</tt>'s assignment.
This operator shall not participate in overload resolution unless
<br/><tab2/> - <tt>is_constructible_v<T, const U&></tt> is <tt>true</tt>,
<br/><tab2/> - <tt>is_assignable<T&, const U&></tt> is <tt>true</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, std::optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, std::optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const std::optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const std::optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const U&, T></tt> is <tt>true</tt>,
<br/><tab2/> - <tt>is_convertible_v<std::optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<<i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<std::optional<U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<<i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const std::optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const std::optional<U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_assignable_v<T&, std::optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_assignable_v<T&, <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_assignable_v<T&, std::optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_assignable_v<T&, <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_assignable_v<T&, const std::optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_assignable_v<T&, const <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_assignable_v<T&, const std::optional<U>&&></tt> is <tt>false</tt>, and
<br/><tab2/> - <tt>is_assignable_v<T&, const <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>
</ins></blockquote>
<p>
Insert new sections after 20.6.3 Class template optional [optional.optional]
</p>
<ins>
<p><h3><ins> Header <pmroptional> synopsis [pmroptional.sys]</pmroptional></ins></h3>
<blockquote><ins><code>
namespace pmr {
<br/><tab/> // [alloc-optional.optional], class template <t><i>alloc-optional</i></t> for exposition only
<br/><tab/> template<class T>
<br/><tab2/> class <i>alloc-optional</i>;
<br/>
<br/><tab/> // [optional.relops], relational operators
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator==(const <i>alloc-optional</i><T>&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator==(const <i>alloc-optional</i><T>&, const std::optional<U>&);
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator==(const std::optional<T>&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator!=(const <i>alloc-optional</i><T>&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator!=(const <i>alloc-optional</i><T>&, const std::optional<U>&);
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator!=(const std::optional<T>&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator<(const <i>alloc-optional</i><T>&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator<(const <i>alloc-optional</i><T>&, const std::optional<U>&);
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator<(const std::optional<T>&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator>(const <i>alloc-optional</i><T>&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator>(const <i>alloc-optional</i><T>&, const std::optional<U>&);
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator>(const std::optional<T>&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator<=(const <i>alloc-optional</i><T>&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator<=(const <i>alloc-optional</i><T>&, const std::optional<U>&);
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator<=(const std::optional<T>&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator>=(const <i>alloc-optional</i><T>&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator>=(const <i>alloc-optional</i><T>&, const std::optional<U>&);
<br/><tab/> template<class T, class U>
<br/><tab2/> bool operator>=(const std::optional<T>&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, three_way_comparable_with<T> U>
<br/><tab2/> compare_three_way_result_t<T,U>
<br/><tab/><tab2/> operator<=>(const <i>alloc-optional</i><T>&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, three_way_comparable_with<T> U>
<br/><tab2/> compare_three_way_result_t<T,U>
<br/><tab/><tab2/> operator<=>(const <i>alloc-optional</i><T>&, const std::optional<U>&);
<br/><tab/> template<class T, three_way_comparable_with<T> U>
<br/><tab2/> compare_three_way_result_t<T,U>
<br/><tab/><tab2/> operator<=>(const std::optional<T>&, const <i>alloc-optional</i><U>&);
<br/>
<br/><tab/> // [<i>alloc-optional</i>.nullops], comparison with nullopt
<br/><tab/> template<class T> bool operator==(const <i>alloc-optional</i><T>&, nullopt_t) noexcept;
<br/><tab/> template<class T>
<br/><tab2/> strong_ordering operator<=>(const <i>alloc-optional</i><T>&, nullopt_t) noexcept;
<br/>
<br/><tab/> // [<i>alloc-optional</i>.comp.with.t], comparison with T
<br/><tab/> template<class T, class U> bool operator==(const <i>alloc-optional</i><T>&, const U&);
<br/><tab/> template<class T, class U> bool operator==(const T&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, class U> bool operator!=(const <i>alloc-optional</i><T>&, const U&);
<br/><tab/> template<class T, class U> bool operator!=(const T&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, class U> bool operator<(const <i>alloc-optional</i><T>&, const U&);
<br/><tab/> template<class T, class U> bool operator<(const T&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, class U> bool operator>(const <i>alloc-optional</i><T>&, const U&);
<br/><tab/> template<class T, class U> bool operator>(const T&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, class U> bool operator<=(const <i>alloc-optional</i><T>&, const U&);
<br/><tab/> template<class T, class U> bool operator<=(const T&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, class U> bool operator>=(const <i>alloc-optional</i><T>&, const U&);
<br/><tab/> template<class T, class U> bool operator>=(const T&, const <i>alloc-optional</i><U>&);
<br/><tab/> template<class T, three_way_comparable_with<T> U>
<br/><tab2/> compare_three_way_result_t<T,U>
<br/><tab/><tab2/> operator<=>(const <i>alloc-optional</i><T>&, const U&);
<br/>
<br/><tab/> // [<i>alloc-optional</i>.specalg], specialized algorithms
<br/><tab/> template<class T>
<br/><tab2/> void swap(<i>alloc-optional</i><T>&, <i>alloc-optional</i><T>&) noexcept(see below);
<br/>
<br/><tab/> template<class T>
<br/><tab2/> constexpr optional<<i/>see below</i>> make_optional(T&&);
<br/><tab/> template<class T, class... Args>
<br/><tab2/> constexpr optional<T> make_optional(Args&&... args);
<br/><tab/> template<class T, class U, class... Args>
<br/><tab2/> constexpr optional<T> make_optional(initializer_list<U> il, Args&&... args);
<br/>
<br/><tab/> template<class T>
<br/><tab2/> constexpr optional<<i/>see below</i>> alloc_optional(const polymorphic_allocator<>& a, T&&);
<br/><tab/> template<class T, class... Args>
<br/><tab2/> constexpr optional<T> alloc_optional(const polymorphic_allocator<>& a, Args&&... args);
<br/><tab/> template<class T, class U, class... Args>
<br/><tab2/> constexpr optional<T> alloc_optional(const polymorphic_allocator<>& a, initializer_list<U> il, Args&&... args);
<br/>
<br/><tab/> // [<i>alloc-optional</i>.hash], hash support
<br/><tab/> template<class T> struct hash<<i>alloc-optional</i><T>>;
<br/>}
<!--
<br/> namespace std {
<br/><tab/> template<typename T>
<br/><tab2/> struct uses_allocator<<i>alloc-optional</i><T>, pmr::polymorphic_allocator<>>
<br/><tab2/><tab/> : public uses_allocator<T, pmr::polymorphic_allocator<>>::type { };
<br/>}
-->
</code></ins></blockquote></p>
<p><h3><ins> Class template <i>alloc-optional</i> [<i>alloc-optional</i>.pmroptional]</ins></h3></p>
<p>
<blockquote><ins>
<code>
namespace std::pmr {
<br/><tab/> template<class T>
<br/><tab/> class <i>alloc-optional</i> {
<br/><tab/> public:
<br/><tab2/> using value_type = T;
<br/><tab2/> using allocator_type = std::pmr::polymorphic_allocator<>;
<br/>
<br/><tab2/> // [<i>alloc-optional</i>.ctor], constructors
<br/><tab2/><i>alloc-optional</i>() noexcept;
<br/><tab2/><i>alloc-optional</i>(nullopt_t) noexcept;
<br/><tab2/><i>alloc-optional</i>(const <i>alloc-optional</i>&);
<br/><tab2/><i>alloc-optional</i>(<i>alloc-optional</i>&&) noexcept(see below);
<br/><tab2/>template<class... Args>
<br/><tab2/><tab/>explicit <i>alloc-optional</i>(in_place_t, Args&&...);
<br/><tab2/>template<class U, class... Args>
<br/><tab2/><tab/>explicit <i>alloc-optional</i>(in_place_t, initializer_list<U>, Args&&...);
<br/><tab2/>template<class U = T>
<br/><tab2/><tab/>explicit(see below) <i>alloc-optional</i>(U&&);
<br/><tab2/>template<class U>
<br/><tab2/><tab/>explicit(see below) <i>alloc-optional</i>(const <i>alloc-optional</i><U>&);
<br/><tab2/>template<class U>
<br/><tab2/><tab/>explicit(see below) <i>alloc-optional</i>(<i>alloc-optional</i><U>&&);
<br/><tab2/>template<class U>
<br/><tab2/><tab/>explicit(see below) <i>alloc-optional</i>(const std::optional<U>&);
<br/><tab2/>template<class U>
<br/><tab2/><tab/>explicit(see below) <i>alloc-optional</i>(std::optional<U>&&);
<br/>
<br/><tab2/>// allocator-extended constructors
<br/><tab2/><i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&) noexcept;
<br/><tab2/><i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&, nullopt_t) noexcept;
<br/><tab2/><i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&, const <i>alloc-optional</i>&);
<br/><tab2/><i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&, <i>alloc-optional</i>&&) noexcept(see below);
<br/><tab2/>template<class... Args>
<br/><tab2/><tab/>explicit <i>alloc-optional</i>(in_place_t, allocator_arg_t, const polymorphic_allocator<>&, Args&&...);
<br/><tab2/>template<class U, class... Args>
<br/><tab2/><tab/>explicit <i>alloc-optional</i>(in_place_t, allocator_arg_t, const polymorphic_allocator<>&, initializer_list<U>, Args&&...);
<br/><tab2/>template<class U = T>
<br/><tab2/><tab/>explicit(see below) <i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&,U&&);
<br/><tab2/>template<class U>
<br/><tab2/><tab/>explicit(see below) <i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&,const <i>alloc-optional</i><U>&);
<br/><tab2/>template<class U>
<br/><tab2/><tab/>explicit(see below) <i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&,<i>alloc-optional</i><U>&&);
<br/><tab2/>template<class U>
<br/><tab2/><tab/>explicit(see below) <i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&,const std::optional<U>&);
<br/><tab2/>template<class U>
<br/><tab2/><tab/>explicit(see below) <i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&,std::optional<U>&&);
<br/>
<br/><tab2/> // [<i>alloc-optional</i>.dtor], destructor
<br/><tab2/> ~<i>alloc-optional</i>();
<br/>
<br/><tab2/> // [<i>alloc-optional</i>.assign], assignment
<br/><tab2/> <i>alloc-optional</i>& operator=(nullopt_t) noexcept;
<br/><tab2/> <i>alloc-optional</i>& operator=(const <i>alloc-optional</i>&);
<br/><tab2/> <i>alloc-optional</i>& operator=(<i>alloc-optional</i>&&) noexcept(see below);
<br/><tab2/> template<class U = T> <i>alloc-optional</i>& operator=(U&&);
<br/><tab2/> template<class U> <i>alloc-optional</i>& operator=(const <i>alloc-optional</i><U>&);
<br/><tab2/> template<class U> <i>alloc-optional</i>& operator=(<i>alloc-optional</i><U>&&);
<br/><tab2/> template<class U> <i>alloc-optional</i>& operator=(const std::optional<U>&);
<br/><tab2/> template<class U> <i>alloc-optional</i>& operator=(std::optional<U>&&);
<br/><tab2/> template<class... Args>> T& emplace(Args&&...);
<br/><tab2/> template<class U, class... Args> T& emplace(initializer_list<U>, Args&&...);
<br/>
<br/><tab2/> // [<i>alloc-optional</i>.swap], swap
<br/><tab2/> void swap(<i>alloc-optional</i>&) noexcept(see below);
<br/>
<br/><tab2/> // [<i>alloc-optional</i>.observe], observers
<br/><tab2/> const T* operator->() const;
<br/><tab2/> T* operator->();
<br/><tab2/> const T& operator*() const&;
<br/><tab2/> T& operator*() &;
<br/><tab2/> T&& operator*() &&;
<br/><tab2/> const T&& operator*() const&&;
<br/><tab2/> explicit operator bool() const noexcept;
<br/><tab2/> bool has_value() const noexcept;
<br/><tab2/> const T& value() const&;
<br/><tab2/> T& value() &;
<br/><tab2/> T&& value() &&;
<br/><tab2/> const T&& value() const&&;
<br/><tab2/> template<class U> T value_or(U&&) const&;
<br/><tab2/> template<class U> T value_or(U&&) &&;
<br/><tab2/> allocator_type get_allocator() const noexcept;
<br/>
<br/><tab2/> // [<i>alloc-optional</i>.mod], modifiers
<br/><tab2/> void reset() noexcept;
<br/>
<br/><tab2/> private:
<br/><tab2/><tab/> T* val; // exposition only
<br/><tab2/><tab/> const std::memory_resource* M_pmr; // exposition only
<br/><tab/> };
<br/>
<br/>/* todo CTAD */
<br/>
<br/>}
</code>
</blockquote></ins></p>
<blockquote><ins>Any instance of <i>alloc-optional</i><T> at any given time either contains a value or does not contain a value.
When an instance of <i>alloc-optional</i><T> contains a value, it means that an object of type <tt>T</tt>,
referred to as the <i>alloc-optional</i> object's contained value,
is allocated within the storage of the <i>alloc-optional</i> object. Implementations are not permitted to use
additional storage, such as dynamic memory, to allocate its contained value. The contained value shall be allocated in a
region of the <i>alloc-optional</i><T> storage suitably aligned for the type <tt>T</tt> and constructed using <tt>M_pmr</tt>.
When an object of type <i>alloc-optional</i><T> is contextually
converted to bool, the conversion returns true if the object contains a value; otherwise the conversion returns false.
</ins></blockquote>
<blockquote><ins>Member <tt>val</tt> is provided for exposition only. When an <i>alloc-optional</i><T>
object contains a value, val points to the contained value.
</ins></blockquote>
<blockquote><ins>Member <tt>M_pmr</tt> is provided for exposition only and points to the memory_resource used when
creating the contained value. If the value type provides <tt>get_allocator()</tt> member function, and its return type is
convertible to <tt>polymorphic_allocator<></tt>, the implementation is
allowed to assume that the allocator used for constructing the element is the same allocator as returned
by <tt>T::get_allocator()</tt>. [<i>Note:</i> In such an implementation, <tt>pmr::optional<pmr::string></tt>
will be zero-overhead compared to <tt>optional<pmr::string></tt>. -- <i>end note</i>]
</ins></blockquote>
<blockquote><ins><tt>T</tt> shall be a type other than <tt><i>cv</i> in_place_t</tt>, <tt><i>cv</i> allocator_arg_t</tt>, or <tt><i>cv</i> nullopt_t</tt>
that meets the <i>Cpp17Destructible</i> requirements (Table 30).</ins></blockquote>
<p><h4><ins> Constructors [<i>alloc-optional</i>.ctor]</ins></h4></p>
<p><blockquote><ins>
<br/><code><i>alloc-optional</i>() noexcept;</code>
<br/><code><i>alloc-optional</i>(nullopt_t) noexcept;</code>
<br/><tab/><i>Effects:</i><tt>M_pmr</tt> is initialized with <tt>std::pmr::get_default_resource()</tt>
<br/><tab/><i>Ensures:</i> *this does not contain a value.
<br/><tab/><i>Remarks:</i> No contained value is initialized.
<br/>
<br/><code><i>alloc-optional</i>(const <i>alloc-optional</i>&);</code>
<br/><tab/><i>Effects:</i> <tt>M_pmr</tt> is initialized with <tt>rhs.M_pmr</tt>.
If <tt>rhs</tt> contains a value, initializes the contained value
with the expression <tt>*rhs</tt>.
<br/><tab/><i>Ensures:</i> <tt>bool(rhs) == bool(*this)</tt>.
<br/><tab/><i>Throws:</i> Any exception thrown by the selected constructor of <tt>T</tt>.
<br/><tab/><i>Remarks:</i> This constructor shall be defined as deleted unless <tt>is_copy_constructible_v<T></tt> is true.
<br/>
<br/><code><i>alloc-optional</i>(<i>alloc-optional</i>&& rhs) noexcept(see below)</code>
<br/><tab/><i>Effects:</i> <tt>M_pmr</tt> is initialized with <tt>rhs.M_pmr</tt>.
If <tt>rhs</tt> contains a value, initializes the contained value
with the expression <tt>std::move(*rhs)</tt>. <tt>bool(rhs)</tt> is unchanged.
<br/><tab/><i>Ensures:</i> <tt>bool(rhs) == bool(*this)</tt>.
<br/><tab/><i>Throws:</i> Any exception thrown by the selected constructor of <tt>T</tt>.
<br/><tab/><i>Remarks:</i> The expression inside <tt>noexcept</tt> is equivalent to <tt>is_nothrow_move_constructible_v<T></tt>.
This constructor shall not participate in overload resolution unless <tt>is_move_constructible_v<T></tt> is true.
<br/>
<br/><code>template<class... Args> explicit <i>alloc-optional</i>(in_place_t, Args&&... args);</code>
<br/><tab/><i>Effects:</i> <tt>M_pmr</tt> is initialized with <tt>std::pmr::get_default_resource()</tt>.
If <tt>rhs</tt> contains a value, initializes the contained value by uses-allocator construction
with allocator <tt>polymorphic_allocator<>(_M_pmr)</tt> and
<tt>std::forward<Args>(args)....</tt> as the constructor arguments.
<br/><tab/><i>Ensures:</i> <tt>*this</tt> contains a value..
<br/><tab/><i>Throws:</i> Any exception thrown by the selected constructor of <tt>T</tt>.
<br/><tab/><i>Remarks:</i> This constructor shall not participate in overload resolution unless <tt>is_copy_constructible_v<T></tt> is true.
<br/>
<br/><code>template<class... Args> explicit <i>alloc-optional</i>(in_place_t, initializer_list<U> il, Args&&... args);</code>
<br/><tab/><i>Effects:</i> <tt>M_pmr</tt> is initialized with <tt>std::pmr::get_default_resource()</tt>.
If <tt>rhs</tt> contains a value, initializes the contained value by uses-allocator construction
with allocator <tt>polymorphic_allocator<>(_M_pmr)</tt> and
<tt>il, std::forward<Args>(args)....</tt> as the constructor arguments.
<br/><tab/><i>Ensures:</i> <tt>*this</tt> contains a value..
<br/><tab/><i>Throws:</i> Any exception thrown by the selected constructor of <tt>T</tt>.
<br/><tab/><i>Remarks:</i> This constructor shall not participate in overload resolution unless
<tt>is_constructible_v<T, initializer_list<U>&, Args&&...></tt> is true.
<br/>
<br/><code>template<class U = T> explicit(see below) <i>alloc-optional</i>(U&& rhs);</code>
<br/><tab/><i>Effects:</i> <tt>M_pmr</tt> is initialized with <tt>std::pmr::get_default_resource()</tt>.
If <tt>rhs</tt> contains a value, initializes the contained value by uses-allocator construction
with allocator <tt>polymorphic_allocator<>(_M_pmr)</tt> and
<tt> std::forward<U>(rhs)</tt> as the constructor arguments.
<br/><tab/><i>Ensures:</i> <tt>*this</tt> contains a value.
<br/><tab/><i>Throws:</i> Any exception thrown by the selected constructor of <tt>T</tt>.
<br/><tab/><i>Remarks:</i> This constructor shall not participate in overload resolution unless
<br/><tab2/> - <tt>is_constructible_v<T, U&&></tt> is <tt>true</tt>,
<br/><tab2/> - <tt>is_same_v<remove_cvref_t<U>, in_place_t></tt>
is <tt>false</tt>, and
<br/><tab2/> - <tt>is_same_v<remove_cvref_t<U>,<i>alloc-optional</i>></tt> is <tt>false</tt>.
<br/><tab/>The expression inside <tt>explicit</tt> is equivalent to:
<br/><tab2/><tt>!is_convertible_v<U, T></tt>
<br/>
<br/><code>template<class U> explicit(see below) <i>alloc-optional</i>(const <i>alloc-optional</i><U>& rhs);</code>
<br/><tab/><i>Effects:</i> <tt>M_pmr</tt> is initialized with <tt>std::pmr::get_default_resource()</tt>.
If <tt>rhs</tt> contains a value, initializes the contained value by uses-allocator construction
with allocator <tt>polymorphic_allocator<>(_M_pmr)</tt> and
<tt>*rhs</tt> as the constructor argument.
<br/><tab/><i>Ensures:</i> <tt>bool(rhs) == bool(*this)</tt>.
<br/><tab/><i>Throws:</i> Any exception thrown by the selected constructor of <tt>T</tt>.
<br/><tab/><i>Remarks:</i> This constructor shall not participate in overload resolution unless
<br/><tab2/> - <tt>is_constructible_v<T, const U&></tt> is <tt>true</tt>,
<br/><tab2/> - <tt>is_same<T,U></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, std::optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, std::optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const std::optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const std::optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<std::optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<<i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<std::optional<U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<<i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const std::optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const std::optional<U>&&, T></tt> is <tt>false</tt>, and
<br/><tab2/> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>
<br/><tab/>The expression inside <tt>explicit</tt> is equivalent to:
<br/><tab2/><tt>!is_convertible_v<const U&, T></tt>
<br/>
<br/>
<br/><code>template<class U> explicit(see below) <i>alloc-optional</i>(<i>alloc-optional</i><U>&& rhs);</code>
<br/><tab/><i>Effects:</i> <tt>M_pmr</tt> is initialized with <tt>std::pmr::get_default_resource()</tt>.
If <tt>rhs</tt> contains a value, initializes the contained value by uses-allocator construction
with allocator <tt>polymorphic_allocator<>(_M_pmr)</tt> and
<tt>std::move(*rhs)</tt> as the constructor argument. <tt>bool(rhs)</tt> is unchanged.
<br/><tab/><i>Ensures:</i> <tt>bool(rhs) == bool(*this)</tt>.
<br/><tab/><i>Throws:</i> Any exception thrown by the selected constructor of <tt>T</tt>.
<br/><tab/><i>Remarks:</i> This constructor shall not participate in overload resolution unless
<br/><tab2/> - <tt>is_constructible_v<T,U&&></tt> is <tt>true</tt>,
<br/><tab2/> - <tt>is_same<T,U></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, std::optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, std::optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const std::optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const std::optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<std::optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<<i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<std::optional<U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<<i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const std::optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const std::optional<U>&&, T></tt> is <tt>false</tt>, and
<br/><tab2/> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>
<br/><tab/>The expression inside <tt>explicit</tt> is equivalent to:
<br/><tab2/><tt>!is_convertible_v<U, T></tt>
<br/>
<br/>
<br/><code>template<class U> explicit(see below) <i>alloc-optional</i>(const std::optional<U>& rhs);</code>
<br/><tab/><i>Effects:</i> <tt>M_pmr</tt> is initialized with <tt>std::pmr::get_default_resource()</tt>.
If <tt>rhs</tt> contains a value, initializes the contained value by uses-allocator construction
with allocator <tt>polymorphic_allocator<>(_M_pmr)</tt> and
<tt>*rhs</tt> as the constructor argument.
<br/><tab/><i>Ensures:</i> <tt>bool(rhs) == bool(*this)</tt>.
<br/><tab/><i>Throws:</i> Any exception thrown by the selected constructor of <tt>T</tt>.
<br/><tab/><i>Remarks:</i> This constructor shall not participate in overload resolution unless
<br/><tab2/> - <tt>is_constructible_v<T, const U&></tt> is <tt>true</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, std::optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, std::optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const std::optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const std::optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<std::optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<<i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<std::optional<U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<<i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const std::optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const std::optional<U>&&, T></tt> is <tt>false</tt>, and
<br/><tab2/> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>
<br/><tab/>The expression inside <tt>explicit</tt> is equivalent to:
<br/><tab2/><tt>!is_convertible_v<const U&, T></tt>
<br/>
<br/>
<br/><code>template<class U> explicit(see below) <i>alloc-optional</i>(std::optional<U>&& rhs);</code>
<br/><tab/><i>Effects:</i> <tt>M_pmr</tt> is initialized with <tt>std::pmr::get_default_resource()</tt>.
If <tt>rhs</tt> contains a value, initializes the contained value by uses-allocator construction
with allocator <tt>polymorphic_allocator<>(_M_pmr)</tt> and
<tt>std::move(*rhs)</tt> as the constructor argument. <tt>bool(rhs)</tt> is unchanged.
<br/><tab/><i>Ensures:</i> <tt>bool(rhs) == bool(*this)</tt>.
<br/><tab/><i>Throws:</i> Any exception thrown by the selected constructor of <tt>T</tt>.
<br/><tab/><i>Remarks:</i> This constructor shall not participate in overload resolution unless
<br/><tab2/> - <tt>is_constructible_v<T,U&&></tt> is <tt>true</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, std::optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, std::optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const std::optional<U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const std::optional<U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_constructible_v<T, const <i>alloc-optional</i><U>&&></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<std::optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<<i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<std::optional<U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<<i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const std::optional<U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&, T></tt> is <tt>false</tt>,
<br/><tab2/> - <tt>is_convertible_v<const std::optional<U>&&, T></tt> is <tt>false</tt>, and
<br/><tab2/> - <tt>is_convertible_v<const <i>alloc-optional</i><U>&&, T></tt> is <tt>false</tt>
<br/><tab/>The expression inside <tt>explicit</tt> is equivalent to:
<br/><tab2/><tt>!is_convertible_v<U, T></tt>
<br/>
<br/>
<code>
<br/><i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&) noexcept;
<br/><i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&, nullopt_t) noexcept;
<br/><i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&, const <i>alloc-optional</i>&);
<br/><i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&, <i>alloc-optional</i>&&) noexcept(see below);
<br/>template<class... Args>
<br/><tab/>explicit <i>alloc-optional</i>(in_place_t, allocator_arg_t, const polymorphic_allocator<>&, Args&&...);
<br/>template<class U, class... Args>
<br/><tab/>explicit <i>alloc-optional</i>(in_place_t, allocator_arg_t, const polymorphic_allocator<>&, initializer_list<U>, Args&&...);
<br/>template<class U = T>
<br/><tab/>explicit(see below) <i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&,U&&);
<br/>template<class U>
<br/><tab/>explicit(see below) <i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&,const <i>alloc-optional</i><U>&);
<br/>template<class U>
<br/><tab/>explicit(see below) <i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&,<i>alloc-optional</i><U>&&);
<br/>template<class U>
<br/><tab/>explicit(see below) <i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&,const std::optional<U>&);
<br/>template<class U>
<br/><tab/>explicit(see below) <i>alloc-optional</i>(allocator_arg_t, const polymorphic_allocator<>&,std::optional<U>&&);
</code>
<br/><tab/><i>Constraints:</i> <tt>uses_allocator<T,polymorphic_allocator<>></tt> is true;
<br/><tab/><i>Effects:</i> Equivalent to the preceding constructors except that <tt>M_pmr</tt> is initialized with <tt>a.resource()</tt>.
</blockquote></ins></p>
<p><h4><ins> Destructor [<i>alloc-optional</i>.dtor]</ins></h4></p>
<blockquote><ins>
<br/><tt>~<i>alloc-optional</i>();</tt>
<br/><tab/><i>Effects:</i> If <tt>is_trivially_destructible_v<T> != true</tt> and <tt>*this</tt> contains a value, calls
<tt>val->T::~T()</tt>
<br/><tab/><i>Remarks:</i> If <tt>is_trivially_destructible_v<T></tt> is <tt>true</tt>, then this destructor is trivial.
</ins></blockquote>
<p><h4><ins> Assignment [<i>alloc-optional</i>.assign]</ins></h4></p>
<blockquote><ins>
<br/><tt><i>alloc-optional</i><T>& operator=(nullopt_t) noexcept;</tt>
<br/><tab/><i>Effects:</i> If <tt>*this</tt> contains a value, calls <tt>val->T::~T()</tt> to destroy the contained value; otherwise
no effect.
<br/><tab/><i>Remarks:</i> <tt>*this</tt>
<br/><tab/><i>Ensures:</i> <tt>*this</tt> does not contain a value.
<br/>
<br/><tt><i>alloc-optional</i><T>& operator=(const <i>alloc-optional</i>& rhs);</tt>
<br/><tab/><i>Effects:</i> See Table
<blockquote><table border="1">
<caption><ins>Table — <tt><i>alloc-optional</i> operator=(const <i>alloc-optional</i>& rhs)</tt> effects</ins></caption>
<tr>
<th></th>
<th><ins><tt>*this</tt> contains a value</ins></th>
<th><ins><tt>*this</tt> does not contain a value</ins></th>
</tr>
<tr>
<td><ins><tt>rhs</tt> contains a value</ins></td>
<td><ins>assigns <tt>*rhs</tt> to the contained value</ins></td>
<td><ins>initializes the contained value by uses-allocator construction
with allocator <tt>polymorphic_allocator<>(_M_pmr)</tt> and
<tt>*rhs</tt> as the constructor argument.</ins></td>
</tr>
<tr>
<td><ins><tt>rhs</tt> does not contain a value</ins></td>
<td><ins>destroys the contained value by calling <tt>val->T::~T()</tt></ins></td>
<td><ins>no effect</ins></td>
</tr>
</table></blockquote>
<br/><tab/><i>Returns:</i> <tt>*this</tt>.
<br/><tab/><i>Ensures:</i> <tt>bool(rhs) == bool(*this)</tt>.
<br/><tab/><i>Remarks:</i> If any exception is thrown, the result of the expression <tt>bool(*this)</tt> remains unchanged.
If an exception is thrown during the call to <tt>T</tt>'s copy constructor, no effect. If an exception is thrown during the
call to <tt>T</tt>'s copy assignment, the state of of its contained value is as defined by the exception safety guarantee of
is determined by the exception safety guarantee of <tt>T</tt>'s copy assignment.
This operator shall be defined as deleted unless <tt>is_copy_constructible_v<T></tt> is <tt>true</tt> and
<tt>is_copy_assignable_v<T></tt> is <tt>true</tt>.
<br/>
<br/><tt><i>alloc-optional</i><T>& operator=(<i>alloc-optional</i>&& rhs) noexcept(<i>see below</i>);</tt>
<br/><tab/><i>Effects:</i> See Table
<blockquote>
<table border="1">
<caption><ins>Table — <tt><i>alloc-optional</i> operator=(<i>alloc-optional</i>&& rhs)</tt> effects</ins></caption>
<tr>
<th></th>
<th><ins><tt>*this</tt> contains a value</ins></th>
<th><ins><tt>*this</tt> does not contain a value</ins></th>
</tr>
<tr>
<td><ins><tt>rhs</tt> contains a value</ins></td>
<td><ins>assigns <tt>std::move(*rhs)</tt> to the contained value</ins></td>
<td><ins>initializes the contained value by uses-allocator construction
with allocator <tt>polymorphic_allocator<>(_M_pmr)</tt> and <tt>std::move(*rhs)</tt> as the constructor argument.</ins></td>
</tr>