• <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 閱讀(543) 評論(0)  編輯 收藏 引用

            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            久久亚洲精品视频| 国产高潮久久免费观看| 精品久久久久久久久久中文字幕| 狠狠色丁香久久婷婷综合蜜芽五月| 久久精品99久久香蕉国产色戒| 狠狠色丁香婷婷久久综合五月 | 一本久道久久综合狠狠躁AV| 久久国产视频网| 香蕉久久永久视频| 色狠狠久久综合网| 国产毛片欧美毛片久久久 | 91精品国产高清久久久久久国产嫩草 | 成人国内精品久久久久影院VR| 中文成人无码精品久久久不卡| 亚洲美日韩Av中文字幕无码久久久妻妇 | 久久亚洲AV成人出白浆无码国产| 一本一道久久a久久精品综合| 国产A级毛片久久久精品毛片| 欧美va久久久噜噜噜久久| 久久精品国产亚洲AV麻豆网站| 97久久精品无码一区二区天美| 青青草原综合久久大伊人精品| 亚洲国产精品人久久| 亚洲欧洲中文日韩久久AV乱码| 久久久久久久精品妇女99| 欧美噜噜久久久XXX| 国产午夜精品久久久久九九电影| 热久久视久久精品18| 久久天天躁狠狠躁夜夜avapp| 久久综合九色综合精品| 色播久久人人爽人人爽人人片aV | 国产精品久久99| 日日狠狠久久偷偷色综合96蜜桃| 久久精品午夜一区二区福利| 狠狠色综合久久久久尤物| 成人久久免费网站| 久久国产香蕉一区精品| 久久精品夜夜夜夜夜久久| 99久久精品国产免看国产一区| 久久国产免费观看精品3| 久久Av无码精品人妻系列|