根據當前標準(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。 –