-
Notifications
You must be signed in to change notification settings - Fork 20
/
N4123_full.html
2365 lines (1743 loc) · 82.1 KB
/
N4123_full.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>
<!-- Sources at https://github.com/cplusplus/concurrent-ts -->
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"><!--[if lte IE 8]><script>document.createElement("nav");document.createElement("section");document.createElement("time");document.createElement("CXX-TOC");document.createElement("CXX-CLAUSE");document.createElement("CXX-SECTION");document.createElement("CXX-FOREIGN-INDEX");document.createElement("CXX-NOTE");document.createElement("CXX-EDNOTE");document.createElement("CXX-REF");document.createElement("CXX-FUNCTION");document.createElement("CXX-SIGNATURE");document.createElement("CXX-EFFECTS");document.createElement("CXX-POSTCONDITIONS");document.createElement("CXX-REQUIRES");document.createElement("CXX-NOTES");document.createElement("CXX-EXAMPLE");document.createElement("CXX-RETURNS");document.createElement("CXX-REMARKS");document.createElement("CXX-CODEBLOCK");document.createElement("CXX-PUBLISH-BUTTON");</script><![endif]--><style>template {display: none !important;} /* injected by platform.js */</style><style>body {transition: opacity ease-in 0.2s; }
body[unresolved] {opacity: 0; display: block; overflow: hidden; }
</style><style shim-shadowdom-css="">style { display: none !important; }
cxx-function {
display: block;
}
cxx-function:not(:last-child) {
margin-bottom: 3ex;
}
cxx-function > dl {
margin: 0px 0px 0px 2em;
}
cxx-function > pre {
margin: 0px;
}cxx-signature {
padding-left: 2em; display: block; text-indent: -2em;
}
cxx-signature.formatted {
text-indent: 0px;
}cxx-attribute {
display: block; margin-top: 0.5em; margin-bottom: 0.5em;
}
cxx-attribute dt {
float: left; font-style: italic; font-weight: normal; padding-right: 1ex;
}
cxx-attribute dd {
margin-left: 0em;
}
cxx-attribute dd > ul, cxx-attribute dd > ol {
clear: left;
}cxx-requires {
display: block; margin-top: 0.5em; margin-bottom: 0.5em;
}
cxx-requires dt {
float: left; font-style: italic; font-weight: normal; padding-right: 1ex;
}
cxx-requires dd {
margin-left: 0em;
}
cxx-requires dd > ul, cxx-requires dd > ol {
clear: left;
}cxx-preconditions {
display: block; margin-top: 0.5em; margin-bottom: 0.5em;
}
cxx-preconditions dt {
float: left; font-style: italic; font-weight: normal; padding-right: 1ex;
}
cxx-preconditions dd {
margin-left: 0em;
}
cxx-preconditions dd > ul, cxx-preconditions dd > ol {
clear: left;
}cxx-effects {
display: block; margin-top: 0.5em; margin-bottom: 0.5em;
}
cxx-effects dt {
float: left; font-style: italic; font-weight: normal; padding-right: 1ex;
}
cxx-effects dd {
margin-left: 0em;
}
cxx-effects dd > ul, cxx-effects dd > ol {
clear: left;
}cxx-synchronization {
display: block; margin-top: 0.5em; margin-bottom: 0.5em;
}
cxx-synchronization dt {
float: left; font-style: italic; font-weight: normal; padding-right: 1ex;
}
cxx-synchronization dd {
margin-left: 0em;
}
cxx-synchronization dd > ul, cxx-synchronization dd > ol {
clear: left;
}cxx-postconditions {
display: block; margin-top: 0.5em; margin-bottom: 0.5em;
}
cxx-postconditions dt {
float: left; font-style: italic; font-weight: normal; padding-right: 1ex;
}
cxx-postconditions dd {
margin-left: 0em;
}
cxx-postconditions dd > ul, cxx-postconditions dd > ol {
clear: left;
}cxx-returns {
display: block; margin-top: 0.5em; margin-bottom: 0.5em;
}
cxx-returns dt {
float: left; font-style: italic; font-weight: normal; padding-right: 1ex;
}
cxx-returns dd {
margin-left: 0em;
}
cxx-returns dd > ul, cxx-returns dd > ol {
clear: left;
}cxx-throws {
display: block; margin-top: 0.5em; margin-bottom: 0.5em;
}
cxx-throws dt {
float: left; font-style: italic; font-weight: normal; padding-right: 1ex;
}
cxx-throws dd {
margin-left: 0em;
}
cxx-throws dd > ul, cxx-throws dd > ol {
clear: left;
}cxx-complexity {
display: block; margin-top: 0.5em; margin-bottom: 0.5em;
}
cxx-complexity dt {
float: left; font-style: italic; font-weight: normal; padding-right: 1ex;
}
cxx-complexity dd {
margin-left: 0em;
}
cxx-complexity dd > ul, cxx-complexity dd > ol {
clear: left;
}cxx-exception-safety {
display: block; margin-top: 0.5em; margin-bottom: 0.5em;
}
cxx-exception-safety dt {
float: left; font-style: italic; font-weight: normal; padding-right: 1ex;
}
cxx-exception-safety dd {
margin-left: 0em;
}
cxx-exception-safety dd > ul, cxx-exception-safety dd > ol {
clear: left;
}cxx-remarks {
display: block; margin-top: 0.5em; margin-bottom: 0.5em;
}
cxx-remarks dt {
float: left; font-style: italic; font-weight: normal; padding-right: 1ex;
}
cxx-remarks dd {
margin-left: 0em;
}
cxx-remarks dd > ul, cxx-remarks dd > ol {
clear: left;
}cxx-error-conditions {
display: block; margin-top: 0.5em; margin-bottom: 0.5em;
}
cxx-error-conditions dt {
float: left; font-style: italic; font-weight: normal; padding-right: 1ex;
}
cxx-error-conditions dd {
margin-left: 0em;
}
cxx-error-conditions dd > ul, cxx-error-conditions dd > ol {
clear: left;
}cxx-notes {
display: block; margin-top: 0.5em; margin-bottom: 0.5em;
}
cxx-notes dt {
float: left; font-style: italic; font-weight: normal; padding-right: 1ex;
}
cxx-notes dd {
margin-left: 0em;
}
cxx-notes dd > ul, cxx-notes dd > ol {
clear: left;
}cxx-section {
display: block;
}
cxx-section:target {
background-color: inherit;
}
cxx-section:target > section > h1 {
background-color: rgb(255, 238, 221);
}
cxx-section header > h1 {
display: inline; font-size: 100%;
}
cxx-section header {
font-weight: bold; margin-top: 20px; margin-bottom: 20px;
}
cxx-section header:after {
clear: both; display: block; content: " "; height: 0px;
}cxx-clause {
display: block;
}
cxx-clause:target {
background-color: inherit;
}
cxx-clause:target > section > h1 {
background-color: rgb(255, 238, 221);
}
cxx-clause header > h1 {
display: inline; font-size: 100%;
}
cxx-clause header {
font-weight: bold; margin-top: 20px; margin-bottom: 20px;
}
cxx-clause header:after {
clear: both; display: block; content: " "; height: 0px;
}[is=cxx-table] {
margin-left: auto; margin-right: auto; border-collapse: collapse; border: thin solid black;
}
[is=cxx-table] caption {
white-space: nowrap;
}
[is=cxx-table] caption caption {
display: inline;
}
[is=cxx-table] th, [is=cxx-table] td {
border-style: solid none; border-color: black; border-width: thin; padding: 0px 0.25em;
}
[is=cxx-table].column-rules th, [is=cxx-table].column-rules td {
border-left-style: solid; border-right-style: solid;
}
[is=cxx-table] th {
border-bottom: medium double;
}
[is=cxx-table].center td {
text-align: center;
}
[is=cxx-table].list td {
border: medium none;
}cxx-figure {
margin-left: auto; margin-right: auto;
}
cxx-figure figcaption {
white-space: nowrap; text-align: center;
}
cxx-figure figcaption figcaption {
display: inline;
}[is=cxx-definition-section] dt {
font-weight: bold;
}
[is=cxx-definition-section] dd {
margin-left: 0px;
}cxx-toc {
display: block;
}
cxx-toc nav > ol {
font-weight: bold;
}
cxx-toc ol {
font-weight: normal; padding-left: 0px; margin-left: 0px;
}
cxx-toc li {
list-style-type: none;
}
cxx-toc .marker {
display: inline-block;
}
cxx-toc li .marker {
width: 2em; text-align: left;
}
cxx-toc ol ol {
margin-left: 2em;
}
cxx-toc li li .marker {
width: 3em;
}
cxx-toc ol ol ol {
margin-left: 3em;
}
cxx-toc li li li .marker {
width: 3.5em;
}
cxx-toc ol ol ol ol {
margin-left: 3.5em;
}
cxx-toc li li li li .marker {
width: 4.5em;
}cxx-get-element-by-id {
display: none;
}core-xhr {
display: none;
}cxx-foreign-index {
display: none;
}cxx-titlepage {
display: block; min-height: 100%;
}
cxx-titlepage {
position: relative;
}
cxx-titlepage table {
position: absolute; right: 0px; top: 0px;
}
cxx-titlepage h1 {
position: absolute; top: 40%;
}
cxx-titlepage p.warning {
position: absolute; bottom: 5%;
}
cxx-titlepage h1 {
text-align: center;
}
cxx-titlepage th {
text-align: left; vertical-align: top;
}cxx-ednote {
display: block;
}
cxx-ednote aside {
float: right; max-width: 40%; margin: 1ex; border: 1px dashed rgb(136, 136, 136); padding: 1ex; background-color: rgb(238, 238, 238);
}cxx-note .nowrap {
white-space: nowrap;
}cxx-footnote {
font-family: serif; white-space: normal; text-indent: initial;textIndent: initial;
}
@media screen {
cxx-footnote aside {
float: right; max-width: 30%; margin-left: 1em;
}
}
@media print {
cxx-footnote sup, cxx-footnote .marker {
display: none;
}
aside { }
}cxx-example {
display: block;
}
cxx-example.inline {
display: inline;
}
cxx-example .nowrap {
white-space: nowrap;
}cxx-publish-button {
display: block;
}cxx-codeblock {
display: block;
}bnf-grammar {
display: block; font-style: italic; margin-left: 0.35in;
}bnf-rule {
display: block; margin-left: 0.6in;
}bnf-alt {
display: block; margin-left: 1.2in;
}bnf-terminal {
font-style: normal;
}</style>
<meta charset="utf-8">
<link rel="import" href="bower_components/cxx-html-doc-framework/framework.html">
<style shim-shadowdom-css="">/* Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
@page {
margin: 10%;
@top-left { content: "© ISO/IEC"; font-size: 10pt; }
@top-right { content: string(docnum); font-weight: bold; font-size: 10pt; }
@bottom-left { content: string(current-section, last); font-size: 10pt; }
@bottom-right { content: counter(page); font-size: 10pt; }
}
cxx-titlepage { page: title; page-break-after: always; }
@page title {
@top-left { content: "© ISO 2014 — All rights reserved"; }
@top-right { content: normal; }
@bottom-left { content: normal; }
@bottom-right { content: normal; }
}
@media screen {
body { max-width: 7in;
/* Make room for paragraph numbers. */
margin-left: 2em }
}
@media print {
html { font-size: 10pt; }
* pre, * code { font-size: 8pt; }
/* Note that only Prince generates clickable links. */
* a[href] { text-decoration:none; }
}
/* Needed to make the <cxx-titlepage>'s vertical spacing work. */
html, body {height: 100%}
cxx-docnum { string-set: docnum content(); }
cxx-clause { page-break-before: always; }
@media screen {
cxx-clause, cxx-toc { margin-top: 3em; }
}
cxx-clause header { font-size: 150%; }
cxx-toc h1 { font-size: 150%; }
cxx-clause cxx-section header { font-size: 117%; }
cxx-clause cxx-section cxx-section header { font-size: 100%; }
[data-bookmark-label] { bookmark-label: attr(data-bookmark-label); }
h1 { bookmark-level: 1; }
cxx-toc h1 { bookmark-level: 2; }
cxx-clause h1 { bookmark-level: 2; }
cxx-clause cxx-section h1 { bookmark-level: 3; }
cxx-clause cxx-section cxx-section h1 { bookmark-level: 4; }
* .section-number { string-set: current-section "§ " content(); }
p {margin-top: .5em; margin-bottom: .5em}
p:first-child, ul, ol {margin-top: 0}
[para_num]::before { content: attr(para_num); float: left;
font-size: 70%; margin-left: -2.5em; width: 1.5em; text-align: right; }
del {text-decoration: line-through; background-color: red; color: #8B0040;}
ins {text-decoration: underline; background-color: yellow; color: #005100;}
pre {
margin-left: 1em;
margin-top: .5em;
margin-bottom: .5em;
}
pre > code { display: inline-block; }
/* Use an em-dash for the list bullet. */
ul {
list-style: none;
/* Relative positioning on the 'ul' lets the absolutely-positioned
marker align relative to it.*/
position: relative;
}
ul li:before {
content: "\2014";
position: absolute; left: 10px;
}
/* This is here rather than inside elements/toc.html because browsers
don't understand leader() or target-counter(), so they drop them
inside the CSSOM. */
@media print {
/* Generate page numbers in the table of contents. */
cxx-toc a[href]::after { content: leader(" . ") target-counter(attr(href), page); }
cxx-footnote aside { float: footnote; footnote-policy: line; }
}</style></head>
<body>
<pre class="mydocheader">Document number: N4123
Date: 2014-10-09
Project: Programming Language C++
Reference: ISO/IEC IS 14882:2011(E)
Reply to: Artur Laksberg, Microsoft Corp. [email protected]
Vicente J. Botet Escriba, [email protected]
</pre>
<br><br><br><br><br><br>
<h1>Improvements to the Concurrency Technical Specification</h1>
<cxx-toc>
<nav>
<h1>Contents</h1>
<ol>
<li><span class="marker">1</span><a href="#introduction">Introduction</a>
<ol>
<li><span class="marker">1.1</span><a href="#motivation">Motivation and Goals</a>
</li>
<li><span class="marker">1.2</span><a href="#how-to-read">How To Read This Document</a>
</li>
</ol>
</li>
<li><span class="marker">2</span><a href="#general">General</a>
<ol>
<li><span class="marker">2.1</span><a href="#general.namespaces">Namespaces, headers, and modifications to standard classes</a>
</li>
<li><span class="marker">2.2</span><a href="#general.plans">Future plans (Informative)</a>
</li>
<li><span class="marker">2.3</span><a href="#general.feature.test">Feature-testing recommendations (Informative)</a>
</li>
</ol>
</li>
<li><span class="marker">3</span><a href="#futures"> Improvements to std::future<T> and Related APIs</a>
<ol>
<li><span class="marker">3.1</span><a href="#futures.general">General</a>
</li>
<li><span class="marker">3.2</span><a href="#header.future.synop">Header <experimental/future> synopsis</a>
</li>
<li><span class="marker">3.3</span><a href="#futures.unique_future"> Changes to cClass template future</a>
</li>
<li><span class="marker">3.4</span><a href="#futures.shared_future"> Changes to cClass template shared_future</a>
</li>
<li><span class="marker">3.5</span><a href="#futures.promise">Class template promise</a>
</li>
<li><span class="marker">3.6</span><a href="#futures.task">Class template packaged_task</a>
</li>
<li><span class="marker">3.7</span><a href="#futures.async"> Function template async</a>
</li>
<li><span class="marker">3.8</span><a href="#futures.when_all"> Function template when_all</a>
</li>
<li><span class="marker">3.9</span><a href="#futures.when_any"> Function template when_any</a>
</li>
<li><span class="marker">3.10</span><a href="#futures.when_any_back"> Function template when_any_back</a>
</li>
<li><span class="marker">3.11</span><a href="#futures.make_ready_future"> Function template make_ready_future</a>
</li>
<li><span class="marker">3.12</span><a href="#futures.make_exceptional_future">Function template make_exceptional_future</a>
</li>
</ol>
</li>
<li><span class="marker">4</span><a href="#acknowledgments">Acknowledgments</a>
</li>
</ol>
</nav>
</cxx-toc>
<cxx-clause id="introduction">
<section>
<header><span class="section-number">1</span> <h1 data-bookmark-label="1 Introduction">Introduction</h1> <span style="float:right"><a href="#introduction">[introduction]</a></span></header>
<cxx-section id="motivation">
<section>
<header><span class="section-number">1.1</span> <h1 data-bookmark-label="1.1 Motivation and Goals">Motivation and Goals</h1> <span style="float:right"><a href="#motivation">[motivation]</a></span></header>
<p para_num="1" id="motivation.1">
This document proposes improvements to <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4107.html">N4107</a>,
the current Working Draft of the Concurrency TS.
</p>
<p para_num="2" id="motivation.2">
The document is motivated by <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4032.html">N4032</a>
and <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4048.pdf">N4048</a>,
which were presented to SG1 at the Rapperswil meeting. This document collects the parts of these papers that
received positive feedback from SG1 and presents them as a combined set of proposed changes to
the Concurrency TS.
</p>
<p para_num="3" id="motivation.3">
In addition, the paper also addresses some of the issues discovered and reported
to the editor by various individuals, primarily Vicente J. Botet Escriba and Anthony Williams.
</p>
<p para_num="4" id="motivation.4">
The author seeks feedback from SG1 on this document. If directed by SG1, all or
some the changes proposed in this document will be incorporated into the next
Working Paper of the Concurrency TS.
</p>
</section>
</cxx-section>
<cxx-section id="how-to-read">
<section>
<header><span class="section-number">1.2</span> <h1 data-bookmark-label="1.2 How To Read This Document">How To Read This Document</h1> <span style="float:right"><a href="#how-to-read">[how-to-read]</a></span></header>
<p para_num="1" id="how-to-read.1">
The proposed changes are presented as "diffs" to N4107 marked as <ins>insertions</ins> and
<del>deletions</del>.
</p>
</section>
</cxx-section>
</section>
</cxx-clause>
<cxx-clause id="general">
<section>
<header><span class="section-number">2</span> <h1 data-bookmark-label="2 General">General</h1> <span style="float:right"><a href="#general">[general]</a></span></header>
<cxx-section id="general.namespaces">
<section>
<header><span class="section-number">2.1</span> <h1 data-bookmark-label="2.1 Namespaces, headers, and modifications to standard classes">Namespaces, headers, and modifications to standard classes</h1> <span style="float:right"><a href="#general.namespaces">[general.namespaces]</a></span></header>
<p para_num="1" id="general.namespaces.1"><a id="general.namespaces.1"></a> <del>Some of the extensions described in this Technical Specification represent
types and functions that are currently not part of the C++ Standards Library,
and because these extensions are experimental, they should not be declared
directly within namespace <code>std</code>. Instead, such extensions are
declared in namespace <code>std::experimental</code>.</del>
</p>
<p para_num="2" id="general.namespaces.2">
<del>
<cxx-note><span class="nowrap">[ <em>Note:</em></span>
Once standardized, these components are expected to be promoted to namespace <code>std</code>.
<span class="nowrap">— <em>end note</em> ]</span>
</cxx-note>
</del>
</p>
<p para_num="3" id="general.namespaces.3">
<del>Unless otherwise specified, references to such entities described in this
Technical Specification are assumed to be qualified with
<code>std::experimental</code>, and references to entities described in the C++
Standard Library are assumed to be qualified with <code>std::</code>.
</del>
</p>
<cxx-ednote>
<aside><strong>Editor's note:</strong> This section reflects the consensus between the LWG and LEWG at the
<a href="http://wiki.edg.com/twiki/bin/view/Wg21chicago2013/FundamentalsTS#What_can_go_into_a_TS">Chicago 2013</a> and
<a href="http://wiki.edg.com/twiki/bin/view/Wg21issaquah/ChangesToExistingInTS">Issaquah 2014</a> meetings.</aside>
</cxx-ednote>
<p para_num="4" id="general.namespaces.4"><ins>Since the extensions described in this technical specification
are experimental and not part of the C++ standard library, they
should not be declared directly within namespace
<code>std</code>.
Unless otherwise specified, all components described in this technical specification either:
</ins></p>
<ul>
<li><ins>modify an existing interface in the C++ Standard Library in-place,</ins></li>
<li><ins>
are declared in a namespace whose name appends <code>::experimental::concurrency_v1</code>
to a namespace defined in the C++ Standard Library,
such as <code>std</code>, or
</ins></li>
<li><ins>
are declared in a subnamespace of a namespace described in the previous bullet,
whose name is not the same as an existing subnamespace of namespace <code>std</code>.
</ins></li>
</ul>
<p para_num="5" id="general.namespaces.5"><ins>Each header described in this technical
specification shall import the contents of
<code>std::experimental::concurrency_v1</code> into
<code>std::experimental</code> as if by</ins></p>
<pre><ins><code>namespace std {
namespace experimental {
inline namespace concurrency_v1 {}
}
}</code></ins></pre>
<p para_num="6" id="general.namespaces.6"><ins>Unless otherwise specified, references to other entities
described in this technical specification are assumed to be
qualified with <code>std::experimental::concurrency_v1::</code>,
and references to entities described in the standard are assumed
to be qualified with <code>std::</code>.</ins></p>
<p para_num="7" id="general.namespaces.7"><ins>Extensions that are expected to eventually be added to an
existing header <code><meow></code> are provided inside the
<code><experimental/meow></code> header, which shall include
the standard contents of <code><meow></code> as if by</ins></p>
<pre><ins><code>#include <meow></code></ins></pre>
<p para_num="8" id="general.namespaces.8"><ins>New headers are also provided in the
<code><experimental/></code> directory, but without such an
<code>#include</code>.</ins></p>
<table is="cxx-table" id="tab.cxx.headers" class="list" columns="3">
<caption>Table 1 — <wbr><span><ins>C++ library headers</ins></span></caption>
<tbody><tr><td>
<ul>
<li><ins><code><experimental/future></code></ins></li>
</ul>
</td></tr>
</tbody>
</table>
</section>
</cxx-section>
<cxx-section id="general.plans">
<section>
<header><span class="section-number">2.2</span> <h1 data-bookmark-label="2.2 Future plans (Informative)"><ins>Future plans (Informative)</ins></h1> <span style="float:right"><a href="#general.plans">[general.plans]</a></span></header>
<p para_num="1" id="general.plans.1"><ins>This section describes tentative plans for future versions of
this technical specification and plans for moving content into
future versions of the C++ Standard.</ins></p>
<p para_num="2" id="general.plans.2"><ins>The C++ committee intends to release a new version of this
technical specification approximately every year, containing the
library extensions we hope to add to a near-future version of the
C++ Standard. Future versions will define their contents in
<code>std::experimental::concurrency_v2</code>,
<code>std::experimental::concurrency_v3</code>, etc., with the
most recent implemented version inlined into
<code>std::experimental</code>.</ins></p>
<p para_num="3" id="general.plans.3"><ins>When an extension defined in this or a future version of this
technical specification represents enough existing practice, it
will be moved into the next version of the C++ Standard by
removing the <code>experimental::concurrency_v<var>N</var></code>
segment of its namespace and by removing the
<code>experimental/</code> prefix from its header's path.</ins></p>
</section>
</cxx-section>
<cxx-section id="general.feature.test">
<section>
<header><span class="section-number">2.3</span> <h1 data-bookmark-label="2.3 Feature-testing recommendations (Informative)"><ins>Feature-testing recommendations (Informative)</ins></h1> <span style="float:right"><a href="#general.feature.test">[general.feature.test]</a></span></header>
<p para_num="1" id="general.feature.test.1"><ins>
For the sake of improved portability between partial implementations of various C++ standards,
WG21 (the ISO technical committee for the C++ programming language) recommends
that implementers and programmers follow the guidelines in this section concerning feature-test macros.
<cxx-note><span class="nowrap">[ <em>Note:</em></span>
<a href="http://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations">WG21's SD-6</a> makes similar recommendations for the C++ Standard itself.
<span class="nowrap">— <em>end note</em> ]</span>
</cxx-note>
</ins></p>
<p para_num="2" id="general.feature.test.2"><ins>
Implementers who provide a new standard feature should define a
macro with the recommended name,
in the same circumstances under which the feature is available
(for example, taking into account relevant command-line options),
to indicate the presence of support for that feature.
Implementers should define that macro with the value specified in
the most recent version of this technical specification that they
have implemented.
The recommended macro name is "<code>__cpp_lib_experimental_</code>" followed by the string in the "Macro Name Suffix" column.
</ins></p>
<p para_num="3" id="general.feature.test.3"><ins>
Programmers who wish to determine whether a feature is available in an implementation should base that determination on
the presence of the header (determined with <code>__has_include(<header/name>)</code>)
and
the state of the macro with the recommended name.
(The absence of a tested feature may result in a program with
decreased functionality, or the relevant functionality may be provided
in a different way.
A program that strictly depends on support for a feature can just
try to use the feature unconditionally;
presumably, on an implementation lacking necessary support,
translation will fail.)
</ins></p>
<table is="cxx-table" class="column-rules">
<caption>Table 2 — <wbr><span><ins>Significant features in this technical specification</ins></span></caption>
<thead>
<tr>
<th><ins>Doc. No.</ins></th>
<th><ins>Title</ins></th>
<th><ins>Primary Section</ins></th>
<th><ins>Macro Name Suffix</ins></th>
<th><ins>Value</ins></th>
<th><ins>Header</ins></th>
</tr>
</thead>
<!-- These rows are in the same order as their feature appears in this document. -->
<tbody><tr>
<td><ins>N3875</ins></td>
<td><ins>Improvements to std::future<t> and Related APIs</t></ins></td>
<td><ins><cxx-ref to="futures"><a title="futures" href="#futures">3</a></cxx-ref></ins></td>
<td><ins><code>future_continuations</code></ins></td>
<td><ins>201410</ins></td>
<td><ins>code><experimental/future></ins></td>
</tr>
</tbody>
</table>
</section>
</cxx-section>
</section>
</cxx-clause>
<cxx-clause id="futures">
<section>
<header><span class="section-number">3</span> <h1 data-bookmark-label="3 Improvements to std::future<T> and Related APIs"> Improvements to <code>std::future<T></code> and Related APIs</h1> <span style="float:right"><a href="#futures">[futures]</a></span></header>
<cxx-section id="futures.general">
<section>
<header><span class="section-number">3.1</span> <h1 data-bookmark-label="3.1 General">General</h1> <span style="float:right"><a href="#futures.general">[futures.general]</a></span></header>
<p para_num="1" id="futures.general.1">
The extensions proposed here are an evolution of the functionality of
<code>std::future</code> and <code>std::shared_future</code>. The extensions enable wait free
composition of asynchronous operations.
<ins><code>std::promise</code>, <code>std::packaged_task</code> and <code>std::async</code> are also updated to be
associated to the updated <code>std::future</code>.</ins>
</p>
</section>
</cxx-section>
<cxx-section id="header.future.synop">
<section>
<header><span class="section-number">3.2</span> <h1 data-bookmark-label="3.2 Header <experimental/future> synopsis"><ins>Header <experimental/future> synopsis</ins></h1> <span style="float:right"><a href="#header.future.synop">[header.future.synop]</a></span></header>
<cxx-ednote>
<aside><strong>Editor's note:</strong>
An additional editorial fix as in Fundamental v1 TS is applied in the declaration of <code>swap</code> for <code>packaged_task</code>
</aside>
</cxx-ednote>
<pre><code><ins>#include <future>
namespace std {
namespace experimental {
inline namespace concurrency_v1 {
template <class R> class promise;
template <class R> class promise<R&>;
template <> class promise<void>;
template <class R>
void swap(promise<R>& x, promise<R>& y) noexcept;
template <class R> class future;
template <class R> class future<R&>;