小编glo*_*and的帖子

将原始运营商new,placement new和standard delete合并是否合法?

伙计们!出于好奇 - 以下代码可能不合法,是吗?

T *p = ::operator new(sizeof(T)); // allocate memory for a T
new (p) T; // construct a T into the allocated memory
delete p; //delete the object using the standard delete operator
Run Code Online (Sandbox Code Playgroud)

c++ memory-management new-operator

5
推荐指数
1
解决办法
301
查看次数

标签 统计

c++ ×1

memory-management ×1

new-operator ×1