I am trying to study allocators, but I do not understand at all the uses of some allocator's aliases. In particular, I have already read in cppreference the consequences of the propagate_on_container_copy_assignment
and propagate_on_container_move_assignment
aliases on container's assignment operations:
propagate_on_container_copy_assignment
If (this member is derived from std::true_type
and) the allocators of the source and the target containers do not compare equal, copy assignment has to deallocate the target's memory using the old allocator and then allocate it using the new allocator before copying the elements (and the allocator).
propagate_on_container_move_assignment
If this member is not provided or derived from std::false_type
and the allocators of the source and the target containers do not compare equal, move assignment cannot take ownership of the source memory and must move-assign or move-construct the elements individually, resizing its own memory as needed.
This is the theory, but I do not understand which are the practical advantages that are provided.
In general, which are the reasons therefore the designer of a custom allocator should mark one or the other alias as true or false?