• <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)  編輯 收藏 引用
            久久噜噜电影你懂的| 久久精品国产欧美日韩| 久久久精品人妻一区二区三区蜜桃 | 国产成人精品久久一区二区三区| 东京热TOKYO综合久久精品| 91精品婷婷国产综合久久| 一本久久综合亚洲鲁鲁五月天| 日韩乱码人妻无码中文字幕久久| 久久免费小视频| 久久人与动人物a级毛片| 色综合久久最新中文字幕| 伊人情人综合成人久久网小说| 久久国产精品99精品国产| 中文字幕无码久久久| 国产毛片久久久久久国产毛片 | 久久精品国产99久久久香蕉| 中文字幕乱码人妻无码久久| 久久WWW免费人成—看片| 精品久久久久久国产潘金莲| 久久综合鬼色88久久精品综合自在自线噜噜 | 久久精品国产久精国产| 三上悠亚久久精品| 久久国内免费视频| 热RE99久久精品国产66热| 99久久精品国产一区二区三区| 久久久久久亚洲AV无码专区| 欧美伊人久久大香线蕉综合| 久久久久18| 久久综合成人网| 久久久99精品成人片中文字幕| 99精品国产在热久久| 国产精品美女久久久m| 久久99精品国产自在现线小黄鸭| 伊人色综合九久久天天蜜桃| 久久精品女人天堂AV麻| 久久久艹| 思思久久精品在热线热| 狠狠色婷婷久久一区二区| 久久人人爽人人爽人人av东京热| 久久精品亚洲男人的天堂| 久久久久亚洲AV成人网人人软件|