• <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>
            Operator new allocates memory from the heap, on which an object is constructed. Standard C++ also supports placement new operator, which constructs an object on a pre-allocated buffer. This is useful when building a memory pool, a garbage collector or simply when performance and exception safety are paramount (there's no danger of allocation failure since the memory has already been allocated, and constructing an object on a pre-allocated buffer takes less time):
             void placement() {

            char *buf = new char[1000]; //pre-allocated buffer

            string *p = new (buf) string("hi"); //placement new

            string *q = new string("hi"); //ordinary heap allocation

            cout<
            <
            c_str()
            <
            <c_str();

            }

            placement new 表達式只是定位,不存在與其相對應的delete,如果delete則選擇
            delete[] buf。


            michalegao 2008-06-05 12:03 發表評論

            文章來源:http://www.cnblogs.com/michael-gao/archive/2008/06/05/1214239.html
            Posted on 2008-06-05 15:59 micheal's tech 閱讀(245) 評論(0)  編輯 收藏 引用 所屬分類: C++ programme language
            国产精品久久久久无码av| 久久99这里只有精品国产| 久久国产视屏| 无码精品久久久天天影视| 日韩精品久久久肉伦网站 | 99国产欧美久久久精品蜜芽| 91精品国产色综合久久| 国产精品热久久毛片| 久久精品青青草原伊人| 99久久99久久精品国产| 中文字幕热久久久久久久| 亚洲国产精品久久| 久久香综合精品久久伊人| 久久久久久亚洲精品不卡| 亚洲熟妇无码另类久久久| 久久免费视频一区| 久久99精品综合国产首页| 久久久www免费人成精品| 久久久久久噜噜精品免费直播| 伊人久久大香线蕉AV色婷婷色| 久久99精品免费一区二区| 久久国产精品无码一区二区三区| 久久亚洲电影| 99久久婷婷国产一区二区| 久久99热只有频精品8| 亚洲国产精品无码久久一线| 日韩欧美亚洲国产精品字幕久久久 | 中文字幕精品无码久久久久久3D日动漫| 思思久久99热免费精品6| 影音先锋女人AV鲁色资源网久久| 国产精品熟女福利久久AV| 久久超碰97人人做人人爱| 66精品综合久久久久久久| 久久这里只有精品视频99| 香蕉久久夜色精品国产小说| 久久香蕉一级毛片| 欧美精品国产综合久久| 久久青青草原精品国产| 精品久久久久久久久久久久久久久| 精品久久久一二三区| 久久国产色av免费看|