• <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)  編輯 收藏 引用
            久久精品国产清高在天天线| 久久午夜无码鲁丝片| 久久久久四虎国产精品| 亚洲午夜久久久精品影院| 一本久久免费视频| 少妇精品久久久一区二区三区| 久久国产免费观看精品| 亚洲?V乱码久久精品蜜桃| 久久久无码人妻精品无码| 亚洲第一永久AV网站久久精品男人的天堂AV| 久久久这里有精品| 日韩精品久久久久久| 色88久久久久高潮综合影院 | 久久久久亚洲av成人无码电影| 久久久久国产| 996久久国产精品线观看| 日日狠狠久久偷偷色综合96蜜桃| 久久ZYZ资源站无码中文动漫| 婷婷久久综合| 久久99国产一区二区三区| 91精品国产高清91久久久久久| 无码人妻久久一区二区三区蜜桃| 国产成年无码久久久久毛片| av色综合久久天堂av色综合在| 久久99精品久久久久久秒播| 久久精品国产亚洲沈樵| 欧美噜噜久久久XXX| 国产精品中文久久久久久久 | 麻豆久久久9性大片| 久久久精品久久久久久| 91亚洲国产成人久久精品| 久久不射电影网| 久久91精品国产91久久麻豆| 成人国内精品久久久久一区| 亚洲精品乱码久久久久久蜜桃图片| 亚洲精品乱码久久久久久蜜桃 | 蜜臀av性久久久久蜜臀aⅴ麻豆| 久久久久久精品无码人妻| 中文国产成人精品久久亚洲精品AⅤ无码精品 | 国产精品免费久久久久久久久| 亚洲精品国产成人99久久|