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

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

            參考文獻(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 閱讀(543) 評論(0)  編輯 收藏 引用

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


            精品久久久久久久中文字幕| 国产69精品久久久久9999APGF| av国内精品久久久久影院| 久久国产色AV免费看| 91久久精品电影| 欧美无乱码久久久免费午夜一区二区三区中文字幕 | 亚洲国产综合久久天堂| 久久久无码精品亚洲日韩京东传媒| 色欲久久久天天天综合网| 国产福利电影一区二区三区久久久久成人精品综合 | 亚洲日韩欧美一区久久久久我| 久久无码中文字幕东京热 | 韩国三级中文字幕hd久久精品| 久久久国产亚洲精品| 91精品国产高清久久久久久91| 亚洲精品午夜国产va久久| 亚洲国产成人久久精品影视| 奇米影视7777久久精品人人爽| 久久综合九色综合欧美狠狠| 精品国产99久久久久久麻豆| 国产999精品久久久久久| 久久国产精品99国产精| 亚洲国产成人久久一区WWW| 99久久精品日本一区二区免费| 久久国内免费视频| 青青久久精品国产免费看| 国产午夜精品久久久久九九| 99久久久国产精品免费无卡顿| 99久久精品国产一区二区| 人妻系列无码专区久久五月天| 草草久久久无码国产专区| 人人狠狠综合久久亚洲88| 日韩精品久久无码中文字幕| 日韩精品久久久久久久电影| 亚洲欧美久久久久9999| 国产一区二区久久久| 久久精品国产亚洲AV忘忧草18 | 影音先锋女人AV鲁色资源网久久 | 97精品依人久久久大香线蕉97| 色播久久人人爽人人爽人人片aV | 日韩精品久久无码中文字幕|