• <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 閱讀(544) 評論(0)  編輯 收藏 引用
            国产精品热久久毛片| 天天躁日日躁狠狠久久| 久久国产精品久久| 九九99精品久久久久久| 国产午夜精品久久久久九九| 国内精品伊人久久久久网站| 欧美大战日韩91综合一区婷婷久久青草| 亚洲国产成人久久精品99| 久久久久久久波多野结衣高潮 | 久久久久亚洲AV无码永不| 久久综合九色综合网站| 久久狠狠色狠狠色综合| 亚洲午夜精品久久久久久浪潮| 亚洲精品乱码久久久久久按摩 | 久久久亚洲AV波多野结衣| 亚洲va国产va天堂va久久| 91精品国产9l久久久久| 一本久久免费视频| 久久久久99精品成人片直播| 国内精品久久久久久中文字幕| 久久综合久久自在自线精品自| 青青热久久国产久精品| 99久久免费国产特黄| 欧美久久久久久| 国产69精品久久久久99| 久久久久人妻一区精品色| 中文精品久久久久人妻| 国产成人精品久久综合| 久久夜色精品国产噜噜噜亚洲AV| 久久亚洲精品无码播放| 99久久国产主播综合精品| 国产情侣久久久久aⅴ免费| 久久精品国产亚洲AV影院| 久久久这里有精品中文字幕| 91精品国产综合久久四虎久久无码一级| 亚洲日韩中文无码久久| 久久99九九国产免费看小说| 久久精品无码一区二区三区日韩| 情人伊人久久综合亚洲| 国产欧美一区二区久久| 久久福利青草精品资源站免费|