• <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 閱讀(543) 評論(0)  編輯 收藏 引用
            久久国产热这里只有精品| 久久香蕉国产线看观看猫咪?v| 国产成人综合久久精品红| 中文字幕无码av激情不卡久久| 日韩十八禁一区二区久久| 国内高清久久久久久| 成人资源影音先锋久久资源网| 香蕉久久夜色精品国产小说| 亚洲国产综合久久天堂 | 久久精品成人欧美大片| 国产精品久久久久久搜索| 狠狠久久综合| 亚洲精品乱码久久久久久自慰 | 久久精品草草草| 一本一道久久a久久精品综合 | 国产999精品久久久久久| 亚洲国产日韩综合久久精品| 久久99精品国产99久久| 亚洲国产精品无码久久| 亚洲精品美女久久久久99小说 | 国内精品九九久久久精品| 理论片午午伦夜理片久久| 免费观看久久精彩视频| 亚洲第一极品精品无码久久| 亚洲国产精品成人AV无码久久综合影院 | 久久久国产打桩机| 久久人人爽人人爽AV片| 久久婷婷国产麻豆91天堂| 色欲久久久天天天综合网精品| 一本色道久久88综合日韩精品| 久久久久久久久久久免费精品 | 精品99久久aaa一级毛片| 蜜臀av性久久久久蜜臀aⅴ麻豆| 女人高潮久久久叫人喷水| 久久精品国产亚洲7777| 久久精品国产一区二区电影| 久久播电影网| 亚洲精品美女久久久久99小说| 日产久久强奸免费的看| 久久免费大片| 亚洲va中文字幕无码久久不卡|