OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright 2014 The Chromium Authors. All rights reserved. | 3 Copyright 2014 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 <html> | 7 <html> |
8 <head> | 8 <head> |
9 <meta charset="utf-8"> | 9 <meta charset="utf-8"> |
10 <title>C++11 use in Chromium</title> | 10 <title>C++11 use in Chromium</title> |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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>TODO: documentation link</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>) -> <i>ret</i> { <i>body</i> }</cod e></td> | 195 <td><code>[<i>captures</i>](<i>params</i>) -> <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; use captureless lambda with <code>base::Bind</code> and <code>base::Callback</code> instead, because they offer protection against a lar ge class of object lifetime mistakes. Don't use default captures (<code>[=]</cod e>, <code>[&]</code> – <a href="https://google.github.io/styleguide/cp pguide.html#Lambda_expressions">Google Style Guide</a>). Lambdas are typically u seful as a parameter to methods or functions that will use them immediately, suc h as those in <code><algorithm></code>. <a href="https://groups.google.com /a/chromium.org/forum/#!topic/chromium-dev/D9UnnxBnciQ">Discussion thread</a></t d> | 198 <td>Do not bind or store capturing lambdas outside the lifetime of the stack fra me they are defined in. Captureless lambdas are OK, E.G. <code>base::Bind([](int j){}, i);</code> with <code>base::Callback</code>, because they offer protectio n against a large class of object lifetime mistakes. Don't use default captures (<code>[=]</code>, <code>[&]</code> – <a href="https://google.github.i o/styleguide/cppguide.html#Lambda_expressions">Google Style Guide</a>). Lambdas are typically useful as a parameter to methods or functions that will use them i mmediately, such as those in <code><algorithm></code>. <a href="https://gr oups.google.com/a/chromium.org/forum/#!topic/chromium-dev/D9UnnxBnciQ">Discussio n thread</a>, <a href="https://groups.google.com/a/chromium.org/forum/#!topic/cx x/QxjsPELDYdQ">uncapturing thread</a>. |
danakj
2016/09/30 18:38:18
nit: Can you reword this a little bit. Like: Captu
dcheng
2016/09/30 18:41:27
Super duper tiny extra small nit: e.g. is usually
scheib
2016/09/30 20:53:33
Done.
scheib
2016/09/30 20:53:33
Done.
| |
199 </td> | |
199 </tr> | 200 </tr> |
200 | 201 |
201 <tr> | 202 <tr> |
202 <td>Local Types as Template Arguments</td> | 203 <td>Local Types as Template Arguments</td> |
203 <td><code>void func() {<br /> | 204 <td><code>void func() {<br /> |
204 class Pred {<br /> | 205 class Pred {<br /> |
205 public:<br /> | 206 public:<br /> |
206 bool operator()(const T&) { ... }<br /> | 207 bool operator()(const T&) { ... }<br /> |
207 };<br /> | 208 };<br /> |
208 std::remove_if(vec.begin(), vec.end(), Pred());</code></td> | 209 std::remove_if(vec.begin(), vec.end(), Pred());</code></td> |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
921 <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> |
922 <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> |
923 </tr> | 924 </tr> |
924 | 925 |
925 </tbody> | 926 </tbody> |
926 </table> | 927 </table> |
927 | 928 |
928 </div> | 929 </div> |
929 </body> | 930 </body> |
930 </html> | 931 </html> |
OLD | NEW |