定位new表达式

来源:互联网 发布:ug for mac 编辑:程序博客网 时间:2024/04/29 05:19

定位new表达式使我们能在特定的、已分配的内存位置构造对象,它接受指向已分配内存但未构造内存的指针,并在该指针位置构造一个对象。(他是allocator中的construct成员函数的低级选择)

new  (place_address) type

new (place_address) type (initial_list)

其中place_address 为一个指针,intial_list为提供的初始化列表


显式析构函数是allocator类中destory成员函数的低级选择,他的效果是显式地清除对象本事,并没有释放对象占有的内存

原创粉丝点击