• <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 閱讀(538) 評論(0)  編輯 收藏 引用
            国产精品女同一区二区久久| 久久精品国产第一区二区| 99蜜桃臀久久久欧美精品网站| 99久久国产综合精品麻豆| 久久久久无码专区亚洲av| 伊人久久大香线蕉成人| 久久精品视屏| 亚洲色婷婷综合久久| 久久精品二区| 久久av无码专区亚洲av桃花岛| 国产精品免费看久久久| 久久久久久极精品久久久| 久久国产乱子伦免费精品| 欧美久久天天综合香蕉伊| 波多野结衣中文字幕久久| 99久久精品免费看国产一区二区三区 | 天天爽天天狠久久久综合麻豆| 亚洲v国产v天堂a无码久久| 久久精品人人做人人爽电影| 中文成人无码精品久久久不卡 | 久久国产精品国产自线拍免费| 精品久久久久久无码中文字幕一区| 久久亚洲2019中文字幕| 97精品伊人久久久大香线蕉| 久久精品国产99久久久古代| 嫩草影院久久国产精品| 岛国搬运www久久| 97久久超碰国产精品旧版| 伊人久久大香线蕉综合影院首页| 久久国产乱子伦精品免费午夜| 久久精品中文无码资源站| 乱亲女H秽乱长久久久| 久久这里只精品国产99热| 精品综合久久久久久888蜜芽| 久久精品国产免费观看| 亚洲人成无码久久电影网站| 亚洲国产成人精品女人久久久| 热久久这里只有精品| 久久国产香蕉视频| 亚洲欧美精品一区久久中文字幕| 久久久久亚洲AV无码专区桃色|