Commit 464f1d50 authored by Vladimir Levin's avatar Vladimir Levin Committed by Commit Bot

c++: Allow ref-qualified member functions with "use sparingly" advice.

This patch moves the ref-qualified member functions section to the
whitelisted section, with advice to use it sparingly since it may be
poorly understood.

R=kylechar@chromium.org, danakj@chromium.org, pkasting@chromium.org

Change-Id: Ic9400af6a940d3f68c10cca617eb94ad161385ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1649733Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Auto-Submit: vmpstr <vmpstr@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#667321}
parent e4bf958c
......@@ -285,6 +285,20 @@ enum <i>enumname</i> : <i>base-type</i></code></td>
<td>Beware of passing these as macro arguments, which can trigger a <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57824">lexer bug</a> on older GCC versions. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/2kWQHbbuMHI">Discussion thread</a></td>
</tr>
<tr>
<td>Ref-qualified Member Functions</td>
<td><code>class T {<br />
&nbsp;&nbsp;void f() &amp; {}<br />
&nbsp;&nbsp;void f() &amp;&amp; {}<br />
};<br />
t.f();&nbsp;&nbsp;// first<br />
T().f();&nbsp;&nbsp;// second<br />
std::move(t).f();&nbsp;&nbsp;// second</code></td>
<td>Allows class member functions to only bind to |this| as an rvalue or lvalue.</td>
<td><a href="http://en.cppreference.com/w/cpp/language/member_functions#const-.2C_volatile-.2C_and_ref-qualified_member_functions">const-, volatile-, and ref-qualified member functions</a></td>
<td>Use sparingly, since this feature may not be understood well by all developers. Consult with <code>styleguide/c++/OWNERS</code> when in doubt. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/cxx/gowclr2LPQA">Discussion Thread</a></td>
</tr>
<tr>
<td>Rvalue References</td>
<td><code>T(T&amp;&amp; t)</code> and <code>T&amp; operator=(T&amp;&amp; t)<br/><br/>
......@@ -778,20 +792,6 @@ template &lt;typename T&gt;<br/>void Function(T&amp;&amp; t) { ... }</code></td>
<td>Use a stdint.h type if you need a 64bit number. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/RxugZ-pIDxk">Discussion thread</a></td>
</tr>
<tr>
<td>Ref-qualified Member Functions</td>
<td><code>class T {<br />
&nbsp;&nbsp;void f() &amp; {}<br />
&nbsp;&nbsp;void f() &amp;&amp; {}<br />
};<br />
t.f();&nbsp;&nbsp;// first<br />
T().f();&nbsp;&nbsp;// second<br />
std::move(t).f();&nbsp;&nbsp;// second</code></td>
<td>Allows class member functions to only bind to |this| as an rvalue or lvalue.</td>
<td><a href="http://en.cppreference.com/w/cpp/language/member_functions#const-.2C_volatile-.2C_and_ref-qualified_member_functions">const-, volatile-, and ref-qualified member functions</a></td>
<td>Banned in the <a href="https://google.github.io/styleguide/cppguide.html#C++11">Google Style Guide</a>. May only be used in Chromium with explicit approval from <code>styleguide/c++/OWNERS</code>. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/cxx/gowclr2LPQA">Discussion Thread</a></td>
</tr>
<tr>
<td>User-Defined Literals</td>
<td><code><i>type</i> <i>var</i> = <i>literal_value</i>_<i>type</i></code></td>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment