forked from cplusplus/fundamentals-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeneral.html
422 lines (391 loc) · 17.3 KB
/
general.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
<cxx-clause id="general">
<h1>General</h1>
<cxx-section id="general.scope">
<h1>Scope</h1>
<p>This technical specification describes extensions to the C++
Standard Library (<cxx-ref
to="general.references"></cxx-ref>). These extensions are classes
and functions that are likely to be used widely within a program
and/or on the interface boundaries between libraries written by
different organizations.</p>
<p>This technical specification is non-normative. Some of the
library components in this technical specification may be
considered for standardization in a future version of C++, but
they are not currently part of any C++ standard. Some of the
components in this technical specification may never be
standardized, and others may be standardized in a substantially
changed form.</p>
<p>The goal of this technical specification is to build more
widespread existing practice for an expanded C++ standard
library. It gives advice on extensions to those vendors who wish
to provide them.</p>
</cxx-section>
<cxx-section id="general.references">
<h1>Normative references</h1>
<p>The following referenced document is indispensable for the
application of this document. For dated references, only the
edition cited applies. For undated references, the latest edition
of the referenced document (including any amendments) applies.</p>
<ul>
<li>ISO/IEC 14882:2014, <cite>Programming Languages — C++</cite>
<cxx-foreign-index id="cxx" src="cxx14_index.json" name="C++14"></cxx-foreign-index></li>
</ul>
<p>ISO/IEC 14882:— is herein called the <dfn>C++ Standard</dfn>.
References to clauses within the C++ Standard are written as "C++14
§3.2". The library described in ISO/IEC 14882:— clauses 17–30 is
herein called the <dfn>C++ Standard Library</dfn>.</p>
<p>Unless otherwise specified, the whole of the C++ Standard's Library
introduction (<cxx-ref in="cxx" to="library"></cxx-ref>) is included into this
Technical Specification by reference.</p>
</cxx-section>
<cxx-section id="general.namespaces">
<h1>Namespaces, headers, and modifications to standard classes</h1>
<p>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:
</p>
<ul>
<li>modify an existing interface in the C++ Standard Library in-place,</li>
<li>
are declared in a namespace whose name appends <code>::experimental::fundamentals_v2</code>
to a namespace defined in the C++ Standard Library,
such as <code>std</code> or <code>std::chrono</code>, or
</li>
<li>
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>.
</li>
</ul>
<cxx-example>
This TS does not define <code>std::experimental::fundamentals_v2::chrono</code>
because the C++ Standard Library defines <code>std::chrono</code>.
This TS does not define <code>std::pmr::experimental::fundamentals_v2</code>
because the C++ Standard Library does not define <code>std::pmr</code>.
</cxx-example>
<p>Each header described in this technical
specification shall import the contents of
<code>std::experimental::fundamentals_v2</code> into
<code>std::experimental</code> as if by</p>
<pre><code>namespace std {
namespace experimental {
inline namespace fundamentals_v2 {}
}
}</code></pre>
<p>
This technical specification also describes some experimental modifications to existing interfaces in the C++ Standard Library.
These modifications are described by quoting the affected parts of the standard
and using <ins>underlining</ins> to represent added text and <del>strike-through</del> to represent deleted text.
</p>
<p>Unless otherwise specified, references to other entities
described in this technical specification are assumed to be
qualified with <code>std::experimental::fundamentals_v2::</code>,
and references to entities described in the standard are assumed
to be qualified with <code>std::</code>.</p>
<p>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</p>
<pre><code>#include <meow></code></pre>
<p>New headers are also provided in the
<code><experimental/></code> directory, but without such an
<code>#include</code>.</p>
<table is="cxx-table" id="tab.cxx.headers" class="list" columns="3">
<caption>C++ library headers</caption>
<tr><td>
<ul>
<li><code><experimental/algorithm></code></li>
<li><code><experimental/any></code></li>
<li><code><experimental/array></code></li>
<li><code><experimental/chrono></code></li>
<li><code><experimental/deque></code></li>
<li><code><experimental/forward_list></code></li>
<li><code><experimental/functional></code></li>
<li><code><experimental/future></code></li>
<li><code><experimental/iterator></code></li>
<li><code><experimental/list></code></li>
<li><code><experimental/map></code></li>
<li><code><experimental/memory></code></li>
<li><code><experimental/memory_resource></code></li>
<li><code><experimental/optional></code></li>
<li><code><experimental/propagate_const></code></li>
<li><code><experimental/random></code></li>
<li><code><experimental/ratio></code></li>
<li><code><experimental/regex></code></li>
<li><code><experimental/set></code></li>
<li><code><experimental/source_location></code></li>
<li><code><experimental/string></code></li>
<li><code><experimental/string_view></code></li>
<li><code><experimental/system_error></code></li>
<li><code><experimental/tuple></code></li>
<li><code><experimental/type_traits></code></li>
<li><code><experimental/unordered_map></code></li>
<li><code><experimental/unordered_set></code></li>
<li><code><experimental/utility></code></li>
<li><code><experimental/vector></code></li>
</ul>
</td></tr>
</table>
</cxx-section>
<cxx-section id="general.defns">
<h1>Terms and definitions</h1>
<p>For the purposes of this document, the terms and definitions
given in the C++ Standard and the following apply.</p>
<dl is="cxx-definition-section">
<dt id="general.defns.direct-non-list-init">direct-non-list-initialization</dt>
<dd>A direct-initialization that is not list-initialization.</dd>
</dl>
</cxx-section>
<cxx-section id="general.plans">
<h1>Future plans (Informative)</h1>
<p>This section describes tentative plans for future versions of
this technical specification and plans for moving content into
future versions of the C++ Standard.</p>
<p>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::fundamentals_v3</code>,
<code>std::experimental::fundamentals_v4</code>, etc., with the
most recent implemented version inlined into
<code>std::experimental</code>.</p>
<p>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::fundamentals_v<var>N</var></code>
segment of its namespace and by removing the
<code>experimental/</code> prefix from its header's path.</p>
</cxx-section>
<cxx-section id="general.feature.test">
<h1>Feature-testing recommendations (Informative)</h1>
<p>
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><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.</cxx-note>
</p>
<p>
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.
</p>
<p>
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.)
</p>
<table is="cxx-table" class="column-rules">
<caption>Significant features in this technical specification</caption>
<thead>
<tr>
<th>Doc. No.</th>
<th>Title</th>
<th>Primary Section</th>
<th>Macro Name Suffix</th>
<th>Value</th>
<th>Header</th>
</tr>
</thead>
<!-- These rows are in the same order as their feature appears in this document. -->
<tr>
<td>N3915</td>
<td>apply() call a function with arguments from a tuple</td>
<td><cxx-ref to="tuple.apply"></cxx-ref></td>
<td><code>apply</code></td>
<td>201402</td>
<td><code><experimental/tuple></code></td>
</tr>
<tr>
<td>N3932</td>
<td>Variable Templates For Type Traits</td>
<td><cxx-ref to="meta.type.synop"></cxx-ref></td>
<td><code>type_trait_variable_templates</code></td>
<td>201402</td>
<td><code><experimental/type_traits></code></td>
</tr>
<tr>
<td>N3866</td>
<td>Invocation type traits</td>
<td><cxx-ref to="meta.trans.other"></cxx-ref></td>
<td><code>invocation_type</code></td>
<td>201406</td>
<td><code><experimental/type_traits></code></td>
</tr>
<tr>
<td>P0013R1</td>
<td>Logical Operator Type Traits</td>
<td><cxx-ref to="meta.logical"></cxx-ref></td>
<td><code>logical_traits</code></td>
<td>201511</td>
<td><code><experimental/type_traits></code></td>
</tr>
<tr>
<td>N4502</td>
<td>The C++ Detection Idiom</td>
<td><cxx-ref to="meta.detect"></cxx-ref></td>
<td><code>detect</code></td>
<td>201505</td>
<td><code><experimental/type_traits></code></td>
</tr>
<tr>
<td>N4388</td>
<td>A Proposal to Add a Const-Propagating Wrapper to the Standard Library</th>
<td><cxx-ref to="propagate_const"></cxx-ref></th>
<td><code>propagate_const</code></th>
<td>201505</th>
<td><code><experimental/propagate_const></code></th>
</tr>
<tr>
<td>N3916</td>
<td>Type-erased allocator for <code>std::function</code></td>
<td><cxx-ref to="func.wrap.func"></cxx-ref></td>
<td><code>function_erased_allocator</code></td>
<td>201406</td>
<td><code><experimental/functional></code></td>
</tr>
<tr>
<td>N3905</td>
<td>Extending <code>std::search</code> to use Additional Searching Algorithms</td>
<td><cxx-ref to="func.searchers"></cxx-ref></td>
<td><code>boyer_moore_searching</code></td>
<td>201411</td>
<td><code><experimental/functional></code></td>
</tr>
<tr>
<td>N4076</td>
<td>A proposal to add a generalized callable negator</th>
<td><cxx-ref to="func.not_fn"></cxx-ref></th>
<td><code>not_fn</code></th>
<td>201406</th>
<td><code><experimental/functional></code></th>
</tr>
<tr>
<td>N3672, N3793</td>
<td>A utility class to represent optional objects</td>
<td><cxx-ref to="optional"></cxx-ref></td>
<td><code>optional</code></td>
<td>201411</td>
<td><code><experimental/optional></code></td>
</tr>
<tr>
<td>N3804</td>
<td>Any Library Proposal</td>
<td><cxx-ref to="any"></cxx-ref></td>
<td><code>any</code></td>
<td>201411</td>
<td><code><experimental/any></code></td>
</tr>
<tr>
<td>N3921</td>
<td><code>string_view</code>: a non-owning reference to a string</td>
<td><cxx-ref to="string.view"></cxx-ref></td>
<td><code>string_view</code></td>
<td>201411</td>
<td><code><experimental/string_view></code></td>
</tr>
<tr>
<td>N3920</td>
<td>Extending shared_ptr to Support Arrays</td>
<td><cxx-ref to="memory.smartptr"></cxx-ref></td>
<td><code>shared_ptr_arrays</code></td>
<td>201406</td>
<td><code><experimental/memory></code></td>
</tr>
<tr>
<td>N3916</td>
<td>Polymorphic Memory Resources</td>
<td><cxx-ref to="memory.resource.synop"></cxx-ref></td>
<td><code>memory_resources</code></td>
<td>201402</td>
<td><code><experimental/memory_resource></code></td>
</tr>
<tr>
<td>N4282</td>
<td>The World’s Dumbest Smart Pointer</th>
<td><cxx-ref to="memory.observer.ptr"></cxx-ref></th>
<td><code>observer_ptr</code></th>
<td>201411</th>
<td><code><experimental/memory></code></th>
</tr>
<tr>
<td>N4273</td>
<td>Uniform Container Erasure</td>
<td><cxx-ref to="container.erasure"></cxx-ref></td>
<td><code>erase_if</code></td>
<td>201411</td>
<td><code><experimental/vector></code></td>
</tr>
<tr>
<td>N4391</td>
<td>make_array</td>
<td><cxx-ref to="container.array.creation"></cxx-ref></td>
<td><code>make_array</code></td>
<td>201505</td>
<td><code><experimental/array></code></td>
</tr>
<tr>
<td>N4257</td>
<td>Delimited iterators</td>
<td><cxx-ref to="iterator.ostream.joiner"></cxx-ref></td>
<td><code>ostream_joiner</code></td>
<td>201411</td>
<td><code><experimental/iterator></code></td>
</tr>
<tr>
<td>N3916</td>
<td>Type-erased allocator for <code>std::promise</code></td>
<td><cxx-ref to="futures.promise"></cxx-ref></td>
<td><code>promise_erased_allocator</code></td>
<td>201406</td>
<td><code><experimental/future></code></td>
</tr>
<tr>
<td>N3916</td>
<td>Type-erased allocator for <code>std::packaged_task</code></td>
<td><cxx-ref to="futures.task"></cxx-ref></td>
<td><code>packaged_task_erased_allocator</code></td>
<td>201406</td>
<td><code><experimental/future></code></td>
</tr>
<tr>
<td>N3925</td>
<td>A <code>sample</code> Proposal</td>
<td><cxx-ref to="alg.random.sample"></cxx-ref></td>
<td><code>sample</code></td>
<td>201402</td>
<td><code><experimental/algorithm></code></td>
</tr>
<tr>
<td>N4061</td>
<td>Greatest Common Divisor and Least Common Multiple</td>
<td><cxx-ref to="numeric.ops.gcd"></cxx-ref>, <cxx-ref to="numeric.ops.lcm"></cxx-ref></td>
<td><code>gcd_lcm</code></td>
<td>201411</td>
<td><code><experimental/numeric></code></td>
</tr>
<tr>
<td>N4531</td>
<td><code>std::rand</code> replacement</td>
<td><cxx-ref to="rand.util.randint"></cxx-ref></td>
<td><code>randint</code></td>
<td>201511</td>
<td><code><experimental/random></code></td>
</tr>
<tr>
<td>N4519</td>
<td>Source-Code Information Capture</td>
<td><cxx-ref to="reflection.src_loc"></cxx-ref></td>
<td><code>source_location</code></td>
<td>201505</td>
<td><code><experimental/source_location></code></td>
</tr>
</table>
</cxx-section>
</cxx-clause>