【发布时间】:2019-12-04 09:03:34
【问题描述】:
读了link之后,我知道placement new太难用了。然后我找到了std::allocator,所以我认为std::allocator应该使用placement new,因为它可以分开分配并分两步进行构造。
但是,How are allocator in C++ implemented? 似乎告诉我std::allocator 是由operator new 实现的,而不是placement new。我现在很困惑。如果它不使用placement new,它怎么能分开分配和两步构建?
【问题讨论】:
标签: c++ new-operator allocator placement-new