STL分配器和运算符new []

Fre*_*red 5 c++ stl new-operator allocator

是否存在operator new[]用作分配器的STL实现?在我的编译器上,Foo::operator new[]私有化并没有阻止我创建一个vector<Foo>......是什么行为保证了什么?

小智 4

C++ 标准,第 20.4.1.1 节。默认分配器 allocate() 函数使用全局运算符 new:

pointer allocate(size_type n, allocator<void>::const_pointerhint=0);

3 Notes: Uses ::operator new(size_t) (18.4.1).
Run Code Online (Sandbox Code Playgroud)