To my understanding, a Container should have an Allocator member data, which is used internally.
Question: what happens, for example, when we swap() two containers that use different allocators?
Must the allocators be swapped as well?
Must all elements of the container be reallocated when the allocator is changed?
I assume that if the allocator is replaced, then the elements must be destroyed, deallocated and then allocated and constructed all over again.
Is this correct?
Also, regarding this:
cppreference wiki wrote:
Swap will replace the allocator only if std::allocator_traits<allocator_type>::propagate_on_container_swap::value is true. Specifically, it will exchange the allocator instances through an unqualified call to the non-member function swap, see Swappable.
Don't worry too much about this. One can be a very competent C++ programmer without ever knowing the gory details about the implementation of strictly conforming allocators and allocator aware containers.