• <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)  編輯 收藏 引用
            狠狠色婷婷久久综合频道日韩| 人妻少妇久久中文字幕一区二区| 国产精品内射久久久久欢欢| 国产精品午夜久久| 久久99精品久久久久久| 亚洲欧美日韩中文久久| 久久噜噜电影你懂的| 久久这里只有精品视频99| 久久综合狠狠综合久久综合88 | 久久精品无码一区二区三区| 狠狠色综合网站久久久久久久| 欧美精品九九99久久在观看| 国产人久久人人人人爽| 国产精品久久久久a影院| 天天爽天天爽天天片a久久网| 波多野结衣久久| 久久久久国色AV免费观看 | 一本一道久久精品综合| 久久亚洲AV无码精品色午夜麻豆| 久久精品国产亚洲综合色| 伊人久久大香线蕉综合影院首页| 夜夜亚洲天天久久| 国产午夜免费高清久久影院| 99久久香蕉国产线看观香| 久久青青草原精品国产软件| 国产精品99久久久久久www| 国内精品伊人久久久久av一坑 | 国产精品无码久久综合| 色欲综合久久中文字幕网| 欧美久久久久久午夜精品| 国产L精品国产亚洲区久久| 99国产欧美久久久精品蜜芽| 日产精品99久久久久久| 99精品久久久久久久婷婷| 精品综合久久久久久98| 伊人热热久久原色播放www | 国内精品久久久久伊人av| 久久超碰97人人做人人爱| 97久久精品无码一区二区| 国产精品久久久久9999| 岛国搬运www久久|