• <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)  編輯 收藏 引用
            av午夜福利一片免费看久久| 精品久久久噜噜噜久久久| 久久久久亚洲AV成人网| 久久久久国产一区二区三区| 久久久久人妻精品一区三寸蜜桃| 香蕉aa三级久久毛片| 久久影院综合精品| 国产亚洲成人久久| 亚洲欧美伊人久久综合一区二区 | 色综合久久夜色精品国产| 婷婷五月深深久久精品| 久久久久成人精品无码 | 91久久国产视频| 精品久久久无码21p发布| 国产日韩欧美久久| 人妻精品久久久久中文字幕69 | 久久久久亚洲av成人无码电影| 午夜天堂精品久久久久| 久久精品国产一区二区三区不卡 | 亚洲日本久久久午夜精品| 国产精品一区二区久久精品| 久久99久久99精品免视看动漫| 99久久国产综合精品五月天喷水| 亚洲AV无码久久寂寞少妇| 亚洲欧美国产精品专区久久 | 久久久WWW成人免费精品| AV狠狠色丁香婷婷综合久久| 国产色综合久久无码有码| 一本色综合久久| 久久亚洲精品国产亚洲老地址 | 尹人香蕉久久99天天拍| 国产AV影片久久久久久| 国产精品久久国产精品99盘| 少妇精品久久久一区二区三区 | 国产精品久久久久久久| 亚洲中文久久精品无码| 亚洲人成无码久久电影网站| 久久久久久久综合综合狠狠| 国产午夜精品久久久久九九电影| 久久se精品一区二区| 国产高潮国产高潮久久久91 |