• <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++博客 :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              4 隨筆 :: 4 文章 :: 9 評(píng)論 :: 0 Trackbacks

            下面這段引文可對(duì)左值、右值加深理解。

            參考文獻(xiàn):《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 閱讀(551) 評(píng)論(0)  編輯 收藏 引用

            只有注冊(cè)用戶(hù)登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


            国产成人久久777777| 亚洲精品无码久久久久AV麻豆| 久久久久无码精品国产不卡| 久久精品蜜芽亚洲国产AV| 国产精品午夜久久| 久久99精品国产麻豆宅宅| 成人久久精品一区二区三区| 武侠古典久久婷婷狼人伊人| 久久99国产综合精品女同| 久久综合视频网站| 996久久国产精品线观看| 三级三级久久三级久久| 国产精品久久久天天影视香蕉| 久久精品青青草原伊人| 久久婷婷人人澡人人| 日本久久久久久中文字幕| 久久久久亚洲AV无码专区体验| 人妻系列无码专区久久五月天| 久久99国产精品久久99| 日韩精品久久久久久免费| 婷婷久久五月天| 日韩久久久久中文字幕人妻| 99精品久久久久久久婷婷| 国内精品久久久久久野外| 国产精品一久久香蕉国产线看观看| 亚洲精品tv久久久久| 亚洲人成网站999久久久综合 | 久久婷婷五月综合国产尤物app | 久久精品国产亚洲综合色| 日本人妻丰满熟妇久久久久久| 国产精品久久久香蕉| 久久综合色老色| 伊人色综合九久久天天蜜桃 | 久久精品卫校国产小美女| 国产精品中文久久久久久久| 精品久久国产一区二区三区香蕉| 久久精品嫩草影院| 久久人人爽人人爽AV片| 久久中文字幕视频、最近更新| 欧美久久久久久精选9999| 日本高清无卡码一区二区久久|