• <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++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
              4 隨筆 :: 4 文章 :: 9 評論 :: 0 Trackbacks

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

            參考文獻:《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) 評論(0)  編輯 收藏 引用
            国产成人精品综合久久久| 亚洲综合伊人久久大杳蕉| 久久久久四虎国产精品| 丁香五月综合久久激情| 精品久久人人做人人爽综合 | 99久久人人爽亚洲精品美女| 品成人欧美大片久久国产欧美| 亚洲另类欧美综合久久图片区| 超级碰碰碰碰97久久久久| 国内精品久久久久影院优| 国产激情久久久久影院老熟女免费 | 热久久这里只有精品| 久久中文字幕人妻丝袜| 久久国产亚洲精品无码| 日韩AV毛片精品久久久| 韩国免费A级毛片久久| 精品久久久久久久国产潘金莲| 久久777国产线看观看精品| 久久这里有精品| 国产成人久久精品二区三区| 久久国产热精品波多野结衣AV| 日韩十八禁一区二区久久| 国产精品免费久久久久影院| 亚洲色婷婷综合久久| 精品久久国产一区二区三区香蕉 | 国产精品久久久久久搜索| 亚洲va久久久噜噜噜久久狠狠| 精品国产乱码久久久久久浪潮| 国内精品久久久久久野外| 久久精品国产亚洲AV无码娇色 | 色综合久久无码五十路人妻| 久久久久久国产精品免费免费| 国产国产成人精品久久| 成人妇女免费播放久久久 | 91秦先生久久久久久久| 91精品国产色综合久久| 久久久久亚洲AV成人片| 91久久精一区二区三区大全| 精品国产乱码久久久久久郑州公司| 亚洲中文字幕无码久久精品1| 久久中文骚妇内射|