Unless otherwise specified, all containers defined in this Clause obtain memory
using an allocator (see [allocator.requirements]
In particular, containers and iterators do not store references
to allocated elements other than through the allocator's pointer type,
i.e., as objects of type P
— end note
Copy constructors for these container types obtain an allocator by calling
on the allocator belonging to the container being copied.
Move constructors obtain an allocator by move construction from the allocator belonging to
the container being moved.
Such move construction of the allocator shall not exit via an
All other constructors for these container types take a
If an invocation of a constructor uses the default value of an optional
allocator argument, then the allocator type must support value-initialization.
— end note
A copy of this allocator is used for any memory allocation and element construction
performed, by these constructors and by all member functions,
during the lifetime of each container object
or until the allocator is replaced.
The allocator may be replaced only via assignment or
Allocator replacement is performed by
copy assignment, move assignment, or swapping of the allocator only if
within the implementation of the corresponding container operation.
In all container types defined in this Clause, the member get_allocator()
returns a copy of the allocator used to construct the container or, if that allocator
has been replaced, a copy of the most recent replacement.