• <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)  編輯 收藏 引用
            久久久久一本毛久久久| 亚洲一本综合久久| 久久久亚洲AV波多野结衣| 久久国产AVJUST麻豆| 狠狠色丁香久久婷婷综合蜜芽五月| 久久亚洲日韩看片无码| 欧美一区二区三区久久综合| 91亚洲国产成人久久精品网址| 国内精品久久久久久久影视麻豆| 伊人久久国产免费观看视频 | 99精品国产在热久久无毒不卡| 精品国产VA久久久久久久冰 | 成人免费网站久久久| 久久激情亚洲精品无码?V| 色综合久久久久无码专区| 精品人妻伦九区久久AAA片69| 欧洲成人午夜精品无码区久久| 久久国产精品无码网站| 国内精品久久久人妻中文字幕| 久久久久婷婷| Xx性欧美肥妇精品久久久久久 | 97r久久精品国产99国产精| 热综合一本伊人久久精品| 国产亚洲色婷婷久久99精品| 欧美亚洲另类久久综合婷婷 | 国产成人久久精品区一区二区| 伊人久久国产免费观看视频| 久久99精品久久久久久水蜜桃| 久久香综合精品久久伊人| 久久人与动人物a级毛片| 久久久久久久免费视频| 美女久久久久久| 性高湖久久久久久久久AAAAA| 91精品国产综合久久四虎久久无码一级 | 亚洲欧美国产精品专区久久 | 中文字幕久久精品无码| 欧美精品乱码99久久蜜桃| 亚洲精品tv久久久久| 亚洲精品无码久久毛片| 亚洲中文字幕无码久久2017| 国产aⅴ激情无码久久|