• <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 閱讀(544) 評論(0)  編輯 收藏 引用
            久久久久无码精品国产| 亚洲精品乱码久久久久久蜜桃图片| 久久午夜无码鲁丝片| 成人综合伊人五月婷久久| 国产激情久久久久影院小草| 久久久国产亚洲精品| 精品久久久久久久无码| 无码任你躁久久久久久久| 精品久久久久久久无码| 亚洲综合久久夜AV | 国产免费久久精品丫丫| 麻豆亚洲AV永久无码精品久久| 精品久久久久久无码人妻热| 人妻久久久一区二区三区| 午夜精品久久久久9999高清| 中文字幕亚洲综合久久| 久久无码人妻一区二区三区 | av国内精品久久久久影院| 久久久久久亚洲精品影院| 国产高潮国产高潮久久久91| 久久久久亚洲Av无码专| 精品久久久久成人码免费动漫| 亚洲伊人久久大香线蕉苏妲己| 久久国产精品成人片免费| 久久国产劲爆AV内射—百度| 日本五月天婷久久网站| 日本国产精品久久| 久久免费99精品国产自在现线| 四虎国产精品免费久久久| 91久久婷婷国产综合精品青草| 人妻少妇久久中文字幕| 久久精品aⅴ无码中文字字幕不卡 久久精品aⅴ无码中文字字幕重口 | 久久久精品久久久久久| 99久久精品这里只有精品 | 久久无码高潮喷水| 久久精品国产亚洲av麻豆蜜芽| 亚洲精品国精品久久99热| 精品国产日韩久久亚洲| 色综合久久久久久久久五月| 久久精品国产网红主播| 久久99毛片免费观看不卡|