Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / styleguide / c++ / c++11.html
1 <!DOCTYPE html>
2 <!--
3 Copyright 2014 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file.
6 -->
7 <html>
8 <head>
9 <meta charset="utf-8">
10 <link rel="stylesheet" href="c++11.css">
11 <style>
12 table tbody tr td:first-child {
13   font-weight: bold;
14   font-size: 110%;
15 }
16 </style>
17 </head>
18 <body>
19 <div id="content">
20 <h1>C++11 use in Chromium</h1>
21
22 <p><i>This document lives at src/styleguide/c++/c++11.html in a Chromium
23 checkout.</i></p>
24
25 <p>This document summarizes the features of C++11 (both in the language itself
26 and in enhancements to the Standard Library) and describes which features are
27 allowed in Chromium and contains pointers to more detailed information. The
28 Guide applies to Chromium and its subprojects. Subprojects can choose to be
29 more restrictive if they need to compile on more toolchains than Chromium.</p>
30
31 <p>You can propose to make a feature available or to ban a
32 feature by sending an email to chromium-dev. Ideally include a short blurb
33 on what the feature is, and why you think it should or should not be allowed.
34 Ideally, the list will arrive at some consensus and the wiki page will be
35 updated to mention that consensus. If there's no consensus,
36 <code>src/styleguide/C++/OWNERS</code> get to decide -- for divisive features, we expect
37 the decision to be to not use the feature yet and possibly discuss it again a
38 few months later, when we have more experience with the language.</p>
39
40 <p class="warning">Unless otherwise noted, <strong>no</strong> C++11
41 <strong>library</strong> features are allowed.</p>
42
43 <h2 id="whitelist">C++11 Allowed Features</h2>
44
45 <p>The following features are currently allowed.</p>
46
47 <table id="whitelist_lang_list" class="unlined striped">
48 <tbody>
49
50 <tr>
51 <th style='width:220px;'>Feature</th>
52 <th style='width:260px;'>Snippet</th>
53 <th style='width:240px;'>Description</th>
54 <th style='width:240px;'>Documentation Link</th>
55 <th style='width:240px;'>Notes and Discussion Thread</th>
56 </tr>
57
58 <tr>
59 <td>Angle Bracket Parsing in Templates</td>
60 <td><code>&gt;&gt;</code> for <code>&gt; &gt;</code> and <br />
61 <code>&lt;::</code> for <code>&lt; ::</code></td>
62 <td>More intuitive parsing of template parameters</td>
63 <td><a href="http://stackoverflow.com/questions/15785496/c-templates-angle-brackets-pitfall-what-is-the-c11-fix">
64 C++ Templates Angle Brackets Pitfall</a></td>
65 <td>Recommended to increase readability. Approved without discussion.</td>
66 </tr>
67
68 <tr>
69 <td>Automatic Types</td>
70 <td><code>auto</code></td>
71 <td>Automatic type deduction</td>
72 <td>TODO: documentation link</td>
73 <td>Use according to the <a
74 href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#auto">Google
75 Style Guide on <code>auto</code></a>. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/OQyYSfH9m2M">Discussion thread</a></td>
76 </tr>
77
78 <tr>
79 <td>Final Specifier</td>
80 <td><code>final</code></td>
81 <td> Indicates that a class or function is final and cannot be overridden</td>
82 <td><a href="http://en.cppreference.com/w/cpp/language/final">final Language Reference</a></td>
83 <td>Recommended for new code. Existing uses of the <code>FINAL</code> macro will be <a href="https://crbug.com/417463">replaced throughout the codebase</a>. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/VTNZzizN0zo">Discussion thread</a></td>
84 </tr>
85
86 <tr>
87 <td>Local Types as Template Arguments</td>
88 <td></td>
89 <td>Allows local and unnamed types as template arguments</td>
90 <td><a href="http://stackoverflow.com/questions/742607/using-local-classes-with-stl-algorithms">
91 Local types, types without linkage and unnamed types as template arguments</a></td>
92 <td>Usage should be rare. Approved without discussion.</td>
93 </tr>
94
95 <tr>
96 <td>Null Pointer Constant</td>
97 <td><code>nullptr</code></td>
98 <td>Declares a type-safe null pointer</td>
99 <td>TODO: documentation link</td>
100 <td>Recommended for new code.
101 <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/4mijeJHzxLg">Discussion thread</a>.
102 <a href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#0_and_nullptr/NULL">Google Style Guide</a>.
103 Note: <code>std::nullptr_t</code> is a library feature and not available.
104 </td>
105 </tr>
106
107 <tr>
108 <td>Override Specifier</td>
109 <td><code>override</code></td>
110 <td>Indicates that a class or function overrides a base implementation</td>
111 <td><a href="http://en.cppreference.com/w/cpp/language/override">override Language Reference</a></td>
112 <td>Recommended for new code. Existing uses of the <code>OVERRIDE</code> macro will be <a href="https://crbug.com/417463">replaced throughout the codebase</a>. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/VTNZzizN0zo">Discussion</a></td>
113 </tr>
114
115 <tr>
116 <td>Range-Based For Loops</td>
117 <td><code>for (<i>type</i> <i>var</i> : <i>range</i>)</code></td>
118 <td>Facilitates a more concise syntax for iterating over the elements
119 of a container (or a range of iterators) in a <code>for</code> loop</td>
120 <td>TODO: documentation link</td>
121 <td>As a rule of thumb, use <code>for (const auto& ...)</code>, <code>for (auto& ...)</code>, or <code>for (<i>concrete type</i> ...)</code>. For pointers, use <code>for (auto* ...)</code> to make clear that the copy of the loop variable is intended, and only a pointer is copied. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/hpzz4EqbVmc">Discussion thread</a></td>
122 </tr>
123
124 <tr>
125 <td>Standard Integers</td>
126 <td>Typedefs within <code>&lt;stdint.h&gt;</code>
127 and <code>&lt;inttypes&gt;</code></td>
128 <td>Provides fixed-size integers independent of platforms</td>
129 <td><a href="http://www.cplusplus.com/reference/cstdint/">
130 &lt;stdint.h&gt; (cstdint)</a></td>
131 <td>Already in common use in the codebase. Approved without discussion.</td>
132 </tr>
133
134 <tr>
135 <td>Static Assertions</td>
136 <td><code>static_assert(<i>bool</i>, <i>string</i>)</code></td>
137 <td>Tests compile-time conditions</td>
138 <td><a href="http://en.cppreference.com/w/cpp/language/static_assert">Static Assertion</a></td>
139 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/POISBQEhGzU">Discussion thread</a></td>
140 </tr>
141
142 <tr>
143 <td>Variadic Macros</td>
144 <td><code>#define <i>MACRO</i>(...) <i>Impl</i>(<i>args</i>, __VA_ARGS__)</code></td>
145 <td>Allows macros that accept a variable number of arguments</td>
146 <td><a href="http://stackoverflow.com/questions/4786649/are-variadic-macros-nonstandard">
147 Are Variadic macros nonstandard?</a></td>
148 <td>Usage should be rare. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/sRx9j3CQqyA">Discussion thread</a></td>
149 </tr>
150
151 <tr>
152 <td>Variadic Templates</td>
153 <td><code>template &lt;<i>typename</i> ... <i>arg</i>&gt;</code></td>
154 <td>Allows templates that accept a variable number of arguments</td>
155 <td>TODO: documentation link</td>
156 <td>Usage should be rare. Use instead of .pump files. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/6ItymeMXpMc">Discussion thread</a></td>
157 </tr>
158
159 </tbody>
160 </table>
161
162 <h2 id="blacklist">C++11 Blacklist (Disallowed and Banned Features)</h2>
163
164 <p>This section lists features that are not allowed to be used yet.
165
166 <h3 id="blacklist_banned">C++11 Banned Features</h3>
167
168 <p>This section will list C++11 features that are not allowed in the Chromium
169 codebase.
170 </p>
171
172 <table id="banned_list" class="unlined striped">
173 <tbody>
174
175 <tr>
176 <th style='width:240px;'>Feature or Library</th>
177 <th style='width:240px;'>Snippet</th>
178 <th style='width:240px;'>Description</th>
179 <th style='width:240px;'>Documentation Link</th>
180 <th style='width:240px;'>Notes</th>
181 </tr>
182
183 <tr>
184 <td>Constant Expressions</td>
185 <td><code>constexpr</code></td>
186 <td>Compile-time constant expressions</td>
187 <td>TODO: documentation link</td>
188 <td>Doesn't work in MSVS2013. Reevalute once it does.<a
189 href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#constexpr">Google
190 Style Guide on <code>constexpr</code></a></td>
191 </tr>
192
193 <tr>
194 <td>Function Local Variable</td>
195 <td><code>__func__</code></td>
196 <td>Provides a local variable of the name of the enclosing
197 function for logging purposes</td>
198 <td><a href="http://www.informit.com/guides/content.aspx?g=cplusplus&amp;seqNum=338">
199 The __func__ Predeclared Identifier is Coming to C++</a></td>
200 <td>Doesn't work in MSVS2013. Reevaluate once it does. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/ojGfcgSDzHM">Discussion thread</a></td>
201 </tr>
202
203 <tr>
204 <td>Rvalue References (and Move Semantics)</td>
205 <td><code>T(T&amp;&amp; t)</code> and <code>T&amp; operator=(T&amp;&amp; t)</code></td>
206 <td>Reference that only binds to a temporary object</td>
207 <td>TODO: documentation link</td>
208 <td>To be revisited in the future.  Allowed in exceptional cases where approved by the OWNERS of src/styleguide/c++/.</td>
209 </tr>
210
211 <tr>
212 <td>UTF-16 and UTF-32 Support (16-Bit and 32-Bit Character Types)</td>
213 <td><code>char16_t</code> and <code>char32_t</code></td>
214 <td>Provides character types for handling 16-bit
215 and 32-bit code units (useful for encoding
216 UTF-16 and UTF-32 string data)</td>
217 <td><a href="http://en.cppreference.com/w/cpp/language/types">
218 Fundamental types</a></td>
219 <td>Doesn't work in MSVS2013. Reevaluate once it does.  Non-UTF-8 text is
220 banned by the
221 <a href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Non-ASCII_Characters">
222 C++ Style Guide</a>. However, may be useful for
223 consuming non-ASCII data. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/ME2kL7_Kvyk">Discussion thread</a></td>
224 </tr>
225
226 <tr>
227 <td>UTF-8, UTF-16, UTF-32 String Literals</td>
228 <td><code>u8&quot;<i>string</i>&quot;, u&quot;<i>string</i>&quot;, U&quot;<i>string</i>&quot;</code></td>
229 <td>Enforces UTF-8, UTF-16, UTF-32 encoding on all string literals</td>
230 <td><a href="http://en.cppreference.com/w/cpp/language/string_literal">
231 string literal</a></td>
232 <td>Does not yet work in MSVS2013. Reevaluate once it does. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/gcoUbcjfsII">Discussion thread</a></td>
233 </tr>
234
235 </tbody>
236 </table>
237
238 <h3 id="blacklist_review">C++11 Features To Be Discussed</h3>
239
240 <p>The following C++ language features are currently disallowed.
241 See the top of this page on how to propose moving a feature from this list
242 into the allowed or banned sections. Note that not all of these features
243 work in all our compilers yet.</p>
244
245 <table id="blacklist_review_list" class="unlined striped">
246 <tbody>
247
248 <tr>
249 <th style='width:240px;'>Feature</th>
250 <th style='width:240px;'>Snippet</th>
251 <th style='width:240px;'>Description</th>
252 <th style='width:240px;'>Documentation Link</th>
253 <th style='width:240px;'>Notes</th>
254 </tr>
255
256 <tr>
257 <td>Aliases</td>
258 <td><code>using <i>new_alias</i> = <i>typename</i></code></td>
259 <td>Allow parameterized typedefs</td>
260 <td><a href="http://en.cppreference.com/w/cpp/language/type_alias">Type alias (using syntax)</a></td>
261 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/8dOAMzgR4ao">Discussion thread</a></td>
262 </tr>
263
264 <tr>
265 <td>Alignment Features</td>
266 <td>
267 <code>alignas</code> specifier,
268 <code>std::alignment_of&lt;T&gt;</code>,
269 <code>std::aligned_union&lt;Size, ...Types&gt;</code> and
270 <code>std::max_align_t</code></td>
271 <td>Object alignment</td>
272 <td><a href="http://en.cppreference.com/w/cpp/types/alignment_of">std::alignment_of</a></td>
273 <td></td>
274 </tr>
275
276 <tr>
277 <td>Attributes</td>
278 <td><code>[[<i>attribute_name</i>]]</code></td>
279 <td>Attaches properties to declarations that
280 specific compiler implementations may use.</td>
281 <td><a href="http://www.codesynthesis.com/~boris/blog/2012/04/18/cxx11-generalized-attributes/">
282 C++11 generalized attributes</a></td>
283 <td></td>
284 </tr>
285
286 <tr>
287 <td>Declared Type Accessor</td>
288 <td><code>decltype(<i>expression</i>)</code></td>
289 <td>Provides a means to determine the type of an expression at compile-time,
290 useful most often in templates.</td>
291 <td><a href="http://en.cppreference.com/w/cpp/language/decltype">
292 decltype specifier</a></td>
293 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/_zoNvZd_dSo">Discussion thread</a></td>
294 </tr>
295
296 <tr>
297 <td>Default Function Creation</td>
298 <td><code><i>Function</i>(<i>arguments</i>) = default;</code></td>
299 <td>Instructs the compiler to generate a default version
300 of the indicated function</td>
301 <td><a href="http://stackoverflow.com/questions/823935/whats-the-point-in-defaulting-functions-in-c11">
302 What's the point in defaulting functions in C++11?</a></td>
303 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/qgU4mh_MpGA">Discussion thread</a></td>
304 </tr>
305
306 <tr>
307 <td>Default Function Template Arguments</td>
308 <td><code>template &lt;typename T = <i>type</i>&gt; <br />
309 &nbsp;&nbsp;<i>type</i> <i>Function</i>(T <i>var</i>) {}</code></td>
310 <td>Allow function templates, like classes, to have default arguments</td>
311 <td><a href="http://stackoverflow.com/questions/2447458/default-template-arguments-for-function-templates">
312 Default Template Arguments for Function Templates</a></td>
313 <td></td>
314 </tr>
315
316 <tr>
317 <td>Delegated Constructors</td>
318 <td><code>Class() : Class(0) {}</code><br />
319 <code>Class(<i>type</i> <i>var</i>) : Class(<i>var</i>, 0)</code></td>
320 <td>Allow overloaded constructors to use common initialization code</td>
321 <td><a href="https://www.ibm.com/developerworks/community/blogs/5894415f-be62-4bc0-81c5-3956e82276f3/entry/introduction_to_the_c_11_feature_delegating_constructors?lang=en">
322 Introduction to the C++11 feature: delegating constructors</a></td>
323 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/0zVA8Ctx3Xo">Discussion thread</a></td>
324 </tr>
325
326 <tr>
327 <td>Enumerated Type Classes</td>
328 <td><code>enum class <i>classname</i></code></td>
329 <td>Provide enums as full classes, with no implicit
330 conversion to booleans or integers</td>
331 <td><a href="http://stackoverflow.com/questions/6936030/do-we-really-need-enum-class-in-c11">
332 enum-class</a></td>
333 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/Q5WmkAImanc">Discussion thread</a></td>
334 </tr>
335
336 <tr>
337 <td>Exception Features</td>
338 <td><code>noexcept</code>, <code>exception_ptr</code>,
339 <code>current_exception()</code>, <code>rethrow_exception</code>,
340 and <code>nested_exception</code></td>
341 <td>Enhancements to exception throwing and handling</td>
342 <td><a href="http://en.cppreference.com/w/cpp/error/exception">
343 std::exception</a></td>
344 <td>Exceptions are banned by the
345 <a href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Exceptions"> C++ Style Guide</a>. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/8i4tMqNpHhg">Discussion thread</a></td>
346 </tr>
347
348 <tr>
349 <td>Explicit Conversion Operators</td>
350 <td><code>explicit operator <i>type</i>() {
351 <br />&nbsp;&nbsp;// code<br /> }</code></td>
352 <td>Allows conversion operators that cannot be implicitly invoked</td>
353 <td><a href="http://en.cppreference.com/w/cpp/language/explicit">
354 explicit specifier</a></td>
355 <td></td>
356 </tr>
357
358 <tr>
359 <td>Function Suppression</td>
360 <td><code><i>Function</i>(<i>arguments</i>) = delete;</code></td>
361 <td>Suppresses the implementation of a function, especially a
362 synthetic function such as a copy constructor</td>
363 <td>TODO: documentation link</td>
364 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/i1o7-RNRnMs">Discussion thread</a></td>
365 </tr>
366
367 <tr>
368 <td>(Uniform) Initialization Syntax</td>
369 <td><code><i>type</i> <i>name</i> { [<i>value</i> ..., <i>value</i>]};</code></td>
370 <td>Allows any object of primitive, aggregate or class
371 type to be initialized using brace syntax</td>
372 <td>TODO: documentation link</td>
373 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/GF96FshwHLw">Discussion thread</a></td>
374 </tr>
375
376 <tr>
377 <td>Inline Namespaces</td>
378 <td><code>inline</code></td>
379 <td>Allows better versioning of namespaces</td>
380 <td><a href="http://en.cppreference.com/w/cpp/language/namespace">Namespaces</a></td>
381 <td>Unclear how it will work with components</td>
382 </tr>
383
384 <tr>
385 <td>Lambda Expressions</td>
386 <td><code>[<i>captures</i>](<i>params</i>) -&gt; <i>ret</i> { <i>body</i> }</code></td>
387 <td>Anonymous functions</td>
388 <td><a href="http://en.cppreference.com/w/cpp/language/lambda">Lambda functions</a></td>
389 <td>No default captures (<a href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Lambda_expressions">Google Style Guide</a>). <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/D9UnnxBnciQ">Discussion thread</a></td>
390 </tr>
391
392 <tr>
393 <td><code>long long</code> Type</td>
394 <td><code>long long <i>var</i>= <i>value</i>;</code></td>
395 <td>An integer of at least 64 bits</td>
396 <td><a href="http://en.cppreference.com/w/cpp/language/types">
397 Fundamental types</a></td>
398 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/RxugZ-pIDxk">Discussion thread</a></td>
399 </tr>
400
401 <tr>
402 <td>Non-Static Class Member Initializers</td>
403 <td>
404 <code>
405 class C {<br />
406   <i>type</i> <i>var</i> = <i>value</i>;<br/>
407   C()  // copy-initializes <i>var</i><br/>
408 </code>
409 <td>Allows non-static class members to be initialized at their definitions (outside constructors)</td>
410 <td><a href="http://en.cppreference.com/w/cpp/language/data_members">
411 Non-static data members</a></td>
412 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/zqB-DySA4V0">Discussion thread</a></td>
413 </tr>
414
415 <tr>
416 <td>Raw String Literals</td>
417 <td><code>string <i>var</i>=R&quot;(<i>raw_string</i>)&quot;;</code></td>
418 <td>Allows a string to be encoded without any escape
419 sequences, easing parsing in regex expressions, for example</td>
420 <td>TODO: documentation link</td>
421 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/2kWQHbbuMHI">Discussion thread</a></td>
422 </tr>
423
424 <tr>
425 <td>Union Class Members</td>
426 <td><code>union <i>name</i> { <i>class</i> <i>var</i>}</code></td>
427 <td>Allows class type members</td>
428 <td><a href="http://en.cppreference.com/w/cpp/language/union">
429 Union declarations</a></td>
430 <td></td>
431 </tr>
432
433 <tr>
434 <td>User-Defined Literals</td>
435 <td><code><i>type</i> <i>var</i> = <i>literal_value</i>_<i>type</i></code></td>
436 <td>Allows user-defined literal expressions</td>
437 <td>TODO: documentation link</td>
438 <td></td>
439 </tr>
440
441 </tbody>
442 </table>
443
444 <h3 id="blacklist_stdlib">C++11 Standard Library features</h3>
445
446 <details>
447
448 <p><summary class="note">All C++11 <strong>Standard Library features are currently
449 banned</strong>, because they are not supported on all of our toolchains yet.
450 In particular, chromium/android is currently using STLport, and chromium/mac is
451 currently using libstdc++4.2, which predate C++11.
452 </summary></p>
453
454 <table id="banned_stdlib" class="unlined striped">
455
456 <tbody>
457 <tr>
458 <th style='width:240px;'>Feature</th>
459 <th style='width:240px;'>Snippet</th>
460 <th style='width:240px;'>Description</th>
461 <th style='width:240px;'>Documentation Link</th>
462 <th style='width:240px;'>Style Guide Usage</th>
463 </tr>
464
465 <tr>
466 <td>Address Retrieval</td>
467 <td><code>std::addressof()</code></td>
468 <td>Obtains the address of an object even with overloaded <code>operator&amp;</code></td>
469 <td><a href="http://en.cppreference.com/w/cpp/memory/addressof">std::addressof</a></td>
470 <td>Usage should be rare as
471 <a href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Operator_Overloading">
472 Operator Overloading</a> is rare and <code>&amps;</code>
473 should suffice in most cases. May be preferable
474 over <code>&amps;</code> for performing object
475 identity checks.</td>
476 </tr>
477
478 <tr>
479 <td>Aligned Storage</td>
480 <td><code>std::aligned_storage&lt;Size, Align&gt;::type</code></td>
481 <td>Declare uninitialized storage having a specified alignment.</td>
482 <td><a href="http://en.cppreference.com/w/cpp/types/aligned_storage">std::aligned_storage</a></td>
483 <td>Note: <code>std::aligned_storage</code> is allowed, but some other C++11
484 alignment features are still disallowed.</td>
485 </tr>
486
487 <tr>
488 <td>Allocator Traits</td>
489 <td><code>std::allocator_traits</code></td>
490 <td>Provides an interface for accessing custom allocators</td>
491 <td><a href="http://en.cppreference.com/w/cpp/memory/allocator_traits">
492 std::allocator_traits</a></td>
493 <td>Usage should be rare.</td>
494 </tr>
495
496 <tr>
497 <td>Atomics</td>
498 <td><code>std::atomic</code> and others in <code>&lt;atomic&gt;</code></td>
499 <td>Fine-grained atomic types and operations</td>
500 <td><a href="http://en.cppreference.com/w/cpp/atomic">&lt;atomic&gt;</a></td>
501 <td></td>
502 </tr>
503
504 <tr>
505 <td>Arrays</td>
506 <td><code>std::array</code></td>
507 <td>A fixed-size replacement for built-in arrays, with STL support</td>
508 <td><a href="http://en.cppreference.com/w/cpp/container/array">
509 std::array</a></td>
510 <td></td>
511 </tr>
512
513 <tr>
514 <td>Begin and End Non-Member Functions</td>
515 <td><code>std::begin()</code> and <code>std::end()</code></td>
516 <td>Allows use of free functions on any container, including
517 built-in arrays</td>
518 <td><a href="http://en.cppreference.com/w/cpp/iterator/begin">
519 std::begin</a> and
520 <a href="http://en.cppreference.com/w/cpp/iterator/end">
521 std::end</a></td>
522 <td>Useful for built-in arrays.</td>
523 </tr>
524
525 <tr>
526 <td>Bind Operations</td>
527 <td><code>std::bind(<i>function</i>, <i>args</i>, ...)</code></td>
528 <td>Declares a function object bound to certain arguments</td>
529 <td>TODO: documentation link</td>
530 <td></td>
531 </tr>
532
533 <tr>
534 <td>C Floating-Point Environment</td>
535 <td><code>&lt;cfenv&gt;</code></td>
536 <td>Provides floating point status flags and control modes for C-compatible code</td>
537 <td><a href="http://en.cppreference.com/w/cpp/header/cfenv">Standard library header &lt;cfenv&gt;</a></td>
538 <td>Compilers do not support use</td>
539 </tr>
540
541 <tr>
542 <td>Chrono Library</td>
543 <td><code>&lt;chrono&gt;</code></td>
544 <td>Provides a standard date and time library</td>
545 <td><a href="http://en.cppreference.com/w/cpp/chrono">Date and time utilities</a></td>
546 <td></td>
547 </tr>
548
549 <tr>
550 <td>Complex Inverse Trigonometric and Hyperbolic Functions</td>
551 <td>Functions within <code>&lt;complex&gt;</code></td>
552 <td>Adds inverse trigonomentric and hyperbolic non-member functions to
553 the <code>&lt;complex&gt;</code> library.</td>
554 <td><a href="http://en.cppreference.com/w/cpp/numeric/complex">std::complex</a></td>
555 <td></td>
556 </tr>
557
558 <tr>
559 <td>Conditional Type Selection</td>
560 <td><code>std::enable_if</code> and <code>std::conditional</code></td>
561 <td>Enables compile-time conditional type selection</td>
562 <td><a href="http://en.cppreference.com/w/cpp/types/enable_if">
563 std::enable_if</a> and
564 <a href="http://en.cppreference.com/w/cpp/types/conditional">
565 conditional</a></td>
566 <td></td>
567 </tr>
568
569 <tr>
570 <td>Constant Iterator Methods on Containers</td>
571 <td><code>std::cbegin()</code> and <code>std::cend()</code></td>
572 <td>Enforces iteration methods that don't change container contents</td>
573 <td>TODO: documentation link</td>
574 <td></td>
575 </tr>
576
577 <tr>
578 <td>Construct Elements in Containers</td>
579 <td><code>emplace()</code>,<code>emplace_back()</code>,
580 <code>emplace_front()</code>, <code>emplace_hint()</code></td>
581 <td>Constructs elements directly within a container without a copy
582 or a move</td>
583 <td>TODO: documentation link</td>
584 <td>Use where element construction within a container
585 is needed.</td>
586 </tr>
587
588 <tr>
589 <td>Container Compaction Functions</td>
590 <td><code>std::vector::shrink_to_fit()</code>,
591 <code>std::deque::shrink_to_fit()</code>, and
592 <code>std::string::shrink_to_fit()</code></td>
593 <td>Requests the removal of unused space
594 in the container</td>
595 <td><a href="http://en.cppreference.com/w/cpp/container/vector/shrink_to_fit">
596 std::vector::shrink_to_fit</a>,
597 <a href="http://en.cppreference.com/w/cpp/container/deque/shrink_to_fit">
598 std::deque::shrink_to_fit</a>, and
599 <a href="http://en.cppreference.com/w/cpp/string/basic_string/shrink_to_fit">
600 std::basic_string::shrink_to_fit</a></td>
601 <td></td>
602 </tr>
603
604 <tr>
605 <td>Date/Time String Formatting Specifiers</td>
606 <td><code>std::strftime()</code></td>
607 <td>Converts date and time information into a
608 formatted string using new specifiers</td>
609 <td><a href="http://en.cppreference.com/w/cpp/chrono/c/strftime">
610 std::strftime</a></td>
611 <td></td>
612 </tr>
613
614 <tr>
615 <td>Function Return Type Deduction</td>
616 <td><code>std::result_of&lt;<i>Functor(ArgTypes...)</i>&gt;</code></td>
617 <td>Extracts the return type from the type signature of
618 a function call invocation at compile-time.</td>
619 <td><a href="http://en.cppreference.com/w/cpp/types/result_of">
620 std::result_of</a></td>
621 <td>
622 <a href="http://stackoverflow.com/questions/15486951/why-does-stdresult-of-take-an-unrelated-function-type-as-a-type-argument">
623 Why does std::result_of take an (unrelated) function type as a type argument?
624 </a></td>
625 </tr>
626
627 <tr>
628 <td>Function Objects</td>
629 <td><code>std::function</code></td>
630 <td>Wraps a standard polymorphic function</td>
631 <td>TODO: documentation link</td>
632 <td></td>
633 </tr>
634
635 <tr>
636 <td>Forward Lists</td>
637 <td><code>std::forward_list</code></td>
638 <td>Provides an efficient singly linked list</td>
639 <td><a href="http://en.cppreference.com/w/cpp/container/forward_list">
640 std::forward_list</a></td>
641 <td></td>
642 </tr>
643
644 <tr>
645 <td>Gamma Natural Log</td>
646 <td><code>std::lgamma()</code></td>
647 <td>Computes the natural log of the gamma of a
648 floating point value</td>
649 <td><a href="http://en.cppreference.com/w/cpp/numeric/math/lgamma">
650 std::lgamma</a></td>
651 <td></td>
652 </tr>
653
654 <tr>
655 <td>Garbage Collection Features</td>
656 <td><code>std::{un}declare_reachable()</code> and
657 <code>std::{un}declare_no_pointers()</code></td>
658 <td>Enables garbage collection implementations</td>
659 <td><a href="http://en.cppreference.com/w/cpp/memory/gc/declare_reachable">
660 std::declare_reachable</a>
661 and <a href="http://en.cppreference.com/w/cpp/memory/gc/declare_no_pointers">
662 std::declare_no_pointers</a></td>
663 <td></td>
664 </tr>
665
666 <tr>
667 <td>Heap Validation</td>
668 <td><code>std::is_heap()</code></td>
669 <td>Checks whether an iterator range is in fact a heap</td>
670 <td>TODO: documentation link</td>
671 <td></td>
672 </tr>
673
674 <tr>
675 <td>Is Nan</td>
676 <td><code>std::isnan()</code></td>
677 <td>Determines if a floating point value is not-a-number</td>
678 <td><a href="http://en.cppreference.com/w/cpp/numeric/math/isnan">std::isnan</a></td>
679 <td></td>
680 </tr>
681
682 <tr>
683 <td>Iterator Operators</td>
684 <td><code>std::next()</code> and <code>std::prev()</code></td>
685 <td>Copies an iterator and increments or decrements the copy by
686 some value</td>
687 <td><a href="http://en.cppreference.com/w/cpp/iterator/next">std::next</a>
688 and <a href="http://en.cppreference.com/w/cpp/iterator/prev">std::prev</a>
689 </td>
690 <td></td>
691 </tr>
692
693 <tr>
694 <td>Initializer Lists</td>
695 <td><code>std::initializer_list&lt;T&gt;</code></td>
696 <td>Allows containers to be initialized with aggregate elements</td>
697 <td>TODO: documentation link</td>
698 <td></td>
699 </tr>
700
701 <tr>
702 <td>Move Semantics</td>
703 <td><code>std::move()</code></td>
704 <td>Facilitates efficient move operations</td>
705 <td><a href="http://en.cppreference.com/w/cpp/utility/move">
706 <code>std::move</code> reference</a></td>
707 <td></td>
708 </tr>
709
710 <tr>
711 <td>Pointer Traits Class Template</td>
712 <td><code>std::pointer_traits</code></td>
713 <td>Provides a standard way to access properties
714 of pointers and pointer-like types</td>
715 <td><a href="http://en.cppreference.com/w/cpp/memory/pointer_traits">
716 std::pointer_traits</a></td>
717 <td>Useful for determining the element type
718 pointed at by a (possibly smart) pointer.</td>
719 </tr>
720
721 <tr>
722 <td>Random Number Generators</td>
723 <td>Functions within <code>&lt;random&gt;</code></td>
724 <td>Random number generation algorithms and utilities</td>
725 <td><a href="http://en.cppreference.com/w/cpp/numeric/random">
726 Pseudo-random number generation</a></td>
727 <td></td>
728 </tr>
729
730 <tr>
731 <td>Ratio Template Class</td>
732 <td><code>std::ratio&lt;<i>numerator</i>, <i>denominator</i>&gt;</code></td>
733 <td>Provides compile-time rational numbers</td>
734 <td>TODO: documentation link</td>
735 <td></td>
736 </tr>
737
738 <tr>
739 <td>Reference Wrapper Classes</td>
740 <td><code>std::reference_wrapper</code> and
741 <code>std::ref()</code>, <code>std::cref()</code></td>
742 <td>Allows you to wrap a reference within a standard
743 object (and use those within containers)</td>
744 <td><a href="http://www.informit.com/guides/content.aspx?g=cplusplus&amp;seqNum=217">
745 Reference Wrappers</a></td>
746 <td></td>
747 </tr>
748
749 <tr>
750 <td>Regex Library</td>
751 <td><code>&lt;regex&gt;</code></td>
752 <td>Provides a standard regular expressions library</td>
753 <td><a href="http://en.cppreference.com/w/cpp/regex">Regular expressions library</a></td>
754 <td></td>
755 </tr>
756
757 <tr>
758 <td>Shared Pointers</td>
759 <td><code>std::shared_ptr</code></td>
760 <td>Allows shared ownership of a pointer through reference counts</td>
761 <td><a href="http://en.cppreference.com/w/cpp/memory/shared_ptr">std::shared_ptr</a></td>
762 <td><a href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Ownership_and_Smart_Pointers">
763 Ownership and Smart Pointers</a></td>
764 </tr>
765
766 <tr>
767 <td>Soft Program Exits</td>
768 <td><code>std::at_quick_exit()</code>
769 and <code>std::quick_exit()</code></td>
770 <td>Allows registration of functions to be called upon exit,
771 allowing cleaner program exit than <code>abort()</code> or
772 <code>exit</code></td>
773 <td><a href="http://en.cppreference.com/w/cpp/utility/program/quick_exit">
774 std:quick_exit</a></td>
775 <td></td>
776 </tr>
777
778 <tr>
779 <td>String Direct Reference Functions</td>
780 <td><code>std::string::front()</code> and <code>std::string::back()</code></td>
781 <td>Returns a reference to the front or back of a string</td>
782 <td><a href="http://en.cppreference.com/w/cpp/string/basic_string/front">
783 std::basic_string::front</a> and
784 <a href="http://en.cppreference.com/w/cpp/string/basic_string/back">
785 std::basic_string::back</a></td>
786 <td></td>
787 </tr>
788
789 <tr>
790 <td>String to Number Functions</td>
791 <td><code>std::stoi()</code>, <code>std::stol()</code>,
792 <code>std::stoul()</code>, <code>std::stoll</code>, <code>std::stoull()</code>,
793 <code>std::stof()</code>, <code>std::stod()</code>, <code>std::stold()</code>,
794 and <code>std::to_string()</code></td>
795 <td>Converts strings to numbers</td>
796 <td><a href="http://en.cppreference.com/w/cpp/string/basic_string/stol">
797 std::stoi, std::stol, std::stoll</a>,
798 <a href="http://en.cppreference.com/w/cpp/string/basic_string/stoul">
799 std::stoul, std::stoull</a>, and
800 <a href="http://en.cppreference.com/w/cpp/string/basic_string/stof">
801 std::stof, std::stod, std::stold</a> </td>
802 <td></td>
803 </tr>
804
805 <tr>
806 <td>STL Algorithms</td>
807 <td>Functions within <code>&lt;algorithm&gt;</code>.</td>
808 <td>Enhancements to the set of STL algorithms</td>
809 <td>See the <a href="http://en.cppreference.com/w/cpp/algorithm">
810 Algorithms library</a> for a complete list.</td>
811 <td></td>
812 </tr>
813
814 <tr>
815 <td>System Errors</td>
816 <td><code>&lt;system_error&gt;</code></td>
817 <td>Provides a standard system error library</td>
818 <td><a href="http://en.cppreference.com/w/cpp/error/system_error">std::system_error</a></td>
819 <td></td>
820 </tr>
821
822 <tr>
823 <td>Trailing Return Types</td>
824 <td><code>auto <i>function declaration</i> -> <i>return_type</i></code></td>
825 <td>Allows trailing function return value syntax</td>
826 <td><a href="http://en.cppreference.com/w/cpp/language/function">
827 Declaring functions</a></td>
828 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/OQyYSfH9m2M">Discussion thread</a></td>
829 </tr>
830
831 <tr>
832 <td>Thread Library</td>
833 <td><code>&lt;thread&gt; support, including &lt;future&gt;,
834 &lt;mutex&gt;, &lt;condition_variable&gt;</code></td>
835 <td>Provides a standard mulitthreading library using <code>std::thread</code> and associates</td>
836 <td><a href="http://en.cppreference.com/w/cpp/thread">Thread support library</a></td>
837 <td></td>
838 </tr>
839
840 <tr>
841 <td>Tuples</td>
842 <td><code>std::tuple</code></td>
843 <td>A fixed-size ordered collection of values of mixed types</td>
844 <td>TODO: documentation link</td>
845 <td></td>
846 </tr>
847
848 <tr>
849 <td>Type-Generic Math Functions</td>
850 <td>Functions within <code>&lt;ctgmath&gt;</code></td>
851 <td>Provides a means to call real or complex functions
852 based on the type of arguments</td>
853 <td><a href="http://en.cppreference.com/w/cpp/header/ctgmath">
854 Standard library header &lt;ctgmath&gt;</a></td>
855 <td></td>
856 </tr>
857
858 <tr>
859 <td>Type Info Enhancements</td>
860 <td><code>std::type_index</code> and <code>std::type_info::hash_code()</code></td>
861 <td>Allows type information (most often within containers)
862 that can be copied, assigned, or hashed</td>
863 <td><a href="http://en.cppreference.com/w/cpp/types/type_index">
864 std::type_index</a> and
865 <a href="http://en.cppreference.com/w/cpp/types/type_info/hash_code">
866 std::type_info::hash_code</a></td>
867 <td><code>std::type_index</code> is a thin wrapper for
868 <code>std::type_info</code>, allowing you to use it directly
869 within both associative and unordered containers</td>
870 </tr>
871
872 <tr>
873 <td>Type Traits</td>
874 <td>Class templates within <code>&lt;type_traits&gt;</code></td>
875 <td>Allows compile-time inspection of the properties of types</td>
876 <td><a href="http://en.cppreference.com/w/cpp/header/type_traits">
877 Standard library header &lt;type_traits&gt;</a></td>
878 <td></td>
879 </tr>
880
881 <tr>
882 <td>Unique Pointers</td>
883 <td><code>std::unique_ptr&lt;<i>type</i>&gt;</code></td>
884 <td>Defines a pointer with clear and unambiguous ownership</td>
885 <td>TODO: documentation link</td>
886 <td><a href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Ownership_and_Smart_Pointers">
887 Ownership and Smart Pointers</a></td>
888 </tr>
889
890 <tr>
891 <td>Unordered Associative Containers</td>
892 <td><code>std::unordered_set</code>, <code>std::unordered_map</code>,
893 <code>std::unordered_multiset</code>, and <code>std::unordered_multimap</code></td>
894 <td>Allows efficient containers of key/value pairs</td>
895 <td><a href="http://en.cppreference.com/w/cpp/container/unordered_map">std::unordered_map</a>
896 and <a href="http://en.cppreference.com/w/cpp/container/unordered_set">std::unordered_set</a>
897 </td>
898 <td></td>
899 </tr>
900
901 <tr>
902 <td>Variadic Copy Macro</td>
903 <td><code>va_copy(va_list <i>dest</i>, va_list <i>src</i>)</code></td>
904 <td>Makes a copy of the variadic function arguments</td>
905 <td></td>
906 <td></td>
907 </tr>
908
909 <tr>
910 <td>Weak Pointers</td>
911 <td><code>std::weak_ptr</code></td>
912 <td>Allows a weak reference to a <code>std::shared_ptr</code></td>
913 <td><a href="http://en.cppreference.com/w/cpp/memory/weak_ptr">
914 std::weak_ptr</a></td>
915 <td><a href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Ownership_and_Smart_Pointers">
916 Ownership and Smart Pointers</a></td>
917 </tr>
918
919 <tr>
920 <td>Wide String Support</td>
921 <td><code>std::wstring_convert</code>,
922 <code>std::wbuffer_convert</code>.
923 <code>std::codecvt_utf8</code>, <code>std::codecvt_utf16</code>,
924 and <code>std::codecvt_utf8_utf16</code></td>
925 <td>Converts between string encodings</td>
926 <td><a href="http://en.cppreference.com/w/cpp/locale/wstring_convert">
927 std::wstring_convert</a>,
928 <a href="http://en.cppreference.com/w/cpp/locale/wbuffer_convert">
929 std::wbuffer_convert</a>,
930 <a href="http://en.cppreference.com/w/cpp/locale/codecvt_utf8">
931 std::codecvt_utf8</a>,
932 <a href="http://en.cppreference.com/w/cpp/locale/codecvt_utf16">
933 std::codecvt_utf16</a>, and
934 <a href="http://en.cppreference.com/w/cpp/locale/codecvt_utf8_utf16">
935 std::codecvt_utf8_utf16</a>
936 </td>
937 <td>Non-UTF-8 text is banned by the
938 <a href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Non-ASCII_Characters">
939 C++ Style Guide</a>. However, may be useful for
940 consuming non-ASCII data.</td>
941 </tr>
942
943 </tbody>
944 </table>
945
946 </details>
947
948 </div>
949 </body>
950 </html>