23 Containers library [containers]

23.3 Sequence containers [sequences]

23.3.6 Class template vector [vector]

23.3.6.2 vector constructors, copy, and assignment [vector.cons]

explicit vector(const Allocator& = Allocator());

Effects: Constructs an empty vector, using the specified allocator.

Complexity: Constant.

explicit vector(size_type n);

Effects: Constructs a vector with n value-initialized elements.

Requires: T shall be DefaultConstructible.

Complexity: Linear in n.

vector(size_type n, const T& value, const Allocator& = Allocator());

Effects: Constructs a vector with n copies of value, using the specified allocator.

Requires: T shall be CopyInsertable into *this.

Complexity: Linear in n.

template <class InputIterator> vector(InputIterator first, InputIterator last, const Allocator& = Allocator());

Effects: Constructs a vector equal to the range [first,last), using the specified allocator.

Complexity: Makes only N calls to the copy constructor of T (where N is the distance between first and last) and no reallocations if iterators first and last are of forward, bidirectional, or random access categories. It makes order N calls to the copy constructor of T and order log(N) reallocations if they are just input iterators.

template <class InputIterator> void assign(InputIterator first, InputIterator last);

Effects:

erase(begin(), end());
insert(begin(), first, last);

void assign(size_type n, const T& t);

Effects:

erase(begin(), end());
insert(begin(), n, t);