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.
10 <link rel=
"stylesheet" href=
"c++11.css">
12 table tbody tr td:first-child {
20 <h1>C++
11 use in Chromium
</h1>
22 <p><i>This document lives at src/styleguide/c++/c++
11.html in a Chromium
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">
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>
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>
67 <td>Angle Bracket Parsing in Templates
</td>
68 <td><code>>></code> for
<code>> ></code> and
<br />
69 <code><::
</code> for
<code>< ::
</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>
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>
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>
95 <td>Local Types as Template Arguments
</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>
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.
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>
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>
133 <td>Standard Integers
</td>
134 <td>Typedefs within
<code><stdint.h
></code>
135 and
<code><inttypes
></code></td>
136 <td>Provides fixed-size integers independent of platforms
</td>
137 <td><a href=
"http://www.cplusplus.com/reference/cstdint/">
138 <stdint.h
> (cstdint)
</a></td>
139 <td>Already in common use in the codebase. Approved without discussion.
</td>
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>
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>
160 <td>Variadic Templates
</td>
161 <td><code>template
<<i>typename
</i> ...
<i>arg
</i>></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>
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
180 <table id=
"banned_list" class=
"unlined striped">
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>
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>
202 <td>Explicit Conversion Operators
</td>
203 <td><code>explicit operator
<i>type
</i>() {
204 <br /> // 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>
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&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>
222 <td>Rvalue References (and Move Semantics)
</td>
223 <td><code>T(T
&& t)
</code> and
<code>T
& operator=(T
&& 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>
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
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>
245 <td>UTF-
8, UTF-
16, UTF-
32 String Literals
</td>
246 <td><code>u8
"<i>string
</i>", u
"<i>string
</i>", U
"<i>string
</i>"</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>
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">
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>
275 <td>Alignment Features
</td>
277 <code>alignas
</code> specifier,
278 <code>std::alignment_of
<T
></code>,
279 <code>std::aligned_union
<Size, ...Types
></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>
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>
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>
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>
317 <td>Default Function Template Arguments
</td>
318 <td><code>template
<typename T =
<i>type
</i>> <br />
319 <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>
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>
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">
343 <td><a href=
"https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/Q5WmkAImanc">Discussion thread
</a></td>
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>
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>
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>
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>
385 <td>Lambda Expressions
</td>
386 <td><code>[
<i>captures
</i>](
<i>params
</i>) -
> <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>
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>
402 <td>Non-Static Class Member Initializers
</td>
406 <i>type
</i> <i>var
</i> =
<i>value
</i>;
<br/>
407 C() // copy-initializes
<i>var
</i><br/>
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>
416 <td>Raw String Literals
</td>
417 <td><code>string
<i>var
</i>=R
"(
<i>raw_string
</i>)
";
</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>
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>
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>
444 <h3 id=
"blacklist_stdlib">C++
11 Standard Library features
</h3>
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.
454 <table id=
"banned_stdlib" class=
"unlined striped">
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>
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
&</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>&s;</code>
473 should suffice in most cases. May be preferable
474 over
<code>&s;</code> for performing object
475 identity checks.
</td>
479 <td>Aligned Storage
</td>
480 <td><code>std::aligned_storage
<Size, Align
>::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>
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>
498 <td><code>std::atomic
</code> and others in
<code><atomic
></code></td>
499 <td>Fine-grained atomic types and operations
</td>
500 <td><a href=
"http://en.cppreference.com/w/cpp/atomic"><atomic
></a></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">
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
518 <td><a href=
"http://en.cppreference.com/w/cpp/iterator/begin">
520 <a href=
"http://en.cppreference.com/w/cpp/iterator/end">
522 <td>Useful for built-in arrays.
</td>
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>
534 <td>C Floating-Point Environment
</td>
535 <td><code><cfenv
></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
<cfenv
></a></td>
538 <td>Compilers do not support use
</td>
542 <td>Chrono Library
</td>
543 <td><code><chrono
></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>
550 <td>Complex Inverse Trigonometric and Hyperbolic Functions
</td>
551 <td>Functions within
<code><complex
></code></td>
552 <td>Adds inverse trigonomentric and hyperbolic non-member functions to
553 the
<code><complex
></code> library.
</td>
554 <td><a href=
"http://en.cppreference.com/w/cpp/numeric/complex">std::complex
</a></td>
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">
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>
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
583 <td>TODO: documentation link
</td>
584 <td>Use where element construction within a container
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>
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>
615 <td>Function Return Type Deduction
</td>
616 <td><code>std::result_of
<<i>Functor(ArgTypes...)
</i>></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>
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?
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>
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>
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">
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>
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>
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>
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
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>
694 <td>Initializer Lists
</td>
695 <td><code>std::initializer_list
<T
></code></td>
696 <td>Allows containers to be initialized with aggregate elements
</td>
697 <td>TODO: documentation link
</td>
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>
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>
722 <td>Random Number Generators
</td>
723 <td>Functions within
<code><random
></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>
731 <td>Ratio Template Class
</td>
732 <td><code>std::ratio
<<i>numerator
</i>,
<i>denominator
</i>></code></td>
733 <td>Provides compile-time rational numbers
</td>
734 <td>TODO: documentation link
</td>
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&seqNum=217">
745 Reference Wrappers
</a></td>
750 <td>Regex Library
</td>
751 <td><code><regex
></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>
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>
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>
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>
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>
806 <td>STL Algorithms
</td>
807 <td>Functions within
<code><algorithm
></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>
815 <td>System Errors
</td>
816 <td><code><system_error
></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>
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>
832 <td>Thread Library
</td>
833 <td><code><thread
> support, including
<future
>,
834 <mutex
>,
<condition_variable
></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>
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>
849 <td>Type-Generic Math Functions
</td>
850 <td>Functions within
<code><ctgmath
></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
<ctgmath
></a></td>
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>
874 <td>Class templates within
<code><type_traits
></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
<type_traits
></a></td>
882 <td>Unique Pointers
</td>
883 <td><code>std::unique_ptr
<<i>type
</i>></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>
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>
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>
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>
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>
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>