<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          C++核心準(zhǔn)則C.63:保證移動(dòng)賦值運(yùn)算符為非虛函數(shù),參數(shù)類型為右值...

          1c70c564471aa4a3b1d3b02f80dec820.webp

          C.63: Make move assignment non-virtual, take the parameter by &&, and return by non-const &
          C.63:保證移動(dòng)賦值運(yùn)算符為非虛函數(shù),參數(shù)類型為右值引用,返回值為常量引用類型

          Reason(原因)

          It is simple and efficient.

          這樣做簡(jiǎn)單且高效。


          See(參見):

          The rule for copy-assignment.

          拷貝賦值規(guī)則。


          相關(guān)鏈接:

          https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rc-copy-assignment




          Enforcement(實(shí)施建議)

          Equivalent to what is done for copy-assignment.

          和拷貝賦值的情況時(shí)所做的相同。

          • (Simple) An assignment operator should not be virtual. Here be dragons!

            (簡(jiǎn)單)賦值運(yùn)算符不應(yīng)該是虛函數(shù)。那樣做很危險(xiǎn)。

          • (Simple) An assignment operator should return T& to enable chaining, not alternatives like const T& which interfere with composability and putting objects in containers.

            (簡(jiǎn)單)賦值運(yùn)算符應(yīng)該返回T&,這樣才能實(shí)現(xiàn)連續(xù)賦值。不要改成類似const T&的類型,這樣會(huì)影響組裝性并妨礙將對(duì)象放進(jìn)容器中。

          • (Moderate) A move assignment operator should (implicitly or explicitly) invoke all base and member move assignment operators.

            (中等)移動(dòng)賦值運(yùn)算符應(yīng)該(隱式或顯式)調(diào)用所有的基類和成員的移動(dòng)賦值運(yùn)算符。

          原文鏈接

          https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c63-make-move-assignment-non-virtual-take-the-parameter-by--and-return-by-non-const-




          覺得本文有幫助?請(qǐng)分享給更多人。

          關(guān)注【面向?qū)ο笏伎肌枯p松學(xué)習(xí)每一天!

          面向?qū)ο箝_發(fā),面向?qū)ο笏伎迹?/span>

          瀏覽 69
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  青青草黄视频无限在线观 | 午夜久久久久久久久久影院 | 影音先锋av无码在线 | 国产精品一级无码免费 | AV手机在线 |