c++ - 我们可以在内存中的指定位置创建类类型的实例吗?

标签 c++

<分区>

Possible Duplicate:
C++'s “placement new”

我们能否在内存中的指定位置创建类类型的实例?如果可以,那么我们应该如何以及在何处使用此类编程技术?

最佳答案

是的,我们可以。使用 new(area) operator .

Another discussion at SO .

关于c++ - 我们可以在内存中的指定位置创建类类型的实例吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6241590/

相关文章:

c++ - 嵌套的 cmake 库

c++ - 无法将单指针转换为双指针

c++ - 有什么简单的方法可以在 if-else 链的末尾执行与 else 相反的操作吗?

c++ - C标准: Character set and string encoding specification

c++ - 是否有生产者消费者以外的设计模式来描述这种模式?

c++ - 在 C++ 中是否可以有可变数量的字符串数组?

C# P/调用 : native output parameter value won't reach managed code

c++ - 使用 std::chrono::time_point 隐式删除特殊函数

c++ - 使用 this 指针初始化列表

c++ - 如何在 VS2008 64 位版本中用 intristic 替换 __asm jno no_oflow?