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

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


            伊人久久大香线蕉精品不卡| 亚洲伊人久久成综合人影院 | 久久97久久97精品免视看| 亚洲国产成人久久综合碰碰动漫3d| 久久精品国产一区二区三区日韩| 久久国产V一级毛多内射| 无码八A片人妻少妇久久| 国产91色综合久久免费分享| 久久午夜综合久久| 久久天堂AV综合合色蜜桃网| 久久亚洲国产精品五月天婷| 亚洲精品乱码久久久久久蜜桃图片| 亚洲综合久久综合激情久久| 国产精品久久新婚兰兰| 99久久国产免费福利| 国产精品一区二区久久不卡| 伊人色综合久久天天人守人婷| 久久久久夜夜夜精品国产| 久久亚洲AV成人无码| 成人午夜精品久久久久久久小说 | 久久久精品视频免费观看| 亚洲国产精品成人久久| 日韩AV毛片精品久久久| 久久婷婷久久一区二区三区| 中文精品久久久久人妻不卡| 色综合久久久久综合99| 久久国产精品一区| 97超级碰碰碰碰久久久久| 精品蜜臀久久久久99网站| 少妇人妻88久久中文字幕| 久久无码AV一区二区三区| 久久久久无码精品| 久久人人爽人人精品视频| 国产巨作麻豆欧美亚洲综合久久| 久久久91精品国产一区二区三区 | 国产69精品久久久久777| 久久国产精品77777| 高清免费久久午夜精品| 人人狠狠综合久久亚洲88| 9191精品国产免费久久| 精品乱码久久久久久夜夜嗨|