• <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++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
              4 隨筆 :: 4 文章 :: 9 評論 :: 0 Trackbacks

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

            參考文獻:《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 閱讀(538) 評論(0)  編輯 收藏 引用
            91精品国产91久久久久久蜜臀| 精品午夜久久福利大片| 一本久道久久综合狠狠爱| 狠狠色丁香久久婷婷综合五月| 国产精品青草久久久久福利99| 香蕉久久夜色精品国产尤物| 青青草原综合久久大伊人精品| 蜜桃麻豆WWW久久囤产精品| 久久国产亚洲精品麻豆| 伊人久久大香线蕉综合Av| 大美女久久久久久j久久| 欧美丰满熟妇BBB久久久| 久久午夜综合久久| 欧美久久精品一级c片片| 国产激情久久久久久熟女老人| 国产亚州精品女人久久久久久 | 国产精品久久久久久久久软件| 久久亚洲精品成人av无码网站| 久久香蕉国产线看观看猫咪?v| 99精品久久精品一区二区| 久久久久波多野结衣高潮| 久久久久九国产精品| 久久久国产精品网站| 久久国产精品成人影院| 亚洲精品乱码久久久久66| 久久综合九色综合网站| 日本亚洲色大成网站WWW久久| 亚洲午夜久久久精品影院 | 热99re久久国超精品首页| 伊人久久无码中文字幕| 久久夜色精品国产亚洲| 伊人色综合久久天天网| 一本大道久久东京热无码AV| 久久久久久亚洲精品无码| 久久久精品日本一区二区三区| 国内精品久久久久久久影视麻豆| 国产精品美女久久久久久2018| 久久精品国产亚洲av高清漫画| 国产成人精品免费久久久久| 国产国产成人精品久久| 久久99精品久久久久子伦|