OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 <html> | 7 <html> |
8 <head> | 8 <head> |
9 <meta charset="utf-8"> | 9 <meta charset="utf-8"> |
10 <title>C++11 use in Chromium</title> | 10 <title>C++11 use in Chromium</title> |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 | 356 |
357 <tr> | 357 <tr> |
358 <td>Containers containing movable types</td> | 358 <td>Containers containing movable types</td> |
359 <td><code>vector<scoped_ptr></code></td> | 359 <td><code>vector<scoped_ptr></code></td> |
360 <td>Enables containers that contain move-only types like <code>scoped_ptr</code>
</td> | 360 <td>Enables containers that contain move-only types like <code>scoped_ptr</code>
</td> |
361 <td>TODO</td> | 361 <td>TODO</td> |
362 <td>Allows getting rid of <a href="http://crbug.com/554289">ScopedVector</a></td
> | 362 <td>Allows getting rid of <a href="http://crbug.com/554289">ScopedVector</a></td
> |
363 </tr> | 363 </tr> |
364 | 364 |
365 <tr> | 365 <tr> |
| 366 <td>Forwarding references</td> |
| 367 <td><code>std::forward()</code></td> |
| 368 <td>Perfectly forwards arguments (including rvalues)</td> |
| 369 <td><a href="http://en.cppreference.com/w/cpp/utility/forward"><code>std::forwar
d</code></a></td> |
| 370 <td> |
| 371 Allowed, though usage should be rare (primarily for forwarding constructor arg
uments, or in carefully reviewed library code). |
| 372 <a href="https://groups.google.com/a/chromium.org/d/topic/cxx/-O7euklhSxs/disc
ussion">Discussion thread</a> |
| 373 </td> |
| 374 </tr> |
| 375 |
| 376 <tr> |
366 <td>Lexicographical struct comparison</td> | 377 <td>Lexicographical struct comparison</td> |
367 <td><code>tie(a, b, c) <<br> tie(rhs.a, rhs.b, rhs.c)</code></td> | 378 <td><code>tie(a, b, c) <<br> tie(rhs.a, rhs.b, rhs.c)</code></td> |
368 <td>Idiom for <code>operator<</code> implementation</td> | 379 <td>Idiom for <code>operator<</code> implementation</td> |
369 <td><a href="http://en.cppreference.com/w/cpp/utility/tuple/tie">std::tie</a></t
d> | 380 <td><a href="http://en.cppreference.com/w/cpp/utility/tuple/tie">std::tie</a></t
d> |
370 <td>General use of <code>std::tuple</code>, and <code>std::tie</code> for unpack
ing or multiple assignments is still not allowed. <a href="https://groups.google
.com/a/chromium.org/d/topic/cxx/3DZ64dIMRTY/discussion">Discussion thread</a></t
d> | 381 <td>General use of <code>std::tuple</code>, and <code>std::tie</code> for unpack
ing or multiple assignments is still not allowed. <a href="https://groups.google
.com/a/chromium.org/d/topic/cxx/3DZ64dIMRTY/discussion">Discussion thread</a></t
d> |
371 </tr> | 382 </tr> |
372 | 383 |
373 <tr> | 384 <tr> |
374 <td>Move Iterator Adaptor</td> | 385 <td>Move Iterator Adaptor</td> |
375 <td><code>std::make_move_iterator()</code></td> | 386 <td><code>std::make_move_iterator()</code></td> |
(...skipping 12 matching lines...) Expand all Loading... |
388 | 399 |
389 <tr> | 400 <tr> |
390 <td>Range Move</td> | 401 <td>Range Move</td> |
391 <td><code>std::move()</code></td> | 402 <td><code>std::move()</code></td> |
392 <td>Moves contents of an iterator range to a different iterator. This is a count
erpart of std::copy that applies std::move() to each element.</td> | 403 <td>Moves contents of an iterator range to a different iterator. This is a count
erpart of std::copy that applies std::move() to each element.</td> |
393 <td><a href="http://en.cppreference.com/w/cpp/algorithm/move"><code>std::move</c
ode> reference</a></td> | 404 <td><a href="http://en.cppreference.com/w/cpp/algorithm/move"><code>std::move</c
ode> reference</a></td> |
394 <td>This is allowed, but there is almost always a way to write code without usin
g this version of std::move. Not using it usually results in cleaner, easier to
read, and less confusing code. <a href='https://groups.google.com/a/chromium.org
/forum/#!topic/cxx/8WzmtYrZvQ8'>Discussion thread</a></td> | 405 <td>This is allowed, but there is almost always a way to write code without usin
g this version of std::move. Not using it usually results in cleaner, easier to
read, and less confusing code. <a href='https://groups.google.com/a/chromium.org
/forum/#!topic/cxx/8WzmtYrZvQ8'>Discussion thread</a></td> |
395 </tr> | 406 </tr> |
396 | 407 |
397 <tr> | 408 <tr> |
398 <td>Forwarding references</td> | |
399 <td><code>std::forward()</code></td> | |
400 <td>Perfectly forwards arguments (including rvalues)</td> | |
401 <td><a href="http://en.cppreference.com/w/cpp/utility/forward"><code>std::forwar
d</code></a></td> | |
402 <td> | |
403 Allowed, though usage should be rare (primarily for forwarding constructor arg
uments, or in carefully reviewed library code). | |
404 <a href="https://groups.google.com/a/chromium.org/d/topic/cxx/-O7euklhSxs/disc
ussion">Discussion thread</a> | |
405 </td> | |
406 </tr> | |
407 | |
408 <tr> | |
409 <td>Type Traits</td> | 409 <td>Type Traits</td> |
410 <td>Class templates within <code><type_traits></code></td> | 410 <td>Class templates within <code><type_traits></code></td> |
411 <td>Allows compile-time inspection of the properties of types</td> | 411 <td>Allows compile-time inspection of the properties of types</td> |
412 <td><a href="http://en.cppreference.com/w/cpp/header/type_traits"> | 412 <td><a href="http://en.cppreference.com/w/cpp/header/type_traits"> |
413 Standard library header <type_traits></a></td> | 413 Standard library header <type_traits></a></td> |
414 <td>Note that not all type traits are available on all platforms (eg std::underl
ying_type doesn't work in libstdc++4.6). Use judiciously. <a href='https://group
s.google.com/a/chromium.org/forum/#!topic/cxx/vCxo4tZNd_M'>Discussion thread</a>
</td> | 414 <td>Note that not all type traits are available on all platforms (eg std::underl
ying_type doesn't work in libstdc++4.6). Use judiciously. <a href='https://group
s.google.com/a/chromium.org/forum/#!topic/cxx/vCxo4tZNd_M'>Discussion thread</a>
</td> |
415 </tr> | 415 </tr> |
416 | 416 |
417 <tr> | 417 <tr> |
418 <td>Types, functions, and constants from <code><cmath></code></td> | 418 <td>Types, functions, and constants from <code><cmath></code></td> |
419 <td><code>std::round()</code>, <code>std::isnan()</code>, and others</td> | 419 <td><code>std::round()</code>, <code>std::isnan()</code>, and others</td> |
420 <td>Useful for math-related code</td> | 420 <td>Useful for math-related code</td> |
421 <td><a href="http://en.cppreference.com/w/cpp/header/cmath"><code><cmath><
/code></a></td> | 421 <td><a href="http://en.cppreference.com/w/cpp/header/cmath"><code><cmath><
/code></a></td> |
422 <td>Anything in <code><cmath></code> is allowed. <a href="https://groups.g
oogle.com/a/chromium.org/forum/#!topic/cxx/P-1bFBXMeUk">Discussion thread</a></t
d> | 422 <td>Anything in <code><cmath></code> is allowed. <a href="https://groups.g
oogle.com/a/chromium.org/forum/#!topic/cxx/P-1bFBXMeUk">Discussion thread</a></t
d> |
423 </tr> | 423 </tr> |
424 | 424 |
| 425 <tr> |
| 426 <td>Unordered Associative Containers</td> |
| 427 <td><code>std::unordered_set</code>, <code>std::unordered_map</code>, |
| 428 <code>std::unordered_multiset</code>, and <code>std::unordered_multimap</code></
td> |
| 429 <td>Allows efficient containers of key/value pairs</td> |
| 430 <td><a href="http://en.cppreference.com/w/cpp/container/unordered_map">std::unor
dered_map</a> |
| 431 and <a href="http://en.cppreference.com/w/cpp/container/unordered_set">std::unor
dered_set</a> |
| 432 </td> |
| 433 <td>Per the <a href="https://google.github.io/styleguide/cppguide.html#std_hash"
>Google style guide</a>, specify custom hashers instead of specializing <code>st
d::hash</code> for custom types. <a href="https://groups.google.com/a/chromium.o
rg/forum/#!topic/cxx/nCdjQqnouO4">Discussion thread</a>.</td> |
| 434 </tr> |
| 435 |
425 </tbody> | 436 </tbody> |
426 </table> | 437 </table> |
427 | 438 |
428 <h2 id="blacklist">C++11 Blacklist (Disallowed and Banned Features)</h2> | 439 <h2 id="blacklist">C++11 Blacklist (Disallowed and Banned Features)</h2> |
429 | 440 |
430 <p>This section lists features that are not allowed to be used yet. | 441 <p>This section lists features that are not allowed to be used yet. |
431 | 442 |
432 <h3 id="blacklist_banned"><a name="core-blacklist"></a>C++11 Banned Features</h3
> | 443 <h3 id="blacklist_banned"><a name="core-blacklist"></a>C++11 Banned Features</h3
> |
433 | 444 |
434 <p>This section lists C++11 features that are not allowed in the Chromium | 445 <p>This section lists C++11 features that are not allowed in the Chromium |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 <tr> | 1062 <tr> |
1052 <td>Unique Pointers</td> | 1063 <td>Unique Pointers</td> |
1053 <td><code>std::unique_ptr<<i>type</i>></code></td> | 1064 <td><code>std::unique_ptr<<i>type</i>></code></td> |
1054 <td>Defines a pointer with clear and unambiguous ownership</td> | 1065 <td>Defines a pointer with clear and unambiguous ownership</td> |
1055 <td>TODO: documentation link</td> | 1066 <td>TODO: documentation link</td> |
1056 <td><a href="https://google.github.io/styleguide/cppguide.html#Ownership_and_Sma
rt_Pointers"> | 1067 <td><a href="https://google.github.io/styleguide/cppguide.html#Ownership_and_Sma
rt_Pointers"> |
1057 Ownership and Smart Pointers</a></td> | 1068 Ownership and Smart Pointers</a></td> |
1058 </tr> | 1069 </tr> |
1059 | 1070 |
1060 <tr> | 1071 <tr> |
1061 <td>Unordered Associative Containers</td> | |
1062 <td><code>std::unordered_set</code>, <code>std::unordered_map</code>, | |
1063 <code>std::unordered_multiset</code>, and <code>std::unordered_multimap</code></
td> | |
1064 <td>Allows efficient containers of key/value pairs</td> | |
1065 <td><a href="http://en.cppreference.com/w/cpp/container/unordered_map">std::unor
dered_map</a> | |
1066 and <a href="http://en.cppreference.com/w/cpp/container/unordered_set">std::unor
dered_set</a> | |
1067 </td> | |
1068 <td></td> | |
1069 </tr> | |
1070 | |
1071 <tr> | |
1072 <td>Variadic Copy Macro</td> | 1072 <td>Variadic Copy Macro</td> |
1073 <td><code>va_copy(va_list <i>dest</i>, va_list <i>src</i>)</code></td> | 1073 <td><code>va_copy(va_list <i>dest</i>, va_list <i>src</i>)</code></td> |
1074 <td>Makes a copy of the variadic function arguments</td> | 1074 <td>Makes a copy of the variadic function arguments</td> |
1075 <td></td> | 1075 <td></td> |
1076 <td></td> | 1076 <td></td> |
1077 </tr> | 1077 </tr> |
1078 | 1078 |
1079 <tr> | 1079 <tr> |
1080 <td>Weak Pointers</td> | 1080 <td>Weak Pointers</td> |
1081 <td><code>std::weak_ptr</code></td> | 1081 <td><code>std::weak_ptr</code></td> |
(...skipping 27 matching lines...) Expand all Loading... |
1109 C++ Style Guide</a>. However, may be useful for | 1109 C++ Style Guide</a>. However, may be useful for |
1110 consuming non-ASCII data.</td> | 1110 consuming non-ASCII data.</td> |
1111 </tr> | 1111 </tr> |
1112 | 1112 |
1113 </tbody> | 1113 </tbody> |
1114 </table> | 1114 </table> |
1115 | 1115 |
1116 </div> | 1116 </div> |
1117 </body> | 1117 </body> |
1118 </html> | 1118 </html> |
OLD | NEW |