• <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 閱讀(539) 評(píng)論(0)  編輯 收藏 引用

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


            久久久久久久久久免免费精品| 久久久久国色AV免费观看| 性做久久久久久免费观看| 精品久久久一二三区| 亚洲熟妇无码另类久久久| 国产精品美女久久久| 国产高潮国产高潮久久久91| 亚洲国产综合久久天堂| 97久久超碰国产精品旧版| 久久久亚洲精品蜜桃臀| 91精品国产高清久久久久久io | 久久精品a亚洲国产v高清不卡| 人妻少妇久久中文字幕一区二区 | 一本色道久久88加勒比—综合| 久久五月精品中文字幕| 精品熟女少妇av免费久久| 久久精品?ⅴ无码中文字幕| 久久久久人妻一区二区三区vr| 久久精品国产一区二区三区| 蜜臀av性久久久久蜜臀aⅴ| 无码乱码观看精品久久| 精品久久久久久亚洲| 麻豆成人久久精品二区三区免费| 久久激情五月丁香伊人| 久久国产亚洲精品麻豆| avtt天堂网久久精品| 一本色道久久88—综合亚洲精品| 久久99久久成人免费播放| 久久91精品国产91久久户| 国产精品禁18久久久夂久| 亚洲国产欧美国产综合久久| 亚洲精品成人网久久久久久| 99久久99久久精品国产片| 国产精品久久久久久福利漫画| 久久综合给合久久狠狠狠97色69| 2021国内久久精品| 久久久国产打桩机| 亚洲国产精品无码久久98| 午夜精品久久久久久中宇| 精品久久亚洲中文无码| 国产成人精品久久|