• <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)  編輯 收藏 引用
            久久香综合精品久久伊人| 91久久成人免费| 国产成人无码精品久久久性色| 日韩欧美亚洲综合久久| 久久狠狠爱亚洲综合影院| 成人资源影音先锋久久资源网| 99久久无码一区人妻| 伊人久久大香线蕉精品不卡| 久久人人爽人人爽人人片AV不 | www.久久热| 国产精品欧美亚洲韩国日本久久| 亚洲精品WWW久久久久久 | 成人久久精品一区二区三区| 94久久国产乱子伦精品免费| 亚洲精品97久久中文字幕无码| 久久久亚洲欧洲日产国码二区| 狠狠人妻久久久久久综合蜜桃| 国内精品九九久久精品 | 97久久超碰国产精品旧版| 久久无码精品一区二区三区| 欧美无乱码久久久免费午夜一区二区三区中文字幕| 91精品国产91久久久久久蜜臀| 久久久久亚洲AV无码专区首JN | 久久综合综合久久综合| 国产A级毛片久久久精品毛片| 99久久综合国产精品免费| 久久国产精品久久| 亚洲熟妇无码另类久久久| 久久性生大片免费观看性| 久久久久久a亚洲欧洲aⅴ| 久久久久久亚洲Av无码精品专口 | 国内精品欧美久久精品| 久久66热人妻偷产精品9| 国产69精品久久久久APP下载| 久久精品国产精品亚洲艾草网美妙| 狠狠狠色丁香婷婷综合久久俺| 伊人色综合九久久天天蜜桃| 国产女人aaa级久久久级| 亚洲国产成人久久综合碰碰动漫3d | 久久综合五月丁香久久激情| 久久国产高清一区二区三区|