c++11: Alphabetize c++11.html
[chromium-blink-merge.git] / styleguide / c++ / c++11.html
blobb7f290878384d394982599ae6e1abb04596744ef
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%;
16 </style>
17 </head>
18 <body>
19 <div id="content">
20 <h1>C++11 use in Chromium</h1>
22 <p><i>This document lives at src/styleguide/c++/c++11.html in a Chromium
23 checkout.</i></p>
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>
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>
40 <p class="warning">Unless otherwise noted, <strong>no</strong> C++11
41 <strong>library</strong> features are allowed.</p>
43 <h2 id="whitelist">C++11 Allowed Features</h2>
45 <p>The following features are currently allowed.</p>
47 <table id="whitelist_lang_list" class="unlined striped">
48 <tbody>
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>
58 <tr>
59 <td>Aliases</td>
60 <td><code>using <i>new_alias</i> = <i>typename</i></code></td>
61 <td>Allow parameterized typedefs</td>
62 <td><a href="http://en.cppreference.com/w/cpp/language/type_alias">Type alias (using syntax)</a></td>
63 <td>Use instead of typedef, unless the header needs to be compatible with C. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/8dOAMzgR4ao">Discussion thread</a></td>
64 </tr>
66 <tr>
67 <td>Angle Bracket Parsing in Templates</td>
68 <td><code>&gt;&gt;</code> for <code>&gt; &gt;</code> and <br />
69 <code>&lt;::</code> for <code>&lt; ::</code></td>
70 <td>More intuitive parsing of template parameters</td>
71 <td><a href="http://stackoverflow.com/questions/15785496/c-templates-angle-brackets-pitfall-what-is-the-c11-fix">
72 C++ Templates Angle Brackets Pitfall</a></td>
73 <td>Recommended to increase readability. Approved without discussion.</td>
74 </tr>
76 <tr>
77 <td>Automatic Types</td>
78 <td><code>auto</code></td>
79 <td>Automatic type deduction</td>
80 <td>TODO: documentation link</td>
81 <td>Use according to the <a
82 href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#auto">Google
83 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>
84 </tr>
86 <tr>
87 <td>Final Specifier</td>
88 <td><code>final</code></td>
89 <td> Indicates that a class or function is final and cannot be overridden</td>
90 <td><a href="http://en.cppreference.com/w/cpp/language/final">final Language Reference</a></td>
91 <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>
92 </tr>
94 <tr>
95 <td>Local Types as Template Arguments</td>
96 <td></td>
97 <td>Allows local and unnamed types as template arguments</td>
98 <td><a href="http://stackoverflow.com/questions/742607/using-local-classes-with-stl-algorithms">
99 Local types, types without linkage and unnamed types as template arguments</a></td>
100 <td>Usage should be rare. Approved without discussion.</td>
101 </tr>
103 <tr>
104 <td>Null Pointer Constant</td>
105 <td><code>nullptr</code></td>
106 <td>Declares a type-safe null pointer</td>
107 <td>TODO: documentation link</td>
108 <td>Recommended for new code.
109 <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/4mijeJHzxLg">Discussion thread</a>.
110 <a href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#0_and_nullptr/NULL">Google Style Guide</a>.
111 Note: <code>std::nullptr_t</code> is a library feature and not available.
112 </td>
113 </tr>
115 <tr>
116 <td>Override Specifier</td>
117 <td><code>override</code></td>
118 <td>Indicates that a class or function overrides a base implementation</td>
119 <td><a href="http://en.cppreference.com/w/cpp/language/override">override Language Reference</a></td>
120 <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>
121 </tr>
123 <tr>
124 <td>Range-Based For Loops</td>
125 <td><code>for (<i>type</i> <i>var</i> : <i>range</i>)</code></td>
126 <td>Facilitates a more concise syntax for iterating over the elements
127 of a container (or a range of iterators) in a <code>for</code> loop</td>
128 <td>TODO: documentation link</td>
129 <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>
130 </tr>
132 <tr>
133 <td>Standard Integers</td>
134 <td>Typedefs within <code>&lt;stdint.h&gt;</code>
135 and <code>&lt;inttypes&gt;</code></td>
136 <td>Provides fixed-size integers independent of platforms</td>
137 <td><a href="http://www.cplusplus.com/reference/cstdint/">
138 &lt;stdint.h&gt; (cstdint)</a></td>
139 <td>Already in common use in the codebase. Approved without discussion.</td>
140 </tr>
142 <tr>
143 <td>Static Assertions</td>
144 <td><code>static_assert(<i>bool</i>, <i>string</i>)</code></td>
145 <td>Tests compile-time conditions</td>
146 <td><a href="http://en.cppreference.com/w/cpp/language/static_assert">Static Assertion</a></td>
147 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/POISBQEhGzU">Discussion thread</a></td>
148 </tr>
150 <tr>
151 <td>Variadic Macros</td>
152 <td><code>#define <i>MACRO</i>(...) <i>Impl</i>(<i>args</i>, __VA_ARGS__)</code></td>
153 <td>Allows macros that accept a variable number of arguments</td>
154 <td><a href="http://stackoverflow.com/questions/4786649/are-variadic-macros-nonstandard">
155 Are Variadic macros nonstandard?</a></td>
156 <td>Usage should be rare. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/sRx9j3CQqyA">Discussion thread</a></td>
157 </tr>
159 <tr>
160 <td>Variadic Templates</td>
161 <td><code>template &lt;<i>typename</i> ... <i>arg</i>&gt;</code></td>
162 <td>Allows templates that accept a variable number of arguments</td>
163 <td>TODO: documentation link</td>
164 <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>
165 </tr>
167 </tbody>
168 </table>
170 <h2 id="blacklist">C++11 Blacklist (Disallowed and Banned Features)</h2>
172 <p>This section lists features that are not allowed to be used yet.
174 <h3 id="blacklist_banned">C++11 Banned Features</h3>
176 <p>This section will list C++11 features that are not allowed in the Chromium
177 codebase.
178 </p>
180 <table id="banned_list" class="unlined striped">
181 <tbody>
183 <tr>
184 <th style='width:240px;'>Feature or Library</th>
185 <th style='width:240px;'>Snippet</th>
186 <th style='width:240px;'>Description</th>
187 <th style='width:240px;'>Documentation Link</th>
188 <th style='width:240px;'>Notes</th>
189 </tr>
191 <tr>
192 <td>Constant Expressions</td>
193 <td><code>constexpr</code></td>
194 <td>Compile-time constant expressions</td>
195 <td>TODO: documentation link</td>
196 <td>Doesn't work in MSVS2013. Reevalute once it does. <a
197 href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#constexpr">Google
198 Style Guide on <code>constexpr</code></a></td>
199 </tr>
201 <tr>
202 <td>Explicit Conversion Operators</td>
203 <td><code>explicit operator <i>type</i>() {
204 <br />&nbsp;&nbsp;// code<br /> }</code></td>
205 <td>Allows conversion operators that cannot be implicitly invoked</td>
206 <td><a href="http://en.cppreference.com/w/cpp/language/explicit">
207 explicit specifier</a></td>
208 <td><a href="https://connect.microsoft.com/VisualStudio/feedback/details/811334/bug-in-vs-2013-support-for-explicit-conversion-operators">Doesn't work in MSVS2013</a>. Reevaluate once it does. <a href="https://groups.google.com/a/chromium.org/d/msg/chromium-dev/zGF1SrQ-1HQ/BAiC12vwPeEJ">Discussion thread</a></td>
209 </tr>
211 <tr>
212 <td>Function Local Variable</td>
213 <td><code>__func__</code></td>
214 <td>Provides a local variable of the name of the enclosing
215 function for logging purposes</td>
216 <td><a href="http://www.informit.com/guides/content.aspx?g=cplusplus&amp;seqNum=338">
217 The __func__ Predeclared Identifier is Coming to C++</a></td>
218 <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>
219 </tr>
221 <tr>
222 <td>Rvalue References (and Move Semantics)</td>
223 <td><code>T(T&amp;&amp; t)</code> and <code>T&amp; operator=(T&amp;&amp; t)</code></td>
224 <td>Reference that only binds to a temporary object</td>
225 <td>TODO: documentation link</td>
226 <td>To be revisited in the future. Allowed in exceptional cases where approved by the OWNERS of src/styleguide/c++/.</td>
227 </tr>
229 <tr>
230 <td>UTF-16 and UTF-32 Support (16-Bit and 32-Bit Character Types)</td>
231 <td><code>char16_t</code> and <code>char32_t</code></td>
232 <td>Provides character types for handling 16-bit
233 and 32-bit code units (useful for encoding
234 UTF-16 and UTF-32 string data)</td>
235 <td><a href="http://en.cppreference.com/w/cpp/language/types">
236 Fundamental types</a></td>
237 <td>Doesn't work in MSVS2013. Reevaluate once it does. Non-UTF-8 text is
238 banned by the
239 <a href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Non-ASCII_Characters">
240 C++ Style Guide</a>. However, may be useful for
241 consuming non-ASCII data. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/ME2kL7_Kvyk">Discussion thread</a></td>
242 </tr>
244 <tr>
245 <td>UTF-8, UTF-16, UTF-32 String Literals</td>
246 <td><code>u8&quot;<i>string</i>&quot;, u&quot;<i>string</i>&quot;, U&quot;<i>string</i>&quot;</code></td>
247 <td>Enforces UTF-8, UTF-16, UTF-32 encoding on all string literals</td>
248 <td><a href="http://en.cppreference.com/w/cpp/language/string_literal">
249 string literal</a></td>
250 <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>
251 </tr>
253 </tbody>
254 </table>
256 <h3 id="blacklist_review">C++11 Features To Be Discussed</h3>
258 <p>The following C++ language features are currently disallowed.
259 See the top of this page on how to propose moving a feature from this list
260 into the allowed or banned sections. Note that not all of these features
261 work in all our compilers yet.</p>
263 <table id="blacklist_review_list" class="unlined striped">
264 <tbody>
266 <tr>
267 <th style='width:240px;'>Feature</th>
268 <th style='width:240px;'>Snippet</th>
269 <th style='width:240px;'>Description</th>
270 <th style='width:240px;'>Documentation Link</th>
271 <th style='width:240px;'>Notes</th>
272 </tr>
274 <tr>
275 <td>Alignment Features</td>
276 <td>
277 <code>alignas</code> specifier,
278 <code>std::alignment_of&lt;T&gt;</code>,
279 <code>std::aligned_union&lt;Size, ...Types&gt;</code> and
280 <code>std::max_align_t</code></td>
281 <td>Object alignment</td>
282 <td><a href="http://en.cppreference.com/w/cpp/types/alignment_of">std::alignment_of</a></td>
283 <td></td>
284 </tr>
286 <tr>
287 <td>Attributes</td>
288 <td><code>[[<i>attribute_name</i>]]</code></td>
289 <td>Attaches properties to declarations that
290 specific compiler implementations may use.</td>
291 <td><a href="http://www.codesynthesis.com/~boris/blog/2012/04/18/cxx11-generalized-attributes/">
292 C++11 generalized attributes</a></td>
293 <td></td>
294 </tr>
296 <tr>
297 <td>Declared Type Accessor</td>
298 <td><code>decltype(<i>expression</i>)</code></td>
299 <td>Provides a means to determine the type of an expression at compile-time,
300 useful most often in templates.</td>
301 <td><a href="http://en.cppreference.com/w/cpp/language/decltype">
302 decltype specifier</a></td>
303 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/_zoNvZd_dSo">Discussion thread</a></td>
304 </tr>
306 <tr>
307 <td>Default Function Creation</td>
308 <td><code><i>Function</i>(<i>arguments</i>) = default;</code></td>
309 <td>Instructs the compiler to generate a default version
310 of the indicated function</td>
311 <td><a href="http://stackoverflow.com/questions/823935/whats-the-point-in-defaulting-functions-in-c11">
312 What's the point in defaulting functions in C++11?</a></td>
313 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/qgU4mh_MpGA">Discussion thread</a></td>
314 </tr>
316 <tr>
317 <td>Default Function Template Arguments</td>
318 <td><code>template &lt;typename T = <i>type</i>&gt; <br />
319 &nbsp;&nbsp;<i>type</i> <i>Function</i>(T <i>var</i>) {}</code></td>
320 <td>Allow function templates, like classes, to have default arguments</td>
321 <td><a href="http://stackoverflow.com/questions/2447458/default-template-arguments-for-function-templates">
322 Default Template Arguments for Function Templates</a></td>
323 <td></td>
324 </tr>
326 <tr>
327 <td>Delegated Constructors</td>
328 <td><code>Class() : Class(0) {}</code><br />
329 <code>Class(<i>type</i> <i>var</i>) : Class(<i>var</i>, 0)</code></td>
330 <td>Allow overloaded constructors to use common initialization code</td>
331 <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">
332 Introduction to the C++11 feature: delegating constructors</a></td>
333 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/0zVA8Ctx3Xo">Discussion thread</a></td>
334 </tr>
336 <tr>
337 <td>Enumerated Type Classes</td>
338 <td><code>enum class <i>classname</i></code></td>
339 <td>Provide enums as full classes, with no implicit
340 conversion to booleans or integers</td>
341 <td><a href="http://stackoverflow.com/questions/6936030/do-we-really-need-enum-class-in-c11">
342 enum-class</a></td>
343 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/Q5WmkAImanc">Discussion thread</a></td>
344 </tr>
346 <tr>
347 <td>Exception Features</td>
348 <td><code>noexcept</code>, <code>exception_ptr</code>,
349 <code>current_exception()</code>, <code>rethrow_exception</code>,
350 and <code>nested_exception</code></td>
351 <td>Enhancements to exception throwing and handling</td>
352 <td><a href="http://en.cppreference.com/w/cpp/error/exception">
353 std::exception</a></td>
354 <td>Exceptions are banned by the
355 <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>
356 </tr>
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>
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>
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>
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>
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>
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>
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>
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>
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>
441 </tbody>
442 </table>
444 <h3 id="blacklist_stdlib">C++11 Standard Library features</h3>
446 <details>
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>
454 <table id="banned_stdlib" class="unlined striped">
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
943 </tbody>
944 </table>
946 </details>
948 </div>
949 </body>
950 </html>