• <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++博客 :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              4 隨筆 :: 4 文章 :: 9 評(píng)論 :: 0 Trackbacks

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

            參考文獻(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 閱讀(551) 評(píng)論(0)  編輯 收藏 引用

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


            久久精品亚洲精品国产色婷| 精品久久久久久久久免费影院| 少妇内射兰兰久久| 亚洲精品高清国产一线久久| 久久国产色AV免费观看| 久久香蕉国产线看观看99| 伊人久久大香线蕉精品不卡| 三级韩国一区久久二区综合 | 久久久久一本毛久久久| 久久伊人中文无码| 久久精品国产亚洲AV电影| 亚洲午夜久久影院| 久久久久久曰本AV免费免费| 久久精品视频网| 99蜜桃臀久久久欧美精品网站 | 久久久久亚洲AV无码专区网站| 国内精品伊人久久久久777| 久久精品草草草| 亚洲国产另类久久久精品小说| 久久精品女人天堂AV麻| 欧美综合天天夜夜久久| 精品久久久久久无码专区不卡 | 久久笫一福利免费导航| 久久亚洲AV成人无码电影| 久久av高潮av无码av喷吹| 久久ZYZ资源站无码中文动漫| 久久综合狠狠综合久久97色| 国产成人久久精品区一区二区| 亚洲精品无码久久毛片| 久久久久久久综合日本| 国产成人精品久久综合| 伊人久久大香线蕉精品| av国内精品久久久久影院| 人妻少妇久久中文字幕| 久久免费的精品国产V∧| 亚洲精品无码久久久久sm| 2021国内久久精品| 亚洲综合日韩久久成人AV| 人妻少妇久久中文字幕| 99久久人妻无码精品系列| 99久久免费国产特黄|