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

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

Issue 699283002: c++11: Allow lambdas, with some restrictions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 1 month 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 | « chrome/browser/history/history_backend_unittest.cc ('k') | ui/base/layout.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 <link rel="stylesheet" href="c++11.css"> 10 <link rel="stylesheet" href="c++11.css">
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 <tr> 110 <tr>
111 <td>Final Specifier</td> 111 <td>Final Specifier</td>
112 <td><code>final</code></td> 112 <td><code>final</code></td>
113 <td> Indicates that a class or function is final and cannot be overridden</td> 113 <td> Indicates that a class or function is final and cannot be overridden</td>
114 <td><a href="http://en.cppreference.com/w/cpp/language/final">final Language Ref erence</a></td> 114 <td><a href="http://en.cppreference.com/w/cpp/language/final">final Language Ref erence</a></td>
115 <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/VTNZzi zN0zo">Discussion thread</a></td> 115 <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/VTNZzi zN0zo">Discussion thread</a></td>
116 </tr> 116 </tr>
117 117
118 <tr> 118 <tr>
119 <td>Lambda Expressions</td>
120 <td><code>[<i>captures</i>](<i>params</i>) -&gt; <i>ret</i> { <i>body</i> }</cod e></td>
121 <td>Anonymous functions</td>
122 <td><a href="http://en.cppreference.com/w/cpp/language/lambda">Lambda functions< /a></td>
123 <td>Do not bind or store lambdas; use <code>base::Bind</code> and
124 <code>base::Callback</code> instead, because they offer protection against a
125 large class of object lifetime mistakes. Don't use default captures
126 (<code>[=]</code>, <code>[&amp;]</code> &ndash; <a
127 href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Lambda_ expressions">Google Style Guide</a>).
128 Lambdas are typically useful as a parameter to methods or
129 functions that will use them immediately, such as those in
130 <code>&lt;algorithm&gt;</code>. <a
131 href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/D9Un nxBnciQ">Discussion
132 thread</a></td>
133 </tr>
134
135 <tr>
119 <td>Local Types as Template Arguments</td> 136 <td>Local Types as Template Arguments</td>
120 <td></td> 137 <td></td>
121 <td>Allows local and unnamed types as template arguments</td> 138 <td>Allows local and unnamed types as template arguments</td>
122 <td><a href="http://stackoverflow.com/questions/742607/using-local-classes-with- stl-algorithms"> 139 <td><a href="http://stackoverflow.com/questions/742607/using-local-classes-with- stl-algorithms">
123 Local types, types without linkage and unnamed types as template arguments</a></ td> 140 Local types, types without linkage and unnamed types as template arguments</a></ td>
124 <td>Usage should be rare. Approved without discussion.</td> 141 <td>Usage should be rare. Approved without discussion.</td>
125 </tr> 142 </tr>
126 143
127 <tr> 144 <tr>
128 <td>Null Pointer Constant</td> 145 <td>Null Pointer Constant</td>
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 425
409 <tr> 426 <tr>
410 <td>Inline Namespaces</td> 427 <td>Inline Namespaces</td>
411 <td><code>inline</code></td> 428 <td><code>inline</code></td>
412 <td>Allows better versioning of namespaces</td> 429 <td>Allows better versioning of namespaces</td>
413 <td><a href="http://en.cppreference.com/w/cpp/language/namespace">Namespaces</a> </td> 430 <td><a href="http://en.cppreference.com/w/cpp/language/namespace">Namespaces</a> </td>
414 <td>Unclear how it will work with components</td> 431 <td>Unclear how it will work with components</td>
415 </tr> 432 </tr>
416 433
417 <tr> 434 <tr>
418 <td>Lambda Expressions</td>
419 <td><code>[<i>captures</i>](<i>params</i>) -&gt; <i>ret</i> { <i>body</i> }</cod e></td>
420 <td>Anonymous functions</td>
421 <td><a href="http://en.cppreference.com/w/cpp/language/lambda">Lambda functions< /a></td>
422 <td>No default captures (<a href="https://google-styleguide.googlecode.com/svn/t runk/cppguide.html#Lambda_expressions">Google Style Guide</a>). <a href="https:/ /groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/D9UnnxBnciQ">Discus sion thread</a></td>
423 </tr>
424
425 <tr>
426 <td>Non-Static Class Member Initializers</td> 435 <td>Non-Static Class Member Initializers</td>
427 <td> 436 <td>
428 <code> 437 <code>
429 class C {<br /> 438 class C {<br />
430 <i>type</i> <i>var</i> = <i>value</i>;<br/> 439 <i>type</i> <i>var</i> = <i>value</i>;<br/>
431 C() // copy-initializes <i>var</i><br/> 440 C() // copy-initializes <i>var</i><br/>
432 </code> 441 </code>
433 <td>Allows non-static class members to be initialized at their definitions (outs ide constructors)</td> 442 <td>Allows non-static class members to be initialized at their definitions (outs ide constructors)</td>
434 <td><a href="http://en.cppreference.com/w/cpp/language/data_members"> 443 <td><a href="http://en.cppreference.com/w/cpp/language/data_members">
435 Non-static data members</a></td> 444 Non-static data members</a></td>
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 </tr> 965 </tr>
957 966
958 </tbody> 967 </tbody>
959 </table> 968 </table>
960 969
961 </details> 970 </details>
962 971
963 </div> 972 </div>
964 </body> 973 </body>
965 </html> 974 </html>
OLDNEW
« no previous file with comments | « chrome/browser/history/history_backend_unittest.cc ('k') | ui/base/layout.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698