std::allocator

1
template< class T > struct allocator;

std::allocator本质上就是 new/delete, 但是为什么需要它呢?

  • 分离 allocation 和 construction(或者分离 deallocation 和 destruction)
  • 主要的使用场景就是在实现container时

参考