• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            The Coder

            I am a humble coder.

              C++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              4 隨筆 :: 4 文章 :: 9 評論 :: 0 Trackbacks

            下面這段引文可對左值、右值加深理解。

            參考文獻(xiàn):《ANSI/ISO C++ Professional Programmer's Handbook》

            lvalues and rvalues
            An object is a contiguous region of storage. An lvalue is an expression that refers to such an object. The original
            definition of lvalue referred to an object that can appear on the left-hand side of an assignment. However, const
            objects are lvalues that cannot be used in the left-hand side of an assignment. Similarly, an expression that can appear
            in the right-hand side of an expression (but not in the left-hand side of an expression) is an rvalue. For example

            #include? < string >
            using ? namespace ?std;
            int & ?f();
            void ?func()
            {
            ????
            int ?n;
            ????
            char ?buf[ 3 ];
            ????n?
            = ? 5 ;? // ?n?is?an?lvalue;?5?is?an?rvalue
            ????buf[ 0 ]? = ? ' a ' ;? // ?buf[0]?is?an?lvalue,?'a'?is?an?rvalue
            ???? string ?s1? = ? " a " ,?s2? = ? " b " ,?s3? = ?? " c " ;? // ?"a",?"b",?"c"?are?rvalues
            ????s1? = ? // ?lvalue
            ????s2? + s3;? // s2?and?s3?are?lvalues?that?are??implicitly?converted?to?rvalues
            ????s1? = ? // lvalue
            ???? string ( " z " );? // temporaries?are?rvalues
            ???? int ? * ?p? = ? new ? int ;? // p?is?an?lvalue;?'new?int'?is?an?rvalue
            ????f()? = ? 0 ;? // a?function?call?that?returns?a?reference?is?an?lvalue
            ?????s1.size();? // otherwise,?a?function?call?is?an?rvalue?expression
            }

            An lvalue can appear in a context that requires an rvalue; in this case, the lvalue is implicitly converted to an rvalue.
            An rvalue cannot be converted to an lvalue. Therefore, it is possible to use every lvalue expression in the example as
            an rvalue, but not vice versa.
            posted on 2006-06-02 12:03 TH 閱讀(544) 評論(0)  編輯 收藏 引用
            久久99精品久久久久久久不卡| 亚洲乱码中文字幕久久孕妇黑人| 亚洲狠狠综合久久| 久久免费大片| 国产产无码乱码精品久久鸭| 亚洲国产精品久久久久婷婷老年| 久久九九兔免费精品6| 青青热久久综合网伊人| 久久久久av无码免费网 | 久久亚洲AV成人无码| 久久久久久久久无码精品亚洲日韩| 99久久精品国产一区二区| 久久精品国产清自在天天线| 国产毛片久久久久久国产毛片| 欧洲成人午夜精品无码区久久| 无码任你躁久久久久久老妇| 蜜桃麻豆www久久| 久久国产色AV免费观看| 亚洲AV无码久久| 久久久久久亚洲精品影院| 国产一区二区精品久久凹凸| 精品国产VA久久久久久久冰| 久久久久久久精品妇女99| 久久久WWW成人| 99久久国产综合精品网成人影院| 韩国免费A级毛片久久| 久久人人爽人人爽人人AV | 久久亚洲国产精品一区二区| 色偷偷久久一区二区三区| 久久99久国产麻精品66| 久久免费看黄a级毛片| 亚洲精品无码久久久久AV麻豆| 久久强奷乱码老熟女网站| 久久国产视频网| 亚洲国产日韩欧美久久| 久久天天婷婷五月俺也去| 久久亚洲精品无码aⅴ大香| 麻豆亚洲AV永久无码精品久久| 亚洲中文精品久久久久久不卡 | 香蕉久久一区二区不卡无毒影院 | 久久99精品国产麻豆蜜芽|