虽然看着std::allocator,我看到成员:
value_type
, pointer
, const_pointer
, reference
, const_reference
, size_type
, difference_type
和 rebind
都被弃用。为什么std :: allocator在C++ 17中失去成员类型/函数?
分配器也将不再有成员:
address
,max_size
,construct
,或destroy
。
为什么会发生这种情况?它是否与多态分配器有关?
第一组成员看起来像是真的对容器有意义,而不是分配器。我相信现在有一个'std :: addressof'来代替address()。无论如何,谁需要max_size;其余部分应该可以通过放置新的/显式的析构函数调用来替换。 –
现在还有一个['allocator_traits'](http://en.cppreference.com/w/cpp/memory/allocator_traits),可以填写缺失的部分。 –