- (1) empty container constructor (default constructor)
- Constructs an empty container, with no elements.
- (2) 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.
- (3) copy constructor
- Constructs a container with a copy of each of the elements in x.
The container keeps an internal copy of
alloc and
comp, which are used to allocate storage and to sort the elements throughout its lifetime.
The copy constructor
(3) creates a container that keeps and uses copies of
x's
allocator and
comparison object.
The storage for the elements is allocated using this
internal allocator.
The elements are sorted according to the
comparison object.
- (1) empty container constructors (default constructor)
- Constructs an empty container, with no elements.
- (2) 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.
- (3) copy constructor (and copying with allocator)
- Constructs a container with a copy of each of the elements in x.
- (4) 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.
- (5) initializer list constructor
- Constructs a container with a copy of each of the elements in il.
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
(3, 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
(4, first signature) acquires
x's allocator.
The container also keeps an internal copy of
comp (or
x's
comparison object), which is used to establish the order of the elements in the container and to check for equivalent elements.
All elements are
copied,
moved or otherwise
constructed by calling
allocator_traits::construct with the appropriate arguments.
The elements are sorted according to the
comparison object. If elements that are equivalent are passed to the constructor, their relative order is preserved.