• <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   管理


            伊人久久大香线蕉亚洲| 欧美熟妇另类久久久久久不卡 | 麻豆成人久久精品二区三区免费| 性做久久久久久久久久久| 2019久久久高清456| 久久精品国产亚洲麻豆| 欧美激情精品久久久久久久九九九 | 波多野结衣久久| 狠狠色丁香久久综合婷婷| 久久夜色撩人精品国产| www.久久99| 一本久道久久综合狠狠爱| 国产三级精品久久| 国产亚洲精品自在久久| 久久久午夜精品福利内容| 狠狠色丁香久久婷婷综| 国内精品伊人久久久久妇| 国産精品久久久久久久| 国产成人久久激情91| 中文字幕乱码人妻无码久久| 久久综合九色欧美综合狠狠| 国产精品久久99| 久久99国产乱子伦精品免费| 久久久久久伊人高潮影院| 久久e热在这里只有国产中文精品99| 久久久噜噜噜久久中文福利| 国产偷久久久精品专区| 久久成人小视频| 久久综合久久美利坚合众国| 午夜福利91久久福利| 亚洲国产成人久久综合碰| 久久精品国产清自在天天线| 国内精品久久久久影院网站| 99久久婷婷国产一区二区| 亚洲午夜久久久精品影院| 9191精品国产免费久久| 国产亚州精品女人久久久久久 | 岛国搬运www久久| 国内精品久久久久久久涩爱| 久久伊人色| 99蜜桃臀久久久欧美精品网站|