mirror of
https://github.com/CnTransGroup/EffectiveModernCppChinese.git
synced 2025-02-06 17:20:44 +08:00
deploy: fcd6fce86f
This commit is contained in:
parent
78eea2b431
commit
873ca670ac
@ -153,7 +153,7 @@
|
||||
<p>在本章的这些小节中,非常重要的一点是要牢记形参永远是<strong>左值</strong>,即使它的类型是一个右值引用。比如,假设</p>
|
||||
<pre><code class="language-c++">void f(Widget&& w);
|
||||
</code></pre>
|
||||
<p>形参<code>w</code>是一个左值,即使它的类型是一个rvalue-reference-to-<code>Widget</code>。(如果这里震惊到你了,请重新回顾从本书<a href="https://github.com/kelthuzadx/EffectiveModernCppChinese/blob/master/Introduction.md">简介</a>开始的关于左值和右值的总览。)</p>
|
||||
<p>形参<code>w</code>是一个左值,即使它的类型是一个rvalue-reference-to-<code>Widget</code>。(如果这里震惊到你了,请重新回顾从本书<a href="https://github.com/CnTransGroup/EffectiveModernCppChinese/blob/master/src/Introduction.md">简介</a>开始的关于左值和右值的总览。)</p>
|
||||
<h2 id="条款二十三理解stdmove和stdforward"><a class="header" href="#条款二十三理解stdmove和stdforward">条款二十三:理解<code>std::move</code>和<code>std::forward</code></a></h2>
|
||||
<p><strong>Item 23: Understand <code>std::move</code> and <code>std::forward</code></strong></p>
|
||||
<p>为了了解<code>std::move</code>和<code>std::forward</code>,一种有用的方式是从<strong>它们不做什么</strong>这个角度来了解它们。<code>std::move</code>不移动(move)任何东西,<code>std::forward</code>也不转发(forward)任何东西。在运行时,它们不做任何事情。它们不产生任何可执行代码,一字节也没有。</p>
|
||||
|
@ -3235,7 +3235,7 @@ w1 = std::move(w2); //移动赋值w1
|
||||
<p>在本章的这些小节中,非常重要的一点是要牢记形参永远是<strong>左值</strong>,即使它的类型是一个右值引用。比如,假设</p>
|
||||
<pre><code class="language-c++">void f(Widget&& w);
|
||||
</code></pre>
|
||||
<p>形参<code>w</code>是一个左值,即使它的类型是一个rvalue-reference-to-<code>Widget</code>。(如果这里震惊到你了,请重新回顾从本书<a href="https://github.com/kelthuzadx/EffectiveModernCppChinese/blob/master/Introduction.md">简介</a>开始的关于左值和右值的总览。)</p>
|
||||
<p>形参<code>w</code>是一个左值,即使它的类型是一个rvalue-reference-to-<code>Widget</code>。(如果这里震惊到你了,请重新回顾从本书<a href="https://github.com/CnTransGroup/EffectiveModernCppChinese/blob/master/src/Introduction.md">简介</a>开始的关于左值和右值的总览。)</p>
|
||||
<h2 id="条款二十三理解stdmove和stdforward"><a class="header" href="#条款二十三理解stdmove和stdforward">条款二十三:理解<code>std::move</code>和<code>std::forward</code></a></h2>
|
||||
<p><strong>Item 23: Understand <code>std::move</code> and <code>std::forward</code></strong></p>
|
||||
<p>为了了解<code>std::move</code>和<code>std::forward</code>,一种有用的方式是从<strong>它们不做什么</strong>这个角度来了解它们。<code>std::move</code>不移动(move)任何东西,<code>std::forward</code>也不转发(forward)任何东西。在运行时,它们不做任何事情。它们不产生任何可执行代码,一字节也没有。</p>
|
||||
|
Loading…
Reference in New Issue
Block a user