• <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)  編輯 收藏 引用
            无码日韩人妻精品久久蜜桃| 国产精品99久久久久久宅男 | 久久精品国产精品亚洲毛片| 99久久人妻无码精品系列| 1000部精品久久久久久久久| 国产精品成人久久久久三级午夜电影| 婷婷久久综合九色综合九七| 久久青青草原亚洲av无码app| 国产精品免费看久久久香蕉 | 久久亚洲日韩精品一区二区三区| 久久综合综合久久97色| 狠狠精品久久久无码中文字幕| 国产精品久久久久久搜索| 一级做a爰片久久毛片毛片| 99精品久久久久中文字幕| 亚洲精品国产第一综合99久久| 国产精品18久久久久久vr| 久久人人添人人爽添人人片牛牛 | 国产精品久久久久久吹潮| 亚洲?V乱码久久精品蜜桃| 99久久精品国产一区二区| 色婷婷综合久久久久中文一区二区 | 欧美一级久久久久久久大| 老司机国内精品久久久久| 亚洲AV日韩精品久久久久| 亚洲精品无码久久久| 久久久综合香蕉尹人综合网| 亚洲一区中文字幕久久| 精品乱码久久久久久久| 777午夜精品久久av蜜臀| 综合久久一区二区三区| 一本色道久久88综合日韩精品 | 久久久久国产精品嫩草影院| 色婷婷狠狠久久综合五月| 国产精品99久久精品爆乳| 九九久久精品无码专区| 精品久久久久久无码人妻蜜桃| 国产激情久久久久影院小草| 国产精品亚洲美女久久久| 久久99精品国产麻豆不卡| 久久99亚洲综合精品首页|