Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: styleguide/c++/c++11.html

Issue 1610023003: Revert of Allow std::unordered_*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/tools/quic/quic_simple_server_session_test.cc ('k') | ui/base/x/selection_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
356 356
357 <tr> 357 <tr>
358 <td>Containers containing movable types</td> 358 <td>Containers containing movable types</td>
359 <td><code>vector&lt;scoped_ptr&gt;</code></td> 359 <td><code>vector&lt;scoped_ptr&gt;</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>Lexicographical struct comparison</td>
367 <td><code>tie(a, b, c) &lt;<br>&nbsp; tie(rhs.a, rhs.b, rhs.c)</code></td>
368 <td>Idiom for <code>operator&lt;</code> implementation</td>
369 <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>
371 </tr>
372
373 <tr>
374 <td>Move Iterator Adaptor</td>
375 <td><code>std::make_move_iterator()</code></td>
376 <td>Wraps an iterator so that it moves objects instead of copying them.</td>
377 <td><a href="http://en.cppreference.com/w/cpp/iterator/make_move_iterator">std:: make_move_iterator</a></td>
378 <td>Useful to move objects between containers that contain move-only types like <code>scoped_ptr</code>. <a href="https://groups.google.com/a/chromium.org/forum /#!topic/cxx/lccnUljOHQU">Discussion thread</a></td>
379 </tr>
380
381 <tr>
382 <td>Move Semantics</td>
383 <td><code>std::move()</code></td>
384 <td>Facilitates efficient move operations</td>
385 <td><a href="http://en.cppreference.com/w/cpp/utility/move"><code>std::move</cod e> reference</a></td>
386 <td><a href='https://groups.google.com/a/chromium.org/forum/#!topic/cxx/x_dWFxJF dbM'>Discussion thread</a></td>
387 </tr>
388
389 <tr>
390 <td>Range Move</td>
391 <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>
393 <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>
395 </tr>
396
397 <tr>
366 <td>Forwarding references</td> 398 <td>Forwarding references</td>
367 <td><code>std::forward()</code></td> 399 <td><code>std::forward()</code></td>
368 <td>Perfectly forwards arguments (including rvalues)</td> 400 <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> 401 <td><a href="http://en.cppreference.com/w/cpp/utility/forward"><code>std::forwar d</code></a></td>
370 <td> 402 <td>
371 Allowed, though usage should be rare (primarily for forwarding constructor arg uments, or in carefully reviewed library code). 403 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> 404 <a href="https://groups.google.com/a/chromium.org/d/topic/cxx/-O7euklhSxs/disc ussion">Discussion thread</a>
373 </td> 405 </td>
374 </tr> 406 </tr>
375 407
376 <tr> 408 <tr>
377 <td>Lexicographical struct comparison</td>
378 <td><code>tie(a, b, c) &lt;<br>&nbsp; tie(rhs.a, rhs.b, rhs.c)</code></td>
379 <td>Idiom for <code>operator&lt;</code> implementation</td>
380 <td><a href="http://en.cppreference.com/w/cpp/utility/tuple/tie">std::tie</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>
382 </tr>
383
384 <tr>
385 <td>Move Iterator Adaptor</td>
386 <td><code>std::make_move_iterator()</code></td>
387 <td>Wraps an iterator so that it moves objects instead of copying them.</td>
388 <td><a href="http://en.cppreference.com/w/cpp/iterator/make_move_iterator">std:: make_move_iterator</a></td>
389 <td>Useful to move objects between containers that contain move-only types like <code>scoped_ptr</code>. <a href="https://groups.google.com/a/chromium.org/forum /#!topic/cxx/lccnUljOHQU">Discussion thread</a></td>
390 </tr>
391
392 <tr>
393 <td>Move Semantics</td>
394 <td><code>std::move()</code></td>
395 <td>Facilitates efficient move operations</td>
396 <td><a href="http://en.cppreference.com/w/cpp/utility/move"><code>std::move</cod e> reference</a></td>
397 <td><a href='https://groups.google.com/a/chromium.org/forum/#!topic/cxx/x_dWFxJF dbM'>Discussion thread</a></td>
398 </tr>
399
400 <tr>
401 <td>Range Move</td>
402 <td><code>std::move()</code></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>
404 <td><a href="http://en.cppreference.com/w/cpp/algorithm/move"><code>std::move</c ode> reference</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>
406 </tr>
407
408 <tr>
409 <td>Type Traits</td> 409 <td>Type Traits</td>
410 <td>Class templates within <code>&lt;type_traits&gt;</code></td> 410 <td>Class templates within <code>&lt;type_traits&gt;</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 &lt;type_traits&gt;</a></td> 413 Standard library header &lt;type_traits&gt;</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>&lt;cmath&gt;</code></td> 418 <td>Types, functions, and constants from <code>&lt;cmath&gt;</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>&lt;cmath&gt;< /code></a></td> 421 <td><a href="http://en.cppreference.com/w/cpp/header/cmath"><code>&lt;cmath&gt;< /code></a></td>
422 <td>Anything in <code>&lt;cmath&gt;</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>&lt;cmath&gt;</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
436 </tbody> 425 </tbody>
437 </table> 426 </table>
438 427
439 <h2 id="blacklist">C++11 Blacklist (Disallowed and Banned Features)</h2> 428 <h2 id="blacklist">C++11 Blacklist (Disallowed and Banned Features)</h2>
440 429
441 <p>This section lists features that are not allowed to be used yet. 430 <p>This section lists features that are not allowed to be used yet.
442 431
443 <h3 id="blacklist_banned"><a name="core-blacklist"></a>C++11 Banned Features</h3 > 432 <h3 id="blacklist_banned"><a name="core-blacklist"></a>C++11 Banned Features</h3 >
444 433
445 <p>This section lists C++11 features that are not allowed in the Chromium 434 <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
1062 <tr> 1051 <tr>
1063 <td>Unique Pointers</td> 1052 <td>Unique Pointers</td>
1064 <td><code>std::unique_ptr&lt;<i>type</i>&gt;</code></td> 1053 <td><code>std::unique_ptr&lt;<i>type</i>&gt;</code></td>
1065 <td>Defines a pointer with clear and unambiguous ownership</td> 1054 <td>Defines a pointer with clear and unambiguous ownership</td>
1066 <td>TODO: documentation link</td> 1055 <td>TODO: documentation link</td>
1067 <td><a href="https://google.github.io/styleguide/cppguide.html#Ownership_and_Sma rt_Pointers"> 1056 <td><a href="https://google.github.io/styleguide/cppguide.html#Ownership_and_Sma rt_Pointers">
1068 Ownership and Smart Pointers</a></td> 1057 Ownership and Smart Pointers</a></td>
1069 </tr> 1058 </tr>
1070 1059
1071 <tr> 1060 <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
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>
OLDNEW
« no previous file with comments | « net/tools/quic/quic_simple_server_session_test.cc ('k') | ui/base/x/selection_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698