为什么 std:allocator 的成员函数不是静态的

Edm*_*und 5 c++ stl

std::allocator无国籍的。换句话说,由a1.allocate()(a1是 的一个实例std::allocator)分配的内存可以由a2.deallocate()(a2是 的另一个实例std::allocator)释放。

为什么它们不是静态成员函数?

(2014 年 10 月 17 日编辑:)

好的,感谢 luk32。由于 C++11 自定义allocator可以有状态,这可能是为什么std::allocator有那些非静态成员函数的原因。