std::vector::shrink_to_fit

void shrink_to_fit(); (since C++11) Requests the removal of unused capacity. It is a non-binding request to reduce capacity() to size(). It depends on the implementation if the request is fulfilled. All iterators, including the past the end iterator, are potentially invalidated. Parameters (none). Type requirements - T must meet the requirements of MoveInsertable. Return value (none). Complexity At most linear in the size of the container. Notes If an exception is throw

std::vector::resize

void resize( size_type count, T value = T() ); (until C++11) void resize( size_type count ); (1) (since C++11) void resize( size_type count, const value_type& value ); (2) (since C++11) Resizes the container to contain count elements. If the current size is greater than count, the container is reduced to its first count elements. If the current size is less than count, additional elements are appended and initialized with copies of value. (until C++11) If the current

std::vector::pop_back

void pop_back(); Removes the last element of the container. Calling pop_back on an empty container is undefined. No iterators or references except for back() and end() are invalidated. Parameters (none). Return value (none). Complexity Constant. Exceptions (none). See also push_back adds an element to the end (public member function)

std::vector::reserve

void reserve( size_type new_cap ); Increase the capacity of the container to a value that's greater or equal to new_cap. If new_cap is greater than the current capacity(), new storage is allocated, otherwise the method does nothing. If new_cap is greater than capacity(), all iterators and references, including the past-the-end iterator, are invalidated. Otherwise, no iterators or references are invalidated. Parameters new_cap - new capacity of the container Type requirements

std::vector::rbegin

reverse_iterator rbegin(); const_reverse_iterator rbegin() const; const_reverse_iterator crbegin() const; (since C++11) Returns a reverse iterator to the first element of the reversed container. It corresponds to the last element of the non-reversed container. Parameters (none). Return value Reverse iterator to the first element. Exceptions (none) (until C++11) noexcept specification: noexcept (since C++11) Complexity Constant. See also rend crend r

std::vector::push_back

void push_back( const T& value ); (1) void push_back( T&& value ); (2) (since C++11) Appends the given element value to the end of the container. 1) The new element is initialized as a copy of value. 2) value is moved into the new element. If the new size() is greater than capacity() then all iterators and references (including the past-the-end iterator) are invalidated. Otherwise only the past-the-end iterator is invalidated. Parameters value - the value of

std::vector::rend

reverse_iterator rend(); const_reverse_iterator rend() const; const_reverse_iterator crend() const; (since C++11) Returns a reverse iterator to the element following the last element of the reversed container. It corresponds to the element preceding the first element of the non-reversed container. This element acts as a placeholder, attempting to access it results in undefined behavior. Parameters (none). Return value Reverse iterator to the element following the last

std::vector::get_allocator

allocator_type get_allocator() const; Returns the allocator associated with the container. Parameters (none). Return value The associated allocator. Complexity Constant.

std::vector::operator[]

reference operator[]( size_type pos ); const_reference operator[]( size_type pos ) const; Returns a reference to the element at specified location pos. No bounds checking is performed. Parameters pos - position of the element to return Return value Reference to the requested element. Complexity Constant. Notes Unlike std::map::operator[], this operator never inserts a new element into the container. Example The following code uses operator[] to read f

std::vector::front

reference front(); const_reference front() const; Returns a reference to the first element in the container. Calling front on an empty container is undefined. Parameters (none). Return value reference to the first element. Complexity Constant. Notes For a container c, the expression c.front() is equivalent to *c.begin(). Example The following code uses front to display the first element of a std::vector<char>: #include <vector> #include <iostream>