• <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)  編輯 收藏 引用
            久久精品www人人爽人人| 99久久做夜夜爱天天做精品| 久久久久久亚洲AV无码专区| 久久国产免费观看精品3| 国产精品久久久久乳精品爆| 久久人妻少妇嫩草AV蜜桃| 精品一二三区久久aaa片| 青青草国产成人久久91网| 久久人人爽人人爽人人爽| 久久超碰97人人做人人爱| 久久人人爽人人爽人人片AV麻豆 | 精品伊人久久大线蕉色首页| 国内精品久久久久久99| 亚洲国产成人久久综合野外| 韩国免费A级毛片久久| 久久久久久久综合狠狠综合| 久久99久久99小草精品免视看| 一本久久综合亚洲鲁鲁五月天亚洲欧美一区二区 | 久久久久国产亚洲AV麻豆| 久久久久国产精品熟女影院 | 亚洲精品乱码久久久久久按摩 | 波多野结衣久久精品| 99热成人精品免费久久| 国产成人久久精品一区二区三区 | 97超级碰碰碰碰久久久久| 亚洲精品乱码久久久久久久久久久久 | 日韩影院久久| 夜夜亚洲天天久久| 99精品国产在热久久| 久久久久亚洲AV无码专区首JN | 国产日产久久高清欧美一区| 亚洲AV无码成人网站久久精品大| 一97日本道伊人久久综合影院| 国产视频久久| 精品无码久久久久久久久久| 伊人久久综在合线亚洲2019| 久久精品一区二区三区不卡| 国产精品9999久久久久| 成人国内精品久久久久影院| 久久99热狠狠色精品一区| 2020久久精品国产免费|