• <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 閱讀(543) 評論(0)  編輯 收藏 引用
            久久精品aⅴ无码中文字字幕重口| 伊人久久无码精品中文字幕| 日本久久久久亚洲中字幕| 久久91精品国产91久| 亚洲精品综合久久| 久久久久久人妻无码| 国内精品久久久久久久影视麻豆| 久久性精品| 人妻无码中文久久久久专区| 久久香蕉国产线看观看乱码| 久久久精品久久久久影院| 久久国产精品一国产精品金尊 | 精品一久久香蕉国产线看播放| 久久久久无码中| 伊人久久大香线焦AV综合影院| 老司机国内精品久久久久| 99久久香蕉国产线看观香| 久久这里只精品国产99热| 久久久久久久波多野结衣高潮| 青青青青久久精品国产| 伊人久久精品无码二区麻豆| 青青热久久国产久精品 | segui久久国产精品| 狠狠色丁香婷婷久久综合 | 久久久亚洲裙底偷窥综合| 精品免费久久久久国产一区| 久久久免费精品re6| 亚洲午夜久久久影院| 一级做a爰片久久毛片免费陪| 亚洲va久久久噜噜噜久久| 久久国产精品偷99| 国产午夜精品久久久久免费视 | 久久亚洲精品国产精品| 无码精品久久一区二区三区| 一本色道久久88加勒比—综合| 久久中文骚妇内射| 久久综合香蕉国产蜜臀AV| 亚洲另类欧美综合久久图片区| 久久亚洲综合色一区二区三区| 国内精品久久久久| 久久99国产精品99久久|