- (1) empty container constructor (default constructor)
- Constructs an empty container, with no elements.
- (2) fill constructor
- Constructs a container with n elements. Each element is a copy of val.
- (3) range constructor
- Constructs a container with as many elements as the range [first,last), with each element constructed from its corresponding element in that range, in the same order.
- (4) copy constructor
- Constructs a container with a copy of each of the elements in x, in the same order.
The container keeps an internal copy of
alloc, which is used to allocate storage throughout its lifetime.
The copy constructor
(4) creates a container that keeps and uses a copy of
x's allocator.
The storage for the elements is allocated using this
internal allocator.
- (1) empty container constructor (default constructor)
- Constructs an empty container, with no elements.
- (2) fill constructor
- Constructs a container with n elements. Each element is a copy of val (if provided).
- (3) range constructor
- Constructs a container with as many elements as the range [first,last), with each element emplace-constructed from its corresponding element in that range, in the same order.
- (4) copy constructor (and copying with allocator)
- Constructs a container with a copy of each of the elements in x, in the same order.
- (5) move constructor (and moving with allocator)
- Constructs a container that acquires the elements of x.
If alloc is specified and is different from x's allocator, the elements are moved. Otherwise, no elements are constructed (their ownership is directly transferred).
x is left in an unspecified but valid state.
- (6) initializer list constructor
- Constructs a container with a copy of each of the elements in il, in the same order.
The container keeps an internal copy of
alloc, which is used to allocate and deallocate storage for its elements, and to construct and destroy them (as specified by its
allocator_traits). If no
alloc argument is passed to the constructor, a default-constructed allocator is used, except in the following cases:
- The copy constructor
(4, first signature) creates a container that keeps and uses a copy of the allocator returned by calling the appropriate
selected_on_container_copy_construction trait on
x's allocator.
- The move constructor
(5, first signature) acquires
x's allocator.
All elements are
copied,
moved or otherwise
constructed by calling
allocator_traits::construct with the appropriate arguments.