• <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 閱讀(543) 評論(0)  編輯 收藏 引用
            久久精品国产色蜜蜜麻豆| 久久久精品久久久久影院| 久久婷婷五月综合97色直播| 国产精自产拍久久久久久蜜 | 精品无码久久久久久午夜| 久久久精品2019免费观看| 一本一道久久精品综合| 伊人久久无码中文字幕| 国产日韩欧美久久| 麻豆精品久久久久久久99蜜桃| 久久99国产亚洲高清观看首页| 久久无码高潮喷水| 婷婷综合久久狠狠色99h| 日韩人妻无码精品久久免费一 | 久久99热国产这有精品| 婷婷国产天堂久久综合五月| 国产精品久久久久久搜索| 狠狠色婷婷久久综合频道日韩| 久久美女网站免费| 久久精品aⅴ无码中文字字幕不卡 久久精品aⅴ无码中文字字幕重口 | 久久精品一本到99热免费| 久久综合九色综合欧美就去吻| 国产午夜久久影院| 午夜精品久久久久久久| 久久精品一区二区三区AV| 国产精品成人久久久久久久| 久久久久无码精品国产不卡| | 成人a毛片久久免费播放| 麻豆成人久久精品二区三区免费| 久久93精品国产91久久综合| 久久精品无码一区二区三区免费| 精品人妻久久久久久888| 性高湖久久久久久久久| 精品久久久一二三区| 狠狠色丁香婷婷久久综合 | 欧美伊人久久大香线蕉综合69 | 污污内射久久一区二区欧美日韩| 精品久久久久久成人AV| 亚洲AV无码久久精品成人| 一本一本久久a久久综合精品蜜桃|