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

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

Issue 2449973006: Styleguide cleanup part 1. (Closed)
Patch Set: Remove accidentally-inserted sentence. 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 | no next file » | 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 <th style='width:260px;'>Snippet</th> 71 <th style='width:260px;'>Snippet</th>
72 <th style='width:240px;'>Description</th> 72 <th style='width:240px;'>Description</th>
73 <th style='width:240px;'>Documentation Link</th> 73 <th style='width:240px;'>Documentation Link</th>
74 <th style='width:240px;'>Notes and Discussion Thread</th> 74 <th style='width:240px;'>Notes and Discussion Thread</th>
75 </tr> 75 </tr>
76 76
77 <tr> 77 <tr>
78 <td>__func__ Local Variable</td> 78 <td>__func__ Local Variable</td>
79 <td><code>__func__</code></td> 79 <td><code>__func__</code></td>
80 <td>Provides a local variable containing the name of the enclosing function</td> 80 <td>Provides a local variable containing the name of the enclosing function</td>
81 <td><a href="https://msdn.microsoft.com/en-us/library/dn919276.aspx">__func__</a ></td> 81 <td><a href="http://en.cppreference.com/w/cpp/language/function#func">__func__</ a></td>
82 <td>Use instead of the non-standard <code>__FUNCTION__</code>. <a href="https:// groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/ojGfcgSDzHM">Discuss ion thread</a></td> 82 <td>Use instead of the non-standard <code>__FUNCTION__</code>. <a href="https:// groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/ojGfcgSDzHM">Discuss ion thread</a></td>
83 </tr> 83 </tr>
84 84
85 <tr> 85 <tr>
86 <td>Aliases</td> 86 <td>Aliases</td>
87 <td><code>using <i>new_alias</i> = <i>typename</i></code></td> 87 <td><code>using <i>new_alias</i> = <i>typename</i></code></td>
88 <td>Allow parameterized typedefs</td> 88 <td>Allow parameterized typedefs</td>
89 <td><a href="http://en.cppreference.com/w/cpp/language/type_alias">Type alias (u sing syntax)</a></td> 89 <td><a href="http://en.cppreference.com/w/cpp/language/type_alias">Type alias, a lias template</a></td>
danakj 2016/10/29 01:02:47 I think calling out the word "using" was useful he
Peter Kasting 2016/10/29 06:15:37 I'm happy to call it out in the other sections, bu
90 <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/8dOAMz gR4ao">Discussion thread</a></td> 90 <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/8dOAMz gR4ao">Discussion thread</a></td>
91 </tr> 91 </tr>
92 92
93 <tr> 93 <tr>
94 <td>Angle Bracket Parsing in Templates</td> 94 <td>Angle Bracket Parsing in Templates</td>
95 <td><code>&gt;&gt;</code> for <code>&gt; &gt;</code>, <code>&lt;::</code> for <c ode>&lt; ::</code></td> 95 <td><code>&gt;&gt;</code> for <code>&gt; &gt;</code>, <code>&lt;::</code> for <c ode>&lt; ::</code></td>
96 <td>More intuitive parsing of template parameters</td> 96 <td>More intuitive parsing of template parameters</td>
97 <td><a href="http://stackoverflow.com/questions/15785496/c-templates-angle-brack ets-pitfall-what-is-the-c11-fix">C++ Templates Angle Brackets Pitfall</a></td> 97 <td><a href="http://stackoverflow.com/questions/15785496/c-templates-angle-brack ets-pitfall-what-is-the-c11-fix">C++ templates angle brackets pitfall</a></td>
98 <td>Recommended to increase readability. Approved without discussion.</td> 98 <td>Recommended to increase readability. Approved without discussion.</td>
99 </tr> 99 </tr>
100 100
101 <tr> 101 <tr>
102 <td>Arrays</td> 102 <td>Arrays</td>
103 <td><code>std::array</code></td> 103 <td><code>std::array</code></td>
104 <td>A fixed-size replacement for built-in arrays, with STL support</td> 104 <td>A fixed-size replacement for built-in arrays, with STL support</td>
105 <td><a href="http://en.cppreference.com/w/cpp/container/array">std::array</a></t d> 105 <td><a href="http://en.cppreference.com/w/cpp/container/array">std::array</a></t d>
106 <td>Useful in performance-critical situations, with small, fixed-size arrays. In most cases, consider std::vector instead. std::vector is cheaper to std::move a nd is more widely used. <a href="https://groups.google.com/a/chromium.org/forum/ #!topic/cxx/pVRQCRWHEU8">Discussion thread</a>.</td> 106 <td>Useful in performance-critical situations, with small, fixed-size arrays. In most cases, consider std::vector instead. std::vector is cheaper to std::move a nd is more widely used. <a href="https://groups.google.com/a/chromium.org/forum/ #!topic/cxx/pVRQCRWHEU8">Discussion thread</a>.</td>
107 </tr> 107 </tr>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 <td><a href="https://www.ibm.com/developerworks/community/blogs/5894415f-be62-4b c0-81c5-3956e82276f3/entry/introduction_to_the_c_11_feature_delegating_construct ors?lang=en">Introduction to the C++11 feature: delegating constructors</a></td> 155 <td><a href="https://www.ibm.com/developerworks/community/blogs/5894415f-be62-4b c0-81c5-3956e82276f3/entry/introduction_to_the_c_11_feature_delegating_construct ors?lang=en">Introduction to the C++11 feature: delegating constructors</a></td>
156 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /0zVA8Ctx3Xo">Discussion thread</a></td> 156 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /0zVA8Ctx3Xo">Discussion thread</a></td>
157 </tr> 157 </tr>
158 158
159 <tr> 159 <tr>
160 <td>Enumerated Type Classes and Enum Bases</td> 160 <td>Enumerated Type Classes and Enum Bases</td>
161 <td><code>enum class <i>classname</i><br /> 161 <td><code>enum class <i>classname</i><br />
162 enum class <i>classname</i> : <i>base-type</i><br /> 162 enum class <i>classname</i> : <i>base-type</i><br />
163 enum <i>enumname</i> : <i>base-type</i></code></td> 163 enum <i>enumname</i> : <i>base-type</i></code></td>
164 <td>Provide enums as full classes, with no implicit conversion to booleans or in tegers. Provide an explicit underlying type for enum classes and regular enums.< /td> 164 <td>Provide enums as full classes, with no implicit conversion to booleans or in tegers. Provide an explicit underlying type for enum classes and regular enums.< /td>
165 <td><a href="http://www.stroustrup.com/C++11FAQ.html#enum">enum-class</a></td> 165 <td><a href="http://en.cppreference.com/w/cpp/language/enum">enumeration declara tion</a></td>
166 <td>Enum classes are still enums and follow enum naming rules (which means SHOUT Y_CASE in the <a href="http://www.chromium.org/developers/coding-style#Naming">C hromium Style Guide</a>). <a href="https://groups.google.com/a/chromium.org/foru m/#!topic/chromium-dev/Q5WmkAImanc">Discussion thread</a></td> 166 <td>Enum classes are still enums and follow enum naming rules (which means SHOUT Y_CASE in the <a href="http://www.chromium.org/developers/coding-style#Naming">C hromium Style Guide</a>). <a href="https://groups.google.com/a/chromium.org/foru m/#!topic/chromium-dev/Q5WmkAImanc">Discussion thread</a></td>
167 </tr> 167 </tr>
168 168
169 <tr> 169 <tr>
170 <td>Explicit Conversion Operators</td> 170 <td>Explicit Conversion Operators</td>
171 <td><code>explicit operator <i>type</i>() { ... }</code></td> 171 <td><code>explicit operator <i>type</i>() { ... }</code></td>
172 <td>Allows conversion operators that cannot be implicitly invoked</td> 172 <td>Allows conversion operators that cannot be implicitly invoked</td>
173 <td><a href="http://en.cppreference.com/w/cpp/language/explicit">explicit specif ier</a></td> 173 <td><a href="http://en.cppreference.com/w/cpp/language/explicit">explicit specif ier</a></td>
174 <td>Prefer to the "safe bool" idiom. <a href="https://groups.google.com/a/chromi um.org/d/msg/chromium-dev/zGF1SrQ-1HQ/BAiC12vwPeEJ">Discussion thread</a></td> 174 <td>Prefer to the "safe bool" idiom. <a href="https://groups.google.com/a/chromi um.org/d/msg/chromium-dev/zGF1SrQ-1HQ/BAiC12vwPeEJ">Discussion thread</a></td>
175 </tr> 175 </tr>
176 176
177 <tr> 177 <tr>
178 <td>Final Specifier</td> 178 <td>Final Specifier</td>
179 <td><code>final</code></td> 179 <td><code>final</code></td>
180 <td> Indicates that a class or function is final and cannot be overridden</td> 180 <td> Indicates that a class or function is final and cannot be overridden</td>
181 <td><a href="http://en.cppreference.com/w/cpp/language/final">final Language Ref erence</a></td> 181 <td><a href="http://en.cppreference.com/w/cpp/language/final">final specifier</a ></td>
182 <td>Recommended for new code. <a href="https://groups.google.com/a/chromium.org/ forum/#!topic/chromium-dev/VTNZzizN0zo">Discussion thread</a></td> 182 <td>Recommended for new code. <a href="https://groups.google.com/a/chromium.org/ forum/#!topic/chromium-dev/VTNZzizN0zo">Discussion thread</a></td>
183 </tr> 183 </tr>
184 184
185 <tr> 185 <tr>
186 <td>Function Suppression</td> 186 <td>Function Suppression</td>
187 <td><code><i>Function</i>(<i>arguments</i>) = delete;</code></td> 187 <td><code><i>Function</i>(<i>arguments</i>) = delete;</code></td>
188 <td>Suppresses the implementation of a function, especially a synthetic function such as a copy constructor</td> 188 <td>Suppresses the implementation of a function, especially a synthetic function such as a copy constructor</td>
189 <td>TODO: documentation link</td> 189 <td><a href="http://en.cppreference.com/w/cpp/language/function#Deleted_function s">Deleted functions</a></td>
190 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /i1o7-RNRnMs">Discussion thread</a></td> 190 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /i1o7-RNRnMs">Discussion thread</a></td>
191 </tr> 191 </tr>
192 192
193 <tr> 193 <tr>
194 <td>Lambda Expressions</td> 194 <td>Lambda Expressions</td>
195 <td><code>[<i>captures</i>](<i>params</i>) -&gt; <i>ret</i> { <i>body</i> }</cod e></td> 195 <td><code>[<i>captures</i>](<i>params</i>) -&gt; <i>ret</i> { <i>body</i> }</cod e></td>
196 <td>Anonymous functions</td> 196 <td>Anonymous functions</td>
197 <td><a href="http://en.cppreference.com/w/cpp/language/lambda">Lambda functions< /a></td> 197 <td><a href="http://en.cppreference.com/w/cpp/language/lambda">Lambda functions< /a></td>
198 <td>Do not bind or store capturing lambdas outside the lifetime of the stack fra me they are defined in. Captureless lambdas can be used with <code>base::Callbac k</code>, such as <code>base::Bind([](int j){}, i);</code>, because they offer p rotection against a large class of object lifetime mistakes. Don't use default c aptures (<code>[=]</code>, <code>[&amp;]</code> &ndash; <a href="https://google. github.io/styleguide/cppguide.html#Lambda_expressions">Google Style Guide</a>). Lambdas are typically useful as a parameter to methods or functions that will us e them immediately, such as those in <code>&lt;algorithm&gt;</code>. <a href="ht tps://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/D9UnnxBnciQ">D iscussion thread</a>, <a href="https://groups.google.com/a/chromium.org/forum/#! topic/cxx/QxjsPELDYdQ">uncapturing thread</a>. 198 <td>Do not bind or store capturing lambdas outside the lifetime of the stack fra me they are defined in. Captureless lambdas can be used with <code>base::Callbac k</code>, such as <code>base::Bind([](int j){}, i);</code>, because they offer p rotection against a large class of object lifetime mistakes. Don't use default c aptures (<code>[=]</code>, <code>[&amp;]</code> &ndash; <a href="https://google. github.io/styleguide/cppguide.html#Lambda_expressions">Google Style Guide</a>). Lambdas are typically useful as a parameter to methods or functions that will us e them immediately, such as those in <code>&lt;algorithm&gt;</code>. <a href="ht tps://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/D9UnnxBnciQ">D iscussion thread</a>, <a href="https://groups.google.com/a/chromium.org/forum/#! topic/cxx/QxjsPELDYdQ">uncapturing thread</a>.
199 </td> 199 </td>
(...skipping 19 matching lines...) Expand all
219 &nbsp;&nbsp;C()&nbsp;&nbsp;// copy-initializes <i>var</i></code> 219 &nbsp;&nbsp;C()&nbsp;&nbsp;// copy-initializes <i>var</i></code>
220 <td>Allows non-static class members to be initialized at their definitions (outs ide constructors)</td> 220 <td>Allows non-static class members to be initialized at their definitions (outs ide constructors)</td>
221 <td><a href="http://en.cppreference.com/w/cpp/language/data_members">Non-static data members</a></td> 221 <td><a href="http://en.cppreference.com/w/cpp/language/data_members">Non-static data members</a></td>
222 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /zqB-DySA4V0">Discussion thread</a></td> 222 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /zqB-DySA4V0">Discussion thread</a></td>
223 </tr> 223 </tr>
224 224
225 <tr> 225 <tr>
226 <td>Null Pointer Constant</td> 226 <td>Null Pointer Constant</td>
227 <td><code>nullptr</code></td> 227 <td><code>nullptr</code></td>
228 <td>Declares a type-safe null pointer</td> 228 <td>Declares a type-safe null pointer</td>
229 <td><a href="http://en.cppreference.com/w/cpp/language/nullptr">nullptr</a></td> 229 <td><a href="http://en.cppreference.com/w/cpp/language/nullptr">nullptr, the poi nter literal</a></td>
230 <td>Prefer over <code>NULL</code> or <code>0</code>. <a href="https://groups.goo gle.com/a/chromium.org/forum/#!topic/chromium-dev/4mijeJHzxLg">Discussion thread </a>. <a href="https://google.github.io/styleguide/cppguide.html#0_and_nullptr/N ULL">Google Style Guide</a>. <code>std::nullptr_t</code> can be used too.</td> 230 <td>Prefer over <code>NULL</code> or <code>0</code>. <a href="https://groups.goo gle.com/a/chromium.org/forum/#!topic/chromium-dev/4mijeJHzxLg">Discussion thread </a>. <a href="https://google.github.io/styleguide/cppguide.html#0_and_nullptr/N ULL">Google Style Guide</a>. <code>std::nullptr_t</code> can be used too.</td>
231 </tr> 231 </tr>
232 232
233 <tr> 233 <tr>
234 <td>Override Specifier</td> 234 <td>Override Specifier</td>
235 <td><code>override</code></td> 235 <td><code>override</code></td>
236 <td>Indicates that a class or function overrides a base implementation</td> 236 <td>Indicates that a class or function overrides a base implementation</td>
237 <td><a href="http://en.cppreference.com/w/cpp/language/override">override Langua ge Reference</a></td> 237 <td><a href="http://en.cppreference.com/w/cpp/language/override">override specif ier</a></td>
238 <td>Recommended for new code. <a href="https://groups.google.com/a/chromium.org/ forum/#!topic/chromium-dev/VTNZzizN0zo">Discussion thread</a></td> 238 <td>Recommended for new code. <a href="https://groups.google.com/a/chromium.org/ forum/#!topic/chromium-dev/VTNZzizN0zo">Discussion thread</a></td>
239 </tr> 239 </tr>
240 240
241 <tr> 241 <tr>
242 <td>Range-Based For Loops</td> 242 <td>Range-Based For Loops</td>
243 <td><code>for (<i>type</i> <i>var</i> : <i>range</i>)</code></td> 243 <td><code>for (<i>type</i> <i>var</i> : <i>range</i>)</code></td>
244 <td>Facilitates a more concise syntax for iterating over the elements of a conta iner (or a range of iterators) in a <code>for</code> loop</td> 244 <td>Facilitates a more concise syntax for iterating over the elements of a conta iner (or a range of iterators) in a <code>for</code> loop</td>
245 <td><a href="http://en.cppreference.com/w/cpp/language/range-for">Range-based fo r loop</a></td> 245 <td><a href="http://en.cppreference.com/w/cpp/language/range-for">Range-based fo r loop</a></td>
246 <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/ch romium.org/forum/#!topic/chromium-dev/hpzz4EqbVmc">Discussion thread</a></td> 246 <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/ch romium.org/forum/#!topic/chromium-dev/hpzz4EqbVmc">Discussion thread</a></td>
247 </tr> 247 </tr>
248 248
249 <tr> 249 <tr>
250 <td>Rvalue References</td> 250 <td>Rvalue References</td>
251 <td><code>T(T&amp;&amp; t)</code> and <code>T&amp; operator=(T&amp;&amp; t)<br/> <br/> 251 <td><code>T(T&amp;&amp; t)</code> and <code>T&amp; operator=(T&amp;&amp; t)<br/> <br/>
252 template &lt;typename T&gt;<br/>void Function(T&& t) { ... }</code></td> 252 template &lt;typename T&gt;<br/>void Function(T&& t) { ... }</code></td>
253 <td>Reference that only binds to a temporary object</td> 253 <td>Reference that only binds to a temporary object</td>
254 <td><a href="http://en.cppreference.com/w/cpp/language/references#Rvalue_referen ces">Rvalue references</a></td> 254 <td><a href="http://en.cppreference.com/w/cpp/language/reference#Rvalue_referenc es">Rvalue references</a></td>
255 <td>As per the <a href="https://google.github.io/styleguide/cppguide.html#Rvalue _references">Google Style Guide</a>: Only use these to define move constructors and move assignment operators, and for perfect forwarding. Most classes should n ot be copyable, even if movable. Continue to use DISALLOW_COPY_AND_ASSIGN in mos t cases. <a href="https://groups.google.com/a/chromium.org/d/topic/chromium-dev/ UnRaORb4TSw">Discussion thread</a>. <a href="https://groups.google.com/a/chromiu m.org/d/topic/cxx/Q526tkruXpM">Another discussion thread</a>.</td> 255 <td>As per the <a href="https://google.github.io/styleguide/cppguide.html#Rvalue _references">Google Style Guide</a>: Only use these to define move constructors and move assignment operators, and for perfect forwarding. Most classes should n ot be copyable, even if movable. Continue to use DISALLOW_COPY_AND_ASSIGN in mos t cases. <a href="https://groups.google.com/a/chromium.org/d/topic/chromium-dev/ UnRaORb4TSw">Discussion thread</a>. <a href="https://groups.google.com/a/chromiu m.org/d/topic/cxx/Q526tkruXpM">Another discussion thread</a>.</td>
256 </tr> 256 </tr>
257 257
258 <tr> 258 <tr>
259 <td>Standard Integers</td> 259 <td>Standard Integers</td>
260 <td>Typedefs within <code>&lt;stdint.h&gt;</code> and <code>&lt;inttypes&gt;</co de></td> 260 <td>Typedefs within <code>&lt;stdint.h&gt;</code> and <code>&lt;inttypes&gt;</co de></td>
261 <td>Provides fixed-size integers independent of platforms</td> 261 <td>Provides fixed-size integers independent of platforms</td>
262 <td><a href="http://www.cplusplus.com/reference/cstdint/">&lt;stdint.h&gt; (cstd int)</a></td> 262 <td><a href="http://en.cppreference.com/w/cpp/header/cstdint">Standard library h eader &lt;cstdint&gt;</a></td>
263 <td>Already in common use in the codebase. Approved without discussion.</td> 263 <td>Already in common use in the codebase. Approved without discussion.</td>
264 </tr> 264 </tr>
265 265
266 <tr> 266 <tr>
267 <td>Static Assertions</td> 267 <td>Static Assertions</td>
268 <td><code>static_assert(<i>bool</i>, <i>string</i>)</code></td> 268 <td><code>static_assert(<i>bool</i>, <i>string</i>)</code></td>
269 <td>Tests compile-time conditions</td> 269 <td>Tests compile-time conditions</td>
270 <td><a href="http://en.cppreference.com/w/cpp/language/static_assert">Static Ass ertion</a></td> 270 <td><a href="http://en.cppreference.com/w/cpp/language/static_assert">Static Ass ertion</a></td>
271 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /POISBQEhGzU">Discussion thread</a></td> 271 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /POISBQEhGzU">Discussion thread</a></td>
272 </tr> 272 </tr>
(...skipping 11 matching lines...) Expand all
284 <td><code><i>type</i> <i>name</i> {[<i>value</i> ..., <i>value</i>]};</code></td > 284 <td><code><i>type</i> <i>name</i> {[<i>value</i> ..., <i>value</i>]};</code></td >
285 <td>Allows any object of primitive, aggregate or class type to be initialized us ing brace syntax</td> 285 <td>Allows any object of primitive, aggregate or class type to be initialized us ing brace syntax</td>
286 <td><a href="http://www.stroustrup.com/C++11FAQ.html#uniform-init">Uniform initi alization syntax and semantics</a></td> 286 <td><a href="http://www.stroustrup.com/C++11FAQ.html#uniform-init">Uniform initi alization syntax and semantics</a></td>
287 <td>See the <a href="https://www.chromium.org/developers/coding-style/cpp-dos-an d-donts?pli=1#TOC-Variable-initialization">Chromium C++ Dos And Don'ts guidance< /a> on when to use this. <a href="https://groups.google.com/a/chromium.org/forum /#!topic/chromium-dev/GF96FshwHLw">Discussion thread</a></td> 287 <td>See the <a href="https://www.chromium.org/developers/coding-style/cpp-dos-an d-donts?pli=1#TOC-Variable-initialization">Chromium C++ Dos And Don'ts guidance< /a> on when to use this. <a href="https://groups.google.com/a/chromium.org/forum /#!topic/chromium-dev/GF96FshwHLw">Discussion thread</a></td>
288 </tr> 288 </tr>
289 289
290 <tr> 290 <tr>
291 <td>Union Class Members</td> 291 <td>Union Class Members</td>
292 <td><code>union <i>name</i> {<i>class</i> <i>var</i>}</code></td> 292 <td><code>union <i>name</i> {<i>class</i> <i>var</i>}</code></td>
293 <td>Allows class type members</td> 293 <td>Allows class type members</td>
294 <td><a href="http://en.cppreference.com/w/cpp/language/union">Union declarations </a></td> 294 <td><a href="http://en.cppreference.com/w/cpp/language/union">Union declaration< /a></td>
295 <td>Usage should be rare.</td> 295 <td>Usage should be rare.</td>
296 </tr> 296 </tr>
297 297
298 <tr> 298 <tr>
299 <td>Variadic Macros</td> 299 <td>Variadic Macros</td>
300 <td><code>#define <i>MACRO</i>(...) <i>Impl</i>(<i>args</i>, __VA_ARGS__)</code> </td> 300 <td><code>#define <i>MACRO</i>(...) <i>Impl</i>(<i>args</i>, __VA_ARGS__)</code> </td>
301 <td>Allows macros that accept a variable number of arguments</td> 301 <td>Allows macros that accept a variable number of arguments</td>
302 <td><a href="http://stackoverflow.com/questions/4786649/are-variadic-macros-nons tandard">Are Variadic macros nonstandard?</a></td> 302 <td><a href="http://stackoverflow.com/questions/4786649/are-variadic-macros-nons tandard">Are Variadic macros nonstandard?</a></td>
303 <td>Usage should be rare. <a href="https://groups.google.com/a/chromium.org/foru m/#!topic/chromium-dev/sRx9j3CQqyA">Discussion thread</a></td> 303 <td>Usage should be rare. <a href="https://groups.google.com/a/chromium.org/foru m/#!topic/chromium-dev/sRx9j3CQqyA">Discussion thread</a></td>
304 </tr> 304 </tr>
305 305
306 <tr> 306 <tr>
307 <td>Variadic Templates</td> 307 <td>Variadic Templates</td>
308 <td><code>template &lt;<i>typename</i> ... <i>arg</i>&gt;</code></td> 308 <td><code>template &lt;<i>typename</i> ... <i>arg</i>&gt;</code></td>
309 <td>Allows templates that accept a variable number of arguments</td> 309 <td>Allows templates that accept a variable number of arguments</td>
310 <td><a href="http://en.cppreference.com/w/cpp/language/parameter_pack">Parameter pack</a></td> 310 <td><a href="http://en.cppreference.com/w/cpp/language/parameter_pack#Template_p arameter_list">Template parameter list</a></td>
danakj 2016/10/29 01:02:47 Why is this going to this specific use of ... inst
Peter Kasting 2016/10/29 06:15:37 Will revert.
311 <td>Usage should be rare. Use instead of .pump files. <a href="https://groups.go ogle.com/a/chromium.org/forum/#!topic/chromium-dev/6ItymeMXpMc">Discussion threa d</a></td> 311 <td>Usage should be rare. Use instead of .pump files. <a href="https://groups.go ogle.com/a/chromium.org/forum/#!topic/chromium-dev/6ItymeMXpMc">Discussion threa d</a></td>
312 </tr> 312 </tr>
313 313
314 </tbody> 314 </tbody>
315 </table> 315 </table>
316 316
317 <h2 id="whitelist"><a name="library-whitelist"></a>C++11 Allowed Library Feature s</h2> 317 <h2 id="whitelist"><a name="library-whitelist"></a>C++11 Allowed Library Feature s</h2>
318 318
319 <p>The following library features are currently allowed.</p> 319 <p>The following library features are currently allowed.</p>
320 320
(...skipping 23 matching lines...) Expand all
344 <code>find_if_not</code><br/> 344 <code>find_if_not</code><br/>
345 <code>copy_if</code>, <code>copy_n</code><br/> 345 <code>copy_if</code>, <code>copy_n</code><br/>
346 <code>move</code>, <code>move_backward</code> (see note)<br/> 346 <code>move</code>, <code>move_backward</code> (see note)<br/>
347 <code>shuffle</code><br/> 347 <code>shuffle</code><br/>
348 <code>is_partitioned</code>, <code>partition_copy</code>, <code>partition_point< /code><br/> 348 <code>is_partitioned</code>, <code>partition_copy</code>, <code>partition_point< /code><br/>
349 <code>is_sorted</code>, <code>is_sorted_until</code><br/> 349 <code>is_sorted</code>, <code>is_sorted_until</code><br/>
350 <code>is_heap</code>, <code>is_heap_until</code><br/> 350 <code>is_heap</code>, <code>is_heap_until</code><br/>
351 <code>minmax</code>, <code>minmax_element</code><br/> 351 <code>minmax</code>, <code>minmax_element</code><br/>
352 <code>is_permutation<br/></td> 352 <code>is_permutation<br/></td>
353 <td>Safe and performant implementations of common algorithms</td> 353 <td>Safe and performant implementations of common algorithms</td>
354 <td><a href="http://en.cppreference.com/w/cpp/header/algorithm">&lt;algorithm&gt ;</a></td> 354 <td><a href="http://en.cppreference.com/w/cpp/header/algorithm">Standard library header &lt;algorithm&gt;</a></td>
355 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/cxx/UJQk8S1I uHk">Discussion thread</a><br/> Note that &lt;algorithm&gt; contains a range-bas ed <code>move</code> method. This is allowed, but because people may confuse it with the single-arg <code>std::move</code>, there is often a way to write code w ithout it that is more readable. <a href='https://groups.google.com/a/chromium.o rg/forum/#!topic/cxx/8WzmtYrZvQ8'>Discussion thread</a></td> 355 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/cxx/UJQk8S1I uHk">Discussion thread</a><br/> Note that &lt;algorithm&gt; contains a range-bas ed <code>move</code> method. This is allowed, but because people may confuse it with the single-arg <code>std::move</code>, there is often a way to write code w ithout it that is more readable. <a href='https://groups.google.com/a/chromium.o rg/forum/#!topic/cxx/8WzmtYrZvQ8'>Discussion thread</a></td>
356 </tr> 356 </tr>
357 357
358 <tr> 358 <tr>
359 <td>Begin and End Non-Member Functions</td> 359 <td>Begin and End Non-Member Functions</td>
360 <td><code>std::begin()</code>, <code>std::end()</code></td> 360 <td><code>std::begin()</code>, <code>std::end()</code></td>
361 <td>Allows use of free functions on any container, including fixed-size arrays</ td> 361 <td>Allows use of free functions on any container, including fixed-size arrays</ td>
362 <td><a href="http://en.cppreference.com/w/cpp/iterator/begin">std::begin</a>, <a href="http://en.cppreference.com/w/cpp/iterator/end">std::end</a></td> 362 <td><a href="http://en.cppreference.com/w/cpp/iterator/begin">std::begin</a>, <a href="http://en.cppreference.com/w/cpp/iterator/end">std::end</a></td>
363 <td>Useful for fixed-size arrays. Note that non-member <code>cbegin()</code> and <code>cend()</code> are not available until C++14. <a href="https://groups.goog le.com/a/chromium.org/d/topic/cxx/5iFNE8P5qT4/discussion">Discussion thread</a>< /td> 363 <td>Useful for fixed-size arrays. Note that non-member <code>cbegin()</code> and <code>cend()</code> are not available until C++14. <a href="https://groups.goog le.com/a/chromium.org/d/topic/cxx/5iFNE8P5qT4/discussion">Discussion thread</a>< /td>
364 </tr> 364 </tr>
365 365
366 <tr> 366 <tr>
367 <td>Conditional Type Selection</td> 367 <td>Conditional Type Selection</td>
368 <td><code>std::enable_if</code>, <code>std::conditional</code></td> 368 <td><code>std::enable_if</code>, <code>std::conditional</code></td>
369 <td>Enables compile-time conditional type selection</td> 369 <td>Enables compile-time conditional type selection</td>
370 <td><a href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a >, <a href="http://en.cppreference.com/w/cpp/types/conditional">conditional</a>< /td> 370 <td><a href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a >, <a href="http://en.cppreference.com/w/cpp/types/conditional">conditional</a>< /td>
371 <td>Usage should be rare. <a href='https://groups.google.com/a/chromium.org/foru m/#!topic/cxx/vCxo4tZNd_M'>Discussion thread</a></td> 371 <td>Usage should be rare. <a href='https://groups.google.com/a/chromium.org/foru m/#!topic/cxx/vCxo4tZNd_M'>Discussion thread</a></td>
372 </tr> 372 </tr>
373 373
374 <tr> 374 <tr>
375 <td>Constant Iterator Methods on Containers</td> 375 <td>Constant Iterator Methods on Containers</td>
376 <td>E.g. <code>std::vector::cbegin()</code>, <code>std::vector::cend()</code></t d> 376 <td>E.g. <code>std::vector::cbegin()</code>, <code>std::vector::cend()</code></t d>
377 <td>Allows more widespread use of <code>const_iterator</code></td> 377 <td>Allows more widespread use of <code>const_iterator</code></td>
378 <td><a href="http://en.cppreference.com/w/cpp/container/vector/begin">std::vecto r::cbegin</a>, <a href="http://en.cppreference.com/w/cpp/container/vector/end">s td::vector::cend<a></td> 378 <td><a href="http://en.cppreference.com/w/cpp/container/vector/begin">std::vecto r::cbegin</a>, <a href="http://en.cppreference.com/w/cpp/container/vector/end">s td::vector::cend<a></td>
379 <td>Applies to all containers, not just <code>vector</code>. Consider using <cod e>const_iterator</code> over <code>iterator</code> where possible for the same r eason as using <code>const</code> variables and functions where possible; see Ef fective Modern C++ item 13 for motivation. <a href="https://groups.google.com/a/ chromium.org/d/topic/cxx/cS83F_buqLM/discussion">Discussion thread</a></td> 379 <td>Applies to all containers, not just <code>vector</code>. Consider using <cod e>const_iterator</code> over <code>iterator</code> where possible for the same r eason as using <code>const</code> variables and functions where possible; see Ef fective Modern C++ item 13 for motivation. <a href="https://groups.google.com/a/ chromium.org/d/topic/cxx/cS83F_buqLM/discussion">Discussion thread</a></td>
380 </tr> 380 </tr>
381 381
382 <tr> 382 <tr>
383 <td>Containers containing movable types</td> 383 <td>Containers containing move-only types</td>
384 <td><code>vector&lt;scoped_ptr&gt;</code></td> 384 <td><code>vector&lt;scoped_ptr&gt;</code></td>
385 <td>Enables containers that contain move-only types like <code>scoped_ptr</code> </td> 385 <td>Enables containers that contain move-only types like <code>scoped_ptr</code> </td>
386 <td>TODO</td> 386 <td>TODO</td>
387 <td>Prefer over <a href="http://crbug.com/554289">ScopedVector</a>.</td> 387 <td>Prefer over <a href="http://crbug.com/554289">ScopedVector</a>.</td>
388 </tr> 388 </tr>
389 389
390 <tr> 390 <tr>
391 <td>Declared Type As Value</td> 391 <td>Declared Type As Value</td>
392 <td><code>std::declval&lt;<i>class</i>&gt;()</code></td> 392 <td><code>std::declval&lt;<i>class</i>&gt;()</code></td>
393 <td>Converts a type to a reference of the type to allow use of members of the ty pe without constructing it in templates.</td> 393 <td>Converts a type to a reference of the type to allow use of members of the ty pe without constructing it in templates.</td>
(...skipping 27 matching lines...) Expand all
421 </tr> 421 </tr>
422 422
423 <tr> 423 <tr>
424 <td>Math functions</td> 424 <td>Math functions</td>
425 <td>All C++11 features in <code>&lt;cmath&gt;</code>, e.g.:<br/> 425 <td>All C++11 features in <code>&lt;cmath&gt;</code>, e.g.:<br/>
426 <code>INFINITY</code>, <code>NAN</code>, <code>FP_NAN</code><br/> 426 <code>INFINITY</code>, <code>NAN</code>, <code>FP_NAN</code><br/>
427 <code>float_t</code>, <code>double_t</code><br/> 427 <code>float_t</code>, <code>double_t</code><br/>
428 <code>fmax</code>, <code>fmin</code>, <code>trunc</code>, <code>round</code><br/ > 428 <code>fmax</code>, <code>fmin</code>, <code>trunc</code>, <code>round</code><br/ >
429 <code>isinf</code>, <code>isnan</code><br/></td> 429 <code>isinf</code>, <code>isnan</code><br/></td>
430 <td>Useful for math-related code</td> 430 <td>Useful for math-related code</td>
431 <td><a href="http://en.cppreference.com/w/cpp/header/cmath">&lt;cmath&gt;</a></t d> 431 <td><a href="http://en.cppreference.com/w/cpp/header/cmath">Standard library hea der &lt;cmath&gt;</a></td>
432 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/cxx/P-1bFBXM eUk">Discussion thread</a></td> 432 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/cxx/P-1bFBXM eUk">Discussion thread</a></td>
433 </tr> 433 </tr>
434 434
435 <tr> 435 <tr>
436 <td>Move Iterator Adaptor</td> 436 <td>Move Iterator Adaptor</td>
437 <td><code>std::make_move_iterator()</code></td> 437 <td><code>std::make_move_iterator()</code></td>
438 <td>Wraps an iterator so that it moves objects instead of copying them.</td> 438 <td>Wraps an iterator so that it moves objects instead of copying them.</td>
439 <td><a href="http://en.cppreference.com/w/cpp/iterator/make_move_iterator">std:: make_move_iterator</a></td> 439 <td><a href="http://en.cppreference.com/w/cpp/iterator/make_move_iterator">std:: make_move_iterator</a></td>
440 <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> 440 <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>
441 </tr> 441 </tr>
(...skipping 16 matching lines...) Expand all
458 458
459 <tr> 459 <tr>
460 <td>Type Traits</td> 460 <td>Type Traits</td>
461 <td>All C++11 features in <code>&lt;type_traits&gt;</code> except for aligned st orage (see separate item), e.g.:<br/> 461 <td>All C++11 features in <code>&lt;type_traits&gt;</code> except for aligned st orage (see separate item), e.g.:<br/>
462 <code>integral_constant</code><br/> 462 <code>integral_constant</code><br/>
463 <code>is_floating_point</code>, <code>is_rvalue_reference</code>, <code>is_scala r</code><br/> 463 <code>is_floating_point</code>, <code>is_rvalue_reference</code>, <code>is_scala r</code><br/>
464 <code>is_const</code>, <code>is_pod</code>, <code>is_unsigned</code><br/> 464 <code>is_const</code>, <code>is_pod</code>, <code>is_unsigned</code><br/>
465 <code>is_default_constructible</code>, <code>is_move_constructible</code>, <code >is_copy_assignable</code><br/> 465 <code>is_default_constructible</code>, <code>is_move_constructible</code>, <code >is_copy_assignable</code><br/>
466 <code>enable_if</code>, <code>conditional</code>, <code>result_of</code><br/></t d> 466 <code>enable_if</code>, <code>conditional</code>, <code>result_of</code><br/></t d>
467 <td>Allows compile-time inspection of the properties of types</td> 467 <td>Allows compile-time inspection of the properties of types</td>
468 <td><a href="http://en.cppreference.com/w/cpp/header/type_traits">&lt;type_trait s&gt;</a></td> 468 <td><a href="http://en.cppreference.com/w/cpp/header/type_traits">Standard libra ry header &lt;type_traits&gt;</a></td>
469 <td>Note that not all type traits are available on all platforms (e.g. <code>std ::underlying_type</code> doesn't work in libstdc++4.6). Use judiciously. <a href ='https://groups.google.com/a/chromium.org/forum/#!topic/cxx/vCxo4tZNd_M'>Discus sion thread</a></td> 469 <td>Note that not all type traits are available on all platforms (e.g. <code>std ::underlying_type</code> doesn't work in libstdc++4.6). Use judiciously. <a href ='https://groups.google.com/a/chromium.org/forum/#!topic/cxx/vCxo4tZNd_M'>Discus sion thread</a></td>
470 </tr> 470 </tr>
471 471
472 <tr> 472 <tr>
473 <td>Tuples</td> 473 <td>Tuples</td>
474 <td>All C++11 features in <code>&lt;tuple&gt;</code>, e.g. <code>std::tie</code> and <code>std::tuple</code>.</td> 474 <td>All C++11 features in <code>&lt;tuple&gt;</code>, e.g. <code>std::tie</code> and <code>std::tuple</code>.</td>
475 <td>A fixed-size ordered collection of values of mixed types</td> 475 <td>A fixed-size ordered collection of values of mixed types</td>
476 <td><a href="http://en.cppreference.com/w/cpp/header/tuple">&lt;tuple&gt;</a></t d> 476 <td><a href="http://en.cppreference.com/w/cpp/header/tuple">Standard library hea der &lt;tuple&gt;</a></td>
477 <td>Use <code>base::get</code> instead of <code>std::get</code> in case the <cod e>std::tuple</code> may be a rvalue-reference. 477 <td>Use <code>base::get</code> instead of <code>std::get</code> in case the <cod e>std::tuple</code> may be a rvalue-reference.
478 <code>std::get</code> in &lt;=libstdc++-4.6 misses an overload for rvalue-refere nce of a tuple, and <code>base::get</code> complements it. </td> 478 <code>std::get</code> in &lt;=libstdc++-4.6 misses an overload for rvalue-refere nce of a tuple, and <code>base::get</code> complements it. </td>
479 </tr> 479 </tr>
480 480
481 <tr> 481 <tr>
482 <td>Unordered Associative Containers</td> 482 <td>Unordered Associative Containers</td>
483 <td><code>std::unordered_set</code>, <code>std::unordered_map</code>, <code>std: :unordered_multiset</code>, <code>std::unordered_multimap</code></td> 483 <td><code>std::unordered_set</code>, <code>std::unordered_map</code>, <code>std: :unordered_multiset</code>, <code>std::unordered_multimap</code></td>
484 <td>Allows efficient containers of key/value pairs</td> 484 <td>Allows efficient containers of key/value pairs</td>
485 <td><a href="http://en.cppreference.com/w/cpp/container/unordered_map">std::unor dered_map</a>, <a href="http://en.cppreference.com/w/cpp/container/unordered_set ">std::unordered_set</a></td> 485 <td><a href="http://en.cppreference.com/w/cpp/container/unordered_map">std::unor dered_map</a>, <a href="http://en.cppreference.com/w/cpp/container/unordered_set ">std::unordered_set</a></td>
486 <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> 486 <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>
(...skipping 28 matching lines...) Expand all
515 <th style='width:240px;'>Snippet</th> 515 <th style='width:240px;'>Snippet</th>
516 <th style='width:240px;'>Description</th> 516 <th style='width:240px;'>Description</th>
517 <th style='width:240px;'>Documentation Link</th> 517 <th style='width:240px;'>Documentation Link</th>
518 <th style='width:240px;'>Notes</th> 518 <th style='width:240px;'>Notes</th>
519 </tr> 519 </tr>
520 520
521 <tr> 521 <tr>
522 <td>Alignment Features</td> 522 <td>Alignment Features</td>
523 <td><code>alignas</code> specifier, <code>alignof</code> operator</td> 523 <td><code>alignas</code> specifier, <code>alignof</code> operator</td>
524 <td>Object alignment</td> 524 <td>Object alignment</td>
525 <td><a href="http://en.cppreference.com/w/cpp/language/alignas">alignas</a>, <a href="http://en.cppreference.com/w/cpp/language/alignof">alignof</a></td> 525 <td><a href="http://en.cppreference.com/w/cpp/language/alignas">alignas specifie r</a>, <a href="http://en.cppreference.com/w/cpp/language/alignof">alignof opera tor</a></td>
526 <td>Reevaluate now that MSVS2015 is available. <a href="https://groups.google.co m/a/chromium.org/d/msg/cxx/rwXN02jzzq0/CpUc1ZzMBQAJ">Discussion thread</a></td> 526 <td>Reevaluate now that MSVS2015 is available. <a href="https://groups.google.co m/a/chromium.org/d/msg/cxx/rwXN02jzzq0/CpUc1ZzMBQAJ">Discussion thread</a></td>
527 </tr> 527 </tr>
528 528
529 <tr> 529 <tr>
530 <td>Inherited Constructors</td> 530 <td>Inherited Constructors</td>
531 <td><code>class Derived : Base {<br /> 531 <td><code>class Derived : Base {<br />
532 &nbsp;&nbsp;using Base::Base;<br /> 532 &nbsp;&nbsp;using Base::Base;<br />
533 };</code></td> 533 };</code></td>
534 <td>Allow derived classes to inherit constructors from base classes</td> 534 <td>Allow derived classes to inherit constructors from base classes</td>
535 <td><a href="http://en.cppreference.com/w/cpp/language/using_declaration">Using- declaration</a></td> 535 <td><a href="http://en.cppreference.com/w/cpp/language/using_declaration">Using- declaration</a></td>
536 <td>Reevaluate now that MSVS2015 is available. <a href="https://groups.google.co m/a/chromium.org/d/msg/chromium-dev/BULzgIKZ-Ao/PLO7_GoVNvYJ">Discussion thread< /a></td> 536 <td>Reevaluate now that MSVS2015 is available. <a href="https://groups.google.co m/a/chromium.org/d/msg/chromium-dev/BULzgIKZ-Ao/PLO7_GoVNvYJ">Discussion thread< /a></td>
537 </tr> 537 </tr>
538 538
539 <tr> 539 <tr>
540 <td><code>long long</code> Type</td> 540 <td><code>long long</code> Type</td>
541 <td><code>long long <i>var</i>= <i>value</i>;</code></td> 541 <td><code>long long <i>var</i> = <i>value</i>;</code></td>
542 <td>An integer of at least 64 bits</td> 542 <td>An integer of at least 64 bits</td>
543 <td><a href="http://en.cppreference.com/w/cpp/language/types">Fundamental types< /a></td> 543 <td><a href="http://en.cppreference.com/w/cpp/language/types">Fundamental types< /a></td>
544 <td>Use a stdint.h type if you need a 64bit number. <a href="https://groups.goog le.com/a/chromium.org/forum/#!topic/chromium-dev/RxugZ-pIDxk">Discussion thread< /a></td> 544 <td>Use a stdint.h type if you need a 64bit number. <a href="https://groups.goog le.com/a/chromium.org/forum/#!topic/chromium-dev/RxugZ-pIDxk">Discussion thread< /a></td>
545 </tr> 545 </tr>
546 546
547 <tr> 547 <tr>
548 <td>Raw String Literals</td> 548 <td>Raw String Literals</td>
549 <td><code>string <i>var</i>=R&quot;(<i>raw_string</i>)&quot;;</code></td> 549 <td><code>string <i>var</i>=R&quot;(<i>raw_string</i>)&quot;;</code></td>
550 <td>Allows a string to be encoded without any escape sequences, easing parsing i n regex expressions, for example</td> 550 <td>Allows a string to be encoded without any escape sequences, easing parsing i n regex expressions, for example</td>
551 <td><a href="http://en.cppreference.com/w/cpp/language/string_literal">string li teral</a></td> 551 <td><a href="http://en.cppreference.com/w/cpp/language/string_literal">string li teral</a></td>
(...skipping 19 matching lines...) Expand all
571 <tr> 571 <tr>
572 <td>Ref-qualified Member Functions</td> 572 <td>Ref-qualified Member Functions</td>
573 <td><code>class T {<br /> 573 <td><code>class T {<br />
574 &nbsp;&nbsp;void f() & {}<br /> 574 &nbsp;&nbsp;void f() & {}<br />
575 &nbsp;&nbsp;void f() && {}<br /> 575 &nbsp;&nbsp;void f() && {}<br />
576 };<br /> 576 };<br />
577 t.f();&nbsp;&nbsp;// first<br /> 577 t.f();&nbsp;&nbsp;// first<br />
578 T().f();&nbsp;&nbsp;// second<br /> 578 T().f();&nbsp;&nbsp;// second<br />
579 std::move(t).f();&nbsp;&nbsp;// second</code></td> 579 std::move(t).f();&nbsp;&nbsp;// second</code></td>
580 <td>Allows class member functions to only bind to |this| as an rvalue or lvalue. </td> 580 <td>Allows class member functions to only bind to |this| as an rvalue or lvalue. </td>
581 <td><a href="http://en.cppreference.com/w/cpp/language/member_functions">Member functions</a></td> 581 <td><a href="http://en.cppreference.com/w/cpp/language/member_functions#const-.2 C_volatile-.2C_and_ref-qualified_member_functions">const-, volatile-, and ref-qu alified member functions</a></td>
582 <td>Banned in the <a href="https://google.github.io/styleguide/cppguide.html#C++ 11">Google Style Guide</a>. Banned in Chromium except by explicit approval from <code>styleguide/c++/OWNERS</code>. <a href="https://groups.google.com/a/chromiu m.org/d/topic/cxx/gowclr2LPQA/discussion">Discussion Thread</a></td> 582 <td>Banned in the <a href="https://google.github.io/styleguide/cppguide.html#C++ 11">Google Style Guide</a>. May be used in Chromium only with explicit approval from <code>styleguide/c++/OWNERS</code>. <a href="https://groups.google.com/a/ch romium.org/d/topic/cxx/gowclr2LPQA/discussion">Discussion Thread</a></td>
danakj 2016/10/29 01:02:47 Kinda like the harder wording that starts with "Ba
Peter Kasting 2016/10/29 06:15:37 The reason I changed it was that if it's banned in
Peter Kasting 2016/10/31 17:46:10 I changed the wording just slightly to "May only b
583 </tr> 583 </tr>
584 584
585 </tbody> 585 </tbody>
586 </table> 586 </table>
587 587
588 <h3 id="blacklist_stdlib"><a name="library-blacklist"></a>C++11 Banned Library F eatures</h3> 588 <h3 id="blacklist_stdlib"><a name="library-blacklist"></a>C++11 Banned Library F eatures</h3>
589 589
590 <p>This section lists C++11 library features that are not allowed in the Chromiu m codebase.</p> 590 <p>This section lists C++11 library features that are not allowed in the Chromiu m codebase.</p>
591 591
592 <table id="blacklist_lib_list" class="unlined striped"> 592 <table id="blacklist_lib_list" class="unlined striped">
593 <tbody> 593 <tbody>
594 594
595 <tr> 595 <tr>
596 <th style='width:240px;'>Feature</th> 596 <th style='width:240px;'>Feature</th>
597 <th style='width:240px;'>Snippet</th> 597 <th style='width:240px;'>Snippet</th>
598 <th style='width:240px;'>Description</th> 598 <th style='width:240px;'>Description</th>
599 <th style='width:240px;'>Documentation Link</th> 599 <th style='width:240px;'>Documentation Link</th>
600 <th style='width:240px;'>Notes</th> 600 <th style='width:240px;'>Notes</th>
601 </tr> 601 </tr>
602 602
603 <tr> 603 <tr>
604 <td>Chrono Library</td> 604 <td>Date and time utilities</td>
605 <td><code>&lt;chrono&gt;</code></td> 605 <td><code>&lt;chrono&gt;</code></td>
606 <td>Provides a standard date and time library</td> 606 <td>A standard date and time library</td>
607 <td><a href="http://en.cppreference.com/w/cpp/chrono">Date and time utilities</a ></td> 607 <td><a href="http://en.cppreference.com/w/cpp/chrono">Date and time utilities</a ></td>
608 <td>Duplicated <code>Time</code> APIs in <code>base/</code>. Keep using the <cod e>base/</code> classes.</td> 608 <td>Overlaps with <code>Time</code> APIs in <code>base/</code>. Keep using the < code>base/</code> classes.</td>
609 </tr> 609 </tr>
610 610
611 <tr> 611 <tr>
612 <td>Regex Library</td> 612 <td>Regular Expressions</td>
613 <td><code>&lt;regex&gt;</code></td> 613 <td><code>&lt;regex&gt;</code></td>
614 <td>Provides a standard regular expressions library</td> 614 <td>A standard regular expressions library</td>
615 <td><a href="http://en.cppreference.com/w/cpp/regex">Regular expressions library </a></td> 615 <td><a href="http://en.cppreference.com/w/cpp/regex">Regular expressions library </a></td>
616 <td>We already have too many regular expression libraries in Chromium. Use re2 w hen in doubt.</td> 616 <td>Overlaps with many regular expression libraries in Chromium. When in doubt, use re2.</td>
617 </tr> 617 </tr>
618 618
619 <tr> 619 <tr>
620 <td>Thread Library</td> 620 <td>Thread Library</td>
621 <td><code>&lt;thread&gt;</code> support, including<br /> 621 <td><code>&lt;thread&gt;</code> and related headers, including<br />
622 <code>&lt;future&gt;</code>, <code>&lt;mutex&gt;</code>, <code>&lt;condition_var iable&gt;</code></td> 622 <code>&lt;future&gt;</code>, <code>&lt;mutex&gt;</code>, <code>&lt;condition_var iable&gt;</code></td>
623 <td>Provides a standard mulitthreading library using <code>std::thread</code> an d associates</td> 623 <td>Provides a standard multithreading library using <code>std::thread</code> an d associates</td>
624 <td><a href="http://en.cppreference.com/w/cpp/thread">Thread support library</a> </td> 624 <td><a href="http://en.cppreference.com/w/cpp/thread">Thread support library</a> </td>
625 <td>C++11 has all kinds of classes for threads, mutexes, etc. Since we already h ave good code for this in <code>base/</code>, we should keep using the base clas ses, at least at first. <code>base::Thread</code> is tightly coupled to <code>Me ssageLoop</code> which would make it hard to replace. We should investigate usin g standard mutexes, or unique_lock, etc. to replace our locking/synchronization classes.</td> 625 <td>Overlaps with many classes in <code>base/</code>. Keep using the <code>base/ </code> classes for now. <code>base::Thread</code> is tightly coupled to <code>M essageLoop</code> which would make it hard to replace. We should investigate usi ng standard mutexes, or unique_lock, etc. to replace our locking/synchronization classes.</td>
626 </tr> 626 </tr>
627 627
628 <tr> 628 <tr>
629 <td>Atomics</td> 629 <td>Atomics</td>
630 <td><code>std::atomic</code> and others in <code>&lt;atomic&gt;</code></td> 630 <td><code>&lt;atomic&gt;</code></td>
631 <td>Fine-grained atomic types and operations</td> 631 <td>Fine-grained atomic types and operations</td>
632 <td><a href="http://en.cppreference.com/w/cpp/atomic">&lt;atomic&gt;</a></td> 632 <td><a href="http://en.cppreference.com/w/cpp/atomic">Atomic operations library< /a></td>
633 <td>Use in tcmalloc has caused <a href="http://crbug.com/572525">performance reg ressions</a>. Banned until we understand this better. <a href="https://groups.go ogle.com/a/chromium.org/d/topic/cxx/Ej3RAiaI44s/discussion">Discussion Thread</a ></td> 633 <td>Use in tcmalloc has caused <a href="http://crbug.com/572525">performance reg ressions</a>. Banned until we understand this better. <a href="https://groups.go ogle.com/a/chromium.org/d/topic/cxx/Ej3RAiaI44s/discussion">Discussion Thread</a ></td>
634 </tr> 634 </tr>
635 635
636 <tr> 636 <tr>
637 <td>Shared Pointers</td> 637 <td>Shared Pointers</td>
638 <td><code>std::shared_ptr</code></td> 638 <td><code>std::shared_ptr</code></td>
639 <td>Allows shared ownership of a pointer through reference counts</td> 639 <td>Allows shared ownership of a pointer through reference counts</td>
640 <td><a href="http://en.cppreference.com/w/cpp/memory/shared_ptr">std::shared_ptr </a></td> 640 <td><a href="http://en.cppreference.com/w/cpp/memory/shared_ptr">std::shared_ptr </a></td>
641 <td>Needs a lot more evaluation for Chromium, and there isn't enough of a push f or this feature. <a href="https://google.github.io/styleguide/cppguide.html#Owne rship_and_Smart_Pointers">Google Style Guide</a>. <a href="https://groups.google .com/a/chromium.org/d/topic/cxx/aT2wsBLKvzI/discussion">Discussion Thread</a>.</ td> 641 <td>Needs a lot more evaluation for Chromium, and there isn't enough of a push f or this feature. <a href="https://google.github.io/styleguide/cppguide.html#Owne rship_and_Smart_Pointers">Google Style Guide</a>. <a href="https://groups.google .com/a/chromium.org/d/topic/cxx/aT2wsBLKvzI/discussion">Discussion Thread</a>.</ td>
642 </tr> 642 </tr>
(...skipping 22 matching lines...) Expand all
665 665
666 <tr> 666 <tr>
667 <td>Attributes</td> 667 <td>Attributes</td>
668 <td><code>[[<i>attribute_name</i>]]</code></td> 668 <td><code>[[<i>attribute_name</i>]]</code></td>
669 <td>Attaches properties to declarations that specific compiler implementations m ay use.</td> 669 <td>Attaches properties to declarations that specific compiler implementations m ay use.</td>
670 <td><a href="http://www.codesynthesis.com/~boris/blog/2012/04/18/cxx11-generaliz ed-attributes/">C++11 generalized attributes</a></td> 670 <td><a href="http://www.codesynthesis.com/~boris/blog/2012/04/18/cxx11-generaliz ed-attributes/">C++11 generalized attributes</a></td>
671 <td></td> 671 <td></td>
672 </tr> 672 </tr>
673 673
674 <tr> 674 <tr>
675 <td>Exception Features</td> 675 <td>Exceptions</td>
676 <td><code>noexcept</code>, <code>exception_ptr</code>, <code>current_exception() </code>, <code>rethrow_exception</code>, <code>nested_exception</code></td> 676 <td><code>noexcept</code> and features in <code>&lt;exception&gt;</code></td>
677 <td>Enhancements to exception throwing and handling</td> 677 <td>Enhancements to exception throwing and handling</td>
678 <td><a href="http://en.cppreference.com/w/cpp/error/exception">std::exception</a ></td> 678 <td><a href="http://en.cppreference.com/w/cpp/header/exception">Standard library header &lt;exception&gt;</a></td>
679 <td>Exceptions are banned by the <a href="https://google.github.io/styleguide/cp pguide.html#Exceptions">Google Style Guide</a>. <a href="https://groups.google.c om/a/chromium.org/forum/#!topic/chromium-dev/8i4tMqNpHhg">Discussion thread</a>< /td> 679 <td>Exceptions are banned by the <a href="https://google.github.io/styleguide/cp pguide.html#Exceptions">Google Style Guide</a> and disabled in Chromium compiles . <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/8 i4tMqNpHhg">Discussion thread</a></td>
680 </tr> 680 </tr>
681 681
682 <tr> 682 <tr>
683 <td>Inline Namespaces</td> 683 <td>Inline Namespaces</td>
684 <td><code>inline</code></td> 684 <td><code>inline namespace foo { ... }</code></td>
685 <td>Allows better versioning of namespaces</td> 685 <td>Allows better versioning of namespaces</td>
686 <td><a href="http://en.cppreference.com/w/cpp/language/namespace">Namespaces</a> </td> 686 <td><a href="http://en.cppreference.com/w/cpp/language/namespace#Inline_namespac es">Inline namespaces</a></td>
687 <td>Unclear how it will work with components</td> 687 <td>Banned in the <a href="https://google.github.io/styleguide/cppguide.html#Nam espaces">Google Style Guide</a>. Unclear how it will work with components.</td>
688 </tr> 688 </tr>
689 689
690 <tr> 690 <tr>
691 <td>User-Defined Literals</td> 691 <td>User-Defined Literals</td>
692 <td><code><i>type</i> <i>var</i> = <i>literal_value</i>_<i>type</i></code></td> 692 <td><code><i>type</i> <i>var</i> = <i>literal_value</i>_<i>type</i></code></td>
693 <td>Allows user-defined literal expressions</td> 693 <td>Allows user-defined literal expressions</td>
694 <td><a href="http://en.cppreference.com/w/cpp/language/user_literal">User-define d literals</a></td> 694 <td><a href="http://en.cppreference.com/w/cpp/language/user_literal">User-define d literals</a></td>
695 <td></td> 695 <td>Banned in the <a href="https://google.github.io/styleguide/cppguide.html#Ope rator_Overloading">Google Style Guide</a>.</td>
696 </tr> 696 </tr>
697 697
698 </tbody> 698 </tbody>
699 </table> 699 </table>
700 700
701 <h3 id="blacklist_stdlib_review"><a name="library-review"></a>C++11 Standard Lib rary Features To Be Discussed</h3> 701 <h3 id="blacklist_stdlib_review"><a name="library-review"></a>C++11 Standard Lib rary Features To Be Discussed</h3>
702 702
703 <p>The following C++ library features are currently disallowed. See the top of t his page on how to propose moving a feature from this list into the allowed or b anned sections. Note that not all of these features work in all our compilers ye t.</p> 703 <p>The following C++ library features are currently disallowed. See the top of t his page on how to propose moving a feature from this list into the allowed or b anned sections. Note that not all of these features work in all our compilers ye t.</p>
704 704
705 <table id="banned_stdlib" class="unlined striped"> 705 <table id="banned_stdlib" class="unlined striped">
(...skipping 29 matching lines...) Expand all
735 <td><code>std::allocator_traits</code></td> 735 <td><code>std::allocator_traits</code></td>
736 <td>Provides an interface for accessing custom allocators</td> 736 <td>Provides an interface for accessing custom allocators</td>
737 <td><a href="http://en.cppreference.com/w/cpp/memory/allocator_traits">std::allo cator_traits</a></td> 737 <td><a href="http://en.cppreference.com/w/cpp/memory/allocator_traits">std::allo cator_traits</a></td>
738 <td>Usage should be rare.</td> 738 <td>Usage should be rare.</td>
739 </tr> 739 </tr>
740 740
741 <tr> 741 <tr>
742 <td>Bind Operations</td> 742 <td>Bind Operations</td>
743 <td><code>std::bind(<i>function</i>, <i>args</i>, ...)</code></td> 743 <td><code>std::bind(<i>function</i>, <i>args</i>, ...)</code></td>
744 <td>Declares a function object bound to certain arguments</td> 744 <td>Declares a function object bound to certain arguments</td>
745 <td>TODO: documentation link</td> 745 <td><a href="http://en.cppreference.com/w/cpp/utility/functional/bind">std::bind </a></td>
746 <td></td> 746 <td></td>
747 </tr> 747 </tr>
748 748
749 <tr> 749 <tr>
750 <td>C Floating-Point Environment</td> 750 <td>C Floating-Point Environment</td>
751 <td><code>&lt;cfenv&gt;</code>, <code>&lt;fenv.h&gt;</code></td> 751 <td><code>&lt;cfenv&gt;</code>, <code>&lt;fenv.h&gt;</code></td>
752 <td>Provides floating point status flags and control modes for C-compatible code </td> 752 <td>Provides floating point status flags and control modes for C-compatible code </td>
753 <td><a href="http://en.cppreference.com/w/cpp/header/cfenv">Standard library hea der &lt;cfenv&gt;</a></td> 753 <td><a href="http://en.cppreference.com/w/cpp/header/cfenv">Standard library hea der &lt;cfenv&gt;</a></td>
754 <td>Banned in <a href="https://google.github.io/styleguide/cppguide.html#C++11"> Google Style Guide</a> due to concerns about compiler support.</td> 754 <td>Banned in <a href="https://google.github.io/styleguide/cppguide.html#C++11"> Google Style Guide</a> due to concerns about compiler support.</td>
755 </tr> 755 </tr>
(...skipping 27 matching lines...) Expand all
783 <td><code>std::result_of&lt;<i>Functor(ArgTypes...)</i>&gt;</code></td> 783 <td><code>std::result_of&lt;<i>Functor(ArgTypes...)</i>&gt;</code></td>
784 <td>Extracts the return type from the type signature of a function call invocati on at compile-time.</td> 784 <td>Extracts the return type from the type signature of a function call invocati on at compile-time.</td>
785 <td><a href="http://en.cppreference.com/w/cpp/types/result_of">std::result_of</a ></td> 785 <td><a href="http://en.cppreference.com/w/cpp/types/result_of">std::result_of</a ></td>
786 <td><a href="http://stackoverflow.com/questions/15486951/why-does-stdresult-of-t ake-an-unrelated-function-type-as-a-type-argument">Why does std::result_of take an (unrelated) function type as a type argument?</a></td> 786 <td><a href="http://stackoverflow.com/questions/15486951/why-does-stdresult-of-t ake-an-unrelated-function-type-as-a-type-argument">Why does std::result_of take an (unrelated) function type as a type argument?</a></td>
787 </tr> 787 </tr>
788 788
789 <tr> 789 <tr>
790 <td>Function Objects</td> 790 <td>Function Objects</td>
791 <td><code>std::function</code></td> 791 <td><code>std::function</code></td>
792 <td>Wraps a standard polymorphic function</td> 792 <td>Wraps a standard polymorphic function</td>
793 <td>TODO: documentation link</td> 793 <td><a href="http://en.cppreference.com/w/cpp/utility/functional/function">std:: function</a></td>
794 <td></td> 794 <td></td>
795 </tr> 795 </tr>
796 796
797 <tr> 797 <tr>
798 <td>Forward Lists</td> 798 <td>Forward Lists</td>
799 <td><code>std::forward_list</code></td> 799 <td><code>std::forward_list</code></td>
800 <td>Provides an efficient singly linked list</td> 800 <td>Provides an efficient singly linked list</td>
801 <td><a href="http://en.cppreference.com/w/cpp/container/forward_list">std::forwa rd_list</a></td> 801 <td><a href="http://en.cppreference.com/w/cpp/container/forward_list">std::forwa rd_list</a></td>
802 <td></td> 802 <td></td>
803 </tr> 803 </tr>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 <td><code>std::ratio&lt;<i>numerator</i>, <i>denominator</i>&gt;</code></td> 847 <td><code>std::ratio&lt;<i>numerator</i>, <i>denominator</i>&gt;</code></td>
848 <td>Provides compile-time rational numbers</td> 848 <td>Provides compile-time rational numbers</td>
849 <td><a href="http://en.cppreference.com/w/cpp/numeric/ratio/ratio">std::ratio</a ></td> 849 <td><a href="http://en.cppreference.com/w/cpp/numeric/ratio/ratio">std::ratio</a ></td>
850 <td>Banned in <a href="https://google.github.io/styleguide/cppguide.html#C++11"> Google Style Guide</a> due to concerns that they are tied to a more template-hea vy interface style.</td> 850 <td>Banned in <a href="https://google.github.io/styleguide/cppguide.html#C++11"> Google Style Guide</a> due to concerns that they are tied to a more template-hea vy interface style.</td>
851 </tr> 851 </tr>
852 852
853 <tr> 853 <tr>
854 <td>Reference Wrapper Classes</td> 854 <td>Reference Wrapper Classes</td>
855 <td><code>std::reference_wrapper</code> and <code>std::ref()</code>, <code>std:: cref()</code></td> 855 <td><code>std::reference_wrapper</code> and <code>std::ref()</code>, <code>std:: cref()</code></td>
856 <td>Allows you to wrap a reference within a standard object (and use those withi n containers)</td> 856 <td>Allows you to wrap a reference within a standard object (and use those withi n containers)</td>
857 <td><a href="http://www.informit.com/guides/content.aspx?g=cplusplus&amp;seqNum= 217">Reference Wrappers</a></td> 857 <td><a href="http://en.cppreference.com/w/cpp/utility/functional/reference_wrapp er">std::reference_wrapper</a></td>
858 <td></td> 858 <td></td>
859 </tr> 859 </tr>
860 860
861 <tr> 861 <tr>
862 <td>Soft Program Exits</td> 862 <td>Soft Program Exits</td>
863 <td><code>std::at_quick_exit()</code>, <code>std::quick_exit()</code></td> 863 <td><code>std::at_quick_exit()</code>, <code>std::quick_exit()</code></td>
864 <td>Allows registration of functions to be called upon exit, allowing cleaner pr ogram exit than <code>abort()</code> or <code>exit</code></td> 864 <td>Allows registration of functions to be called upon exit, allowing cleaner pr ogram exit than <code>abort()</code> or <code>exit</code></td>
865 <td><a href="http://en.cppreference.com/w/cpp/utility/program/quick_exit">std:qu ick_exit</a></td> 865 <td><a href="http://en.cppreference.com/w/cpp/utility/program/quick_exit">std:qu ick_exit</a></td>
866 <td></td> 866 <td></td>
867 </tr> 867 </tr>
868 868
869 <tr> 869 <tr>
870 <td>String-Number Conversion Functions</td> 870 <td>String-Number Conversion Functions</td>
871 <td><code>std::stoi()</code>, <code>std::stol()</code>, <code>std::stoul()</code >, <code>std::stoll</code>, <code>std::stoull()</code>, <code>std::stof()</code> , <code>std::stod()</code>, <code>std::stold()</code>, <code>std::to_string()</c ode></td> 871 <td><code>std::stoi()</code>, <code>std::stol()</code>, <code>std::stoul()</code >, <code>std::stoll</code>, <code>std::stoull()</code>, <code>std::stof()</code> , <code>std::stod()</code>, <code>std::stold()</code>, <code>std::to_string()</c ode></td>
872 <td>Converts strings to/from numbers</td> 872 <td>Converts strings to/from numbers</td>
873 <td><a href="http://en.cppreference.com/w/cpp/string/basic_string/stol">std::sto i, std::stol, std::stoll</a>, <a href="http://en.cppreference.com/w/cpp/string/b asic_string/stoul">std::stoul, std::stoull</a>, <a href="http://en.cppreference. com/w/cpp/string/basic_string/stof">std::stof, std::stod, std::stold</a>, <a hre f="http://en.cppreference.com/w/cpp/string/basic_string/to_string">std::to_strin g</a></td> 873 <td><a href="http://en.cppreference.com/w/cpp/string/basic_string/stol">std::sto i, std::stol, std::stoll</a>, <a href="http://en.cppreference.com/w/cpp/string/b asic_string/stoul">std::stoul, std::stoull</a>, <a href="http://en.cppreference. com/w/cpp/string/basic_string/stof">std::stof, std::stod, std::stold</a>, <a hre f="http://en.cppreference.com/w/cpp/string/basic_string/to_string">std::to_strin g</a></td>
874 <td></td> 874 <td></td>
875 </tr> 875 </tr>
876 876
877 <tr> 877 <tr>
878 <td>System Errors</td> 878 <td>System Errors</td>
879 <td><code>&lt;system_error&gt;</code></td> 879 <td><code>&lt;system_error&gt;</code></td>
880 <td>Provides a standard system error library</td> 880 <td>Provides a standard system error library</td>
881 <td><a href="http://en.cppreference.com/w/cpp/error/system_error">std::system_er ror</a></td> 881 <td><a href="http://en.cppreference.com/w/cpp/header/system_error">Standard libr ary header &lt;system_error&gt;</a></td>
882 <td></td> 882 <td></td>
883 </tr> 883 </tr>
884 884
885 <tr> 885 <tr>
886 <td>Type-Generic Math Functions</td> 886 <td>Type-Generic Math Functions</td>
887 <td>Functions within <code>&lt;ctgmath&gt;</code></td> 887 <td><code>&lt;ctgmath&gt;</code></td>
888 <td>Provides a means to call real or complex functions based on the type of argu ments</td> 888 <td>Provides a means to call real or complex functions based on the type of argu ments</td>
889 <td><a href="http://en.cppreference.com/w/cpp/header/ctgmath">Standard library h eader &lt;ctgmath&gt;</a></td> 889 <td><a href="http://en.cppreference.com/w/cpp/header/ctgmath">Standard library h eader &lt;ctgmath&gt;</a></td>
890 <td></td> 890 <td></td>
891 </tr> 891 </tr>
892 892
893 <tr> 893 <tr>
894 <td>Type Info Enhancements</td> 894 <td>Type Info Enhancements</td>
895 <td><code>std::type_index</code>, <code>std::type_info::hash_code()</code></td> 895 <td><code>std::type_index</code>, <code>std::type_info::hash_code()</code></td>
896 <td>Allows type information (most often within containers) that can be copied, a ssigned, or hashed</td> 896 <td>Allows type information (most often within containers) that can be copied, a ssigned, or hashed</td>
897 <td><a href="http://en.cppreference.com/w/cpp/types/type_index">std::type_index< /a>, <a href="http://en.cppreference.com/w/cpp/types/type_info/hash_code">std::t ype_info::hash_code</a></td> 897 <td><a href="http://en.cppreference.com/w/cpp/types/type_index">std::type_index< /a>, <a href="http://en.cppreference.com/w/cpp/types/type_info/hash_code">std::t ype_info::hash_code</a></td>
898 <td><code>std::type_index</code> is a thin wrapper for <code>std::type_info</cod e>, allowing you to use it directly within both associative and unordered contai ners</td> 898 <td><code>std::type_index</code> is a thin wrapper for <code>std::type_info</cod e>, allowing you to use it directly within both associative and unordered contai ners</td>
899 </tr> 899 </tr>
900 900
901 <tr> 901 <tr>
902 <td>Variadic Copy Macro</td> 902 <td>Variadic Copy Macro</td>
903 <td><code>va_copy(va_list <i>dest</i>, va_list <i>src</i>)</code></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> 904 <td>Makes a copy of the variadic function arguments</td>
905 <td></td> 905 <td><a href="http://en.cppreference.com/w/cpp/utility/variadic/va_copy">va_copy< /a></td>
906 <td></td> 906 <td></td>
907 </tr> 907 </tr>
908 908
909 <tr> 909 <tr>
910 <td>Weak Pointers</td> 910 <td>Weak Pointers</td>
911 <td><code>std::weak_ptr</code></td> 911 <td><code>std::weak_ptr</code></td>
912 <td>Allows a weak reference to a <code>std::shared_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">std::weak_ptr</a> </td> 913 <td><a href="http://en.cppreference.com/w/cpp/memory/weak_ptr">std::weak_ptr</a> </td>
914 <td><a href="https://google.github.io/styleguide/cppguide.html#Ownership_and_Sma rt_Pointers">Ownership and Smart Pointers</a></td> 914 <td><a href="https://google.github.io/styleguide/cppguide.html#Ownership_and_Sma rt_Pointers">Ownership and Smart Pointers</a></td>
915 </tr> 915 </tr>
916 916
917 <tr> 917 <tr>
918 <td>Wide String Support</td> 918 <td>Wide String Support</td>
919 <td><code>std::wstring_convert</code>, <code>std::wbuffer_convert</code><br /> 919 <td><code>std::wstring_convert</code>, <code>std::wbuffer_convert</code><br />
920 <code>std::codecvt_utf8</code>, <code>std::codecvt_utf16</code>, <code>std::code cvt_utf8_utf16</code></td> 920 <code>std::codecvt_utf8</code>, <code>std::codecvt_utf16</code>, <code>std::code cvt_utf8_utf16</code></td>
921 <td>Converts between string encodings</td> 921 <td>Converts between string encodings</td>
922 <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> 922 <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>
923 <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> 923 <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>
924 </tr> 924 </tr>
925 925
926 </tbody> 926 </tbody>
927 </table> 927 </table>
928 928
929 </div> 929 </div>
930 </body> 930 </body>
931 </html> 931 </html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698