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


            99久久99这里只有免费费精品| 久久久精品国产亚洲成人满18免费网站| 一本色道久久HEZYO无码| 亚洲中文精品久久久久久不卡| 久久久久久精品无码人妻| 青青青国产精品国产精品久久久久 | 99久久精品国产麻豆| 狠狠综合久久综合中文88| 亚洲AV日韩精品久久久久久久| yellow中文字幕久久网| 无码日韩人妻精品久久蜜桃| 久久99国产精品一区二区| 伊人久久精品无码av一区| 久久免费线看线看| 国内精品伊人久久久久妇| 国产精品九九久久免费视频| 久久综合亚洲色一区二区三区| 久久综合久久综合久久| 国产AⅤ精品一区二区三区久久| 久久中文字幕人妻丝袜| 久久高潮一级毛片免费| 国产亚洲精久久久久久无码| 一本综合久久国产二区| 久久天天躁狠狠躁夜夜av浪潮| 久久国产成人精品麻豆| 狠狠色狠狠色综合久久| 日韩久久久久中文字幕人妻| 色婷婷久久综合中文久久一本| 99久久精品国产一区二区| 99热热久久这里只有精品68| 人妻无码久久一区二区三区免费| 囯产精品久久久久久久久蜜桃| 久久久久久噜噜精品免费直播| 97超级碰碰碰碰久久久久| 97久久精品无码一区二区| 嫩草伊人久久精品少妇AV| 久久AV高清无码| 日韩精品久久久久久| 久久se精品一区二区| 亚洲国产成人久久综合一| 久久国产精品99精品国产987|