根据当前标准(20.7.9),std::allocator
具有被设置为true_type
成员propagate_on_container_move_assignment
:为什么std :: allocator需要propagate_on_container_move_assignment为true?
模板类分配器
{
公共:
的typedef为size_t SIZE_TYPE;
typedef ptrdiff_t difference_type;
typedef T *指针;
typedef const T * const_pointer;
typedef T &参考;
typedef const T & const_reference;
typedef T value_type;
template struct rebind {typedef allocator other; };
typedef true_type propagate_on_container_move_assignment;
typedef true_type is_always_equal;
[...]
std::allocator
具有相比相等与任何其他std::allocator
没有数据成员和始终。是否有任何理由在移动分配时移动这些默认分配器?
这不是C++ 11。在C++之后添加了'is_always_equal' 14。 –