different meanings of new and delete.(More Effective C++)

Though you want to create an object on the heap, use the new operator. It both allocates memory and calls a constructor for the object. If you only want to allocate memory, call operator new; no constructor will be called. If you want to customize the memory allocation that takes place when heap objects are created, write your own version of operator new and use the new operator; it will automatically invoke your custom version of operator new. If you want to construct an object in memory you've already got a pointer to, use placement new.

原文链接: https://www.cnblogs.com/zhtf2014/archive/2011/06/13/2079853.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    different meanings of new and delete.(More Effective C++)

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/27169

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月8日 上午4:44
下一篇 2023年2月8日 上午4:44

相关推荐