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

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


            久久久久久久综合狠狠综合| 狠狠色婷婷久久一区二区 | 久久久久久久精品成人热色戒| 久久人人爽人人爽人人av东京热 | 亚洲国产精品婷婷久久| 亚洲伊人久久成综合人影院| 久久99国产精品久久久| 亚洲国产另类久久久精品| 亚洲婷婷国产精品电影人久久| 囯产极品美女高潮无套久久久| a级成人毛片久久| 东京热TOKYO综合久久精品| 久久精品国产99久久久古代| 青青青青久久精品国产h| 久久这里只精品国产99热| 久久久久久精品久久久久| A级毛片无码久久精品免费| 99久久99久久精品国产片| 精品国产乱码久久久久软件| 久久久青草青青亚洲国产免观| 亚洲精品乱码久久久久久久久久久久| 日韩精品国产自在久久现线拍| 乱亲女H秽乱长久久久| 国产精品久久网| 亚洲va久久久噜噜噜久久男同| 欧美久久一区二区三区| 久久99热这里只有精品66| 久久WWW免费人成一看片| 一本色道久久88综合日韩精品 | 伊人久久大香线蕉综合影院首页| 久久精品免费网站网| 97视频久久久| 天天做夜夜做久久做狠狠| 久久国产成人午夜aⅴ影院| 欧美与黑人午夜性猛交久久久 | 国内精品九九久久久精品| 99精品国产综合久久久久五月天| 热综合一本伊人久久精品| 亚洲人成网站999久久久综合| 一本综合久久国产二区| 中文无码久久精品|