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

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

Issue 2468633003: Allow inherited constructors and add a sample usage. (Closed)
Patch Set: Resync Created 4 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 | « no previous file | tools/gn/pool.h » ('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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 <tr> 177 <tr>
178 <td>Function Suppression</td> 178 <td>Function Suppression</td>
179 <td><code><i>Function</i>(<i>arguments</i>) = delete;</code></td> 179 <td><code><i>Function</i>(<i>arguments</i>) = delete;</code></td>
180 <td>Suppresses the implementation of a function, especially a synthetic function such as a copy constructor</td> 180 <td>Suppresses the implementation of a function, especially a synthetic function such as a copy constructor</td>
181 <td><a href="http://en.cppreference.com/w/cpp/language/function#Deleted_function s">Deleted functions</a></td> 181 <td><a href="http://en.cppreference.com/w/cpp/language/function#Deleted_function s">Deleted functions</a></td>
182 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /i1o7-RNRnMs">Discussion thread</a></td> 182 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /i1o7-RNRnMs">Discussion thread</a></td>
183 </tr> 183 </tr>
184 184
185 <tr> 185 <tr>
186 <td>Inherited Constructors</td>
187 <td><code>class Derived : Base {<br />
188 &nbsp;&nbsp;using Base::Base;<br />
189 };</code></td>
190 <td>Allows derived classes to inherit constructors from base classes</td>
191 <td><a href="http://en.cppreference.com/w/cpp/language/using_declaration#Inherit ing_constructors">Inheriting constructors</a></td>
192 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /BULzgIKZ-Ao">Discussion thread</a></td>
193 </tr>
194
195 <tr>
186 <td>Lambda Expressions</td> 196 <td>Lambda Expressions</td>
187 <td><code>[<i>captures</i>](<i>params</i>) -&gt; <i>ret</i> { <i>body</i> }</cod e></td> 197 <td><code>[<i>captures</i>](<i>params</i>) -&gt; <i>ret</i> { <i>body</i> }</cod e></td>
188 <td>Anonymous functions</td> 198 <td>Anonymous functions</td>
189 <td><a href="http://en.cppreference.com/w/cpp/language/lambda">Lambda functions< /a></td> 199 <td><a href="http://en.cppreference.com/w/cpp/language/lambda">Lambda functions< /a></td>
190 <td>Lambdas are typically useful as a parameter to methods or functions that wil l use them immediately, such as those in <code>&lt;algorithm&gt;</code>. Be care ful with default captures (<code>[=]</code>, <code>[&amp;]</code>), and do not b ind or store any capturing lambdas outside the lifetime of the stack frame they are defined in; use <code>base::Callback</code> for this instead, as it helps pr event object lifetime mistakes. (Captureless lambdas can be used with <code>base ::Bind</code> as they do not have the same risks.) <a href="https://google.githu b.io/styleguide/cppguide.html#Lambda_expressions">Google Style Guide</a>. <a hre f="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/D9UnnxBnc iQ">Discussion thread</a>. <a href="https://groups.google.com/a/chromium.org/for um/#!topic/cxx/QxjsPELDYdQ">Another discussion thread</a> (about captureless lam bdas and <code>base::Bind</code>).</td> 200 <td>Lambdas are typically useful as a parameter to methods or functions that wil l use them immediately, such as those in <code>&lt;algorithm&gt;</code>. Be care ful with default captures (<code>[=]</code>, <code>[&amp;]</code>), and do not b ind or store any capturing lambdas outside the lifetime of the stack frame they are defined in; use <code>base::Callback</code> for this instead, as it helps pr event object lifetime mistakes. (Captureless lambdas can be used with <code>base ::Bind</code> as they do not have the same risks.) <a href="https://google.githu b.io/styleguide/cppguide.html#Lambda_expressions">Google Style Guide</a>. <a hre f="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/D9UnnxBnc iQ">Discussion thread</a>. <a href="https://groups.google.com/a/chromium.org/for um/#!topic/cxx/QxjsPELDYdQ">Another discussion thread</a> (about captureless lam bdas and <code>base::Bind</code>).</td>
191 </tr> 201 </tr>
192 202
193 <tr> 203 <tr>
194 <td>Local Types as Template Arguments</td> 204 <td>Local Types as Template Arguments</td>
195 <td><code>void func() {<br /> 205 <td><code>void func() {<br />
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 679
670 <tr> 680 <tr>
671 <td>Attributes</td> 681 <td>Attributes</td>
672 <td><code>[[<i>attribute_name</i>]]</code></td> 682 <td><code>[[<i>attribute_name</i>]]</code></td>
673 <td>Attaches properties to declarations that specific compiler implementations m ay use.</td> 683 <td>Attaches properties to declarations that specific compiler implementations m ay use.</td>
674 <td><a href="http://www.codesynthesis.com/~boris/blog/2012/04/18/cxx11-generaliz ed-attributes/">C++11 generalized attributes</a></td> 684 <td><a href="http://www.codesynthesis.com/~boris/blog/2012/04/18/cxx11-generaliz ed-attributes/">C++11 generalized attributes</a></td>
675 <td></td> 685 <td></td>
676 </tr> 686 </tr>
677 687
678 <tr> 688 <tr>
679 <td>Inherited Constructors</td>
680 <td><code>class Derived : Base {<br />
681 &nbsp;&nbsp;using Base::Base;<br />
682 };</code></td>
683 <td>Allow derived classes to inherit constructors from base classes</td>
684 <td><a href="http://en.cppreference.com/w/cpp/language/using_declaration">Using- declaration</a></td>
685 <td>Reevaluate now that MSVS2015 is available. <a href="https://groups.google.co m/a/chromium.org/forum/#!topic/chromium-dev/BULzgIKZ-Ao">Discussion thread</a></ td>
686 </tr>
687
688 <tr>
689 <td>Raw String Literals</td> 689 <td>Raw String Literals</td>
690 <td><code>string <i>var</i>=R&quot;(<i>raw_string</i>)&quot;;</code></td> 690 <td><code>string <i>var</i>=R&quot;(<i>raw_string</i>)&quot;;</code></td>
691 <td>Allows a string to be encoded without any escape sequences, easing parsing i n regex expressions, for example</td> 691 <td>Allows a string to be encoded without any escape sequences, easing parsing i n regex expressions, for example</td>
692 <td><a href="http://en.cppreference.com/w/cpp/language/string_literal">string li teral</a></td> 692 <td><a href="http://en.cppreference.com/w/cpp/language/string_literal">string li teral</a></td>
693 <td>Beware of passing these as macro arguments, which can trigger a <a href="htt ps://gcc.gnu.org/bugzilla/show_bug.cgi?id=57824">lexer bug</a> on older GCC vers ions. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-d ev/2kWQHbbuMHI">Discussion thread</a></td> 693 <td>Beware of passing these as macro arguments, which can trigger a <a href="htt ps://gcc.gnu.org/bugzilla/show_bug.cgi?id=57824">lexer bug</a> on older GCC vers ions. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-d ev/2kWQHbbuMHI">Discussion thread</a></td>
694 </tr> 694 </tr>
695 695
696 <tr> 696 <tr>
697 <td>UTF-8, UTF-16, UTF-32 String Literals</td> 697 <td>UTF-8, UTF-16, UTF-32 String Literals</td>
698 <td><code>u8&quot;<i>string</i>&quot;, u&quot;<i>string</i>&quot;, U&quot;<i>str ing</i>&quot;</code></td> 698 <td><code>u8&quot;<i>string</i>&quot;, u&quot;<i>string</i>&quot;, U&quot;<i>str ing</i>&quot;</code></td>
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 <td><a href="http://en.cppreference.com/w/cpp/locale/wstring_convert">std::wstri ng_convert</a>, <a href="http://en.cppreference.com/w/cpp/locale/wbuffer_convert ">std::wbuffer_convert</a>, <a href="http://en.cppreference.com/w/cpp/locale/cod ecvt_utf8">std::codecvt_utf8</a>, <a href="http://en.cppreference.com/w/cpp/loca le/codecvt_utf16">std::codecvt_utf16</a>, <a href="http://en.cppreference.com/w/ cpp/locale/codecvt_utf8_utf16">std::codecvt_utf8_utf16</a></td> 928 <td><a href="http://en.cppreference.com/w/cpp/locale/wstring_convert">std::wstri ng_convert</a>, <a href="http://en.cppreference.com/w/cpp/locale/wbuffer_convert ">std::wbuffer_convert</a>, <a href="http://en.cppreference.com/w/cpp/locale/cod ecvt_utf8">std::codecvt_utf8</a>, <a href="http://en.cppreference.com/w/cpp/loca le/codecvt_utf16">std::codecvt_utf16</a>, <a href="http://en.cppreference.com/w/ cpp/locale/codecvt_utf8_utf16">std::codecvt_utf8_utf16</a></td>
929 <td>Non-UTF-8 text is banned by the <a href="https://google.github.io/styleguide /cppguide.html#Non-ASCII_Characters">Google Style Guide</a>. However, may be use ful for consuming non-ASCII data.</td> 929 <td>Non-UTF-8 text is banned by the <a href="https://google.github.io/styleguide /cppguide.html#Non-ASCII_Characters">Google Style Guide</a>. However, may be use ful for consuming non-ASCII data.</td>
930 </tr> 930 </tr>
931 931
932 </tbody> 932 </tbody>
933 </table> 933 </table>
934 934
935 </div> 935 </div>
936 </body> 936 </body>
937 </html> 937 </html>
OLDNEW
« no previous file with comments | « no previous file | tools/gn/pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698