标签: c++ allocator
我对分配器有疑问。所以allocator_traits提供了函数destroy和deallocate。是否安全调用std::allocator_traits<>::destroy(a,p)然后std::allocator_traits<>::deallocate(a,p,1)假设a是std::allocator而p是指向已分配内存的指针?我担心的是,std::allocator.deallocate()是通过delete实现的,它实际上会两次调用析构函数吗?
destroy
deallocate
std::allocator_traits<>::destroy(a,p)
std::allocator_traits<>::deallocate(a,p,1)
a
std::allocator
p
std::allocator.deallocate()
delete