std::vector::max_size

size_type max_size() const; Returns the maximum number of elements the container is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end()) for the largest container. Parameters (none). Return value Maximum number of elements. Exceptions (none) (until C++11) noexcept specification: noexcept (since C++11) Complexity Constant. Notes This value is typically equal to std::numeric_limits<size_type>::max(), and reflects the

std::vector::insert

(1) iterator insert( iterator pos, const T& value ); (until C++11) iterator insert( const_iterator pos, const T& value ); (since C++11) iterator insert( const_iterator pos, T&& value ); (2) (since C++11) (3) void insert( iterator pos, size_type count, const T& value ); (until C++11) iterator insert( const_iterator pos, size_type count, const T& value ); (since C++11) (4) template< class InputIt > void insert( iterator pos, InputIt f

std::vector::emplace

template< class... Args > iterator emplace( const_iterator pos, Args&&... args ); (since C++11) Inserts a new element into the container directly before pos. The element is constructed through std::allocator_traits::construct, which typically uses placement-new to construct the element in-place at a location provided by the container. The arguments args... are forwarded to the constructor as std::forward<Args>(args).... If the new size() is greater than capacity(),

std::vector::erase

(1) iterator erase( iterator pos ); (until C++11) iterator erase( const_iterator pos ); (since C++11) (2) iterator erase( iterator first, iterator last ); (until C++11) iterator erase( const_iterator first, const_iterator last ); (since C++11) Removes specified elements from the container. 1) Removes the element at pos. 2) Removes the elements in the range [first; last). Invalidates iterators and references at or after the point of the erase, including the end() iter

std::vector::empty

bool empty() const; Checks if the container has no elements, i.e. whether begin() == end(). Parameters (none). Return value true if the container is empty, false otherwise. Exceptions (none) (until C++11) noexcept specification: noexcept (since C++11) Complexity Constant. Example The following code uses empty to check if a std::vector<int> contains any elements: #include <vector> #include <iostream> int main() { std::vector<int> numbers;

std::vector::emplace_back

template< class... Args > void emplace_back( Args&&... args ); (since C++11) Appends a new element to the end of the container. The element is constructed through std::allocator_traits::construct, which typically uses placement-new to construct the element in-place at the location provided by the container. The arguments args... are forwarded to the constructor as std::forward<Args>(args).... If the new size() is greater than capacity() then all iterators and referen

std::vector::end

iterator end(); const_iterator end() const; const_iterator cend() const; (since C++11) Returns an iterator to the element following the last element of the container. This element acts as a placeholder; attempting to access it results in undefined behavior. Parameters (none). Return value Iterator to the element following the last element. Exceptions (none) (until C++11) noexcept specification: noexcept (since C++11) Complexity Constant. See also begin

std::vector::data

T* data(); (since C++11) const T* data() const; (since C++11) Returns pointer to the underlying array serving as element storage. The pointer is such that range [data(); data() + size()) is always a valid range, even if the container is empty. Parameters (none). Return value Pointer to the underlying element storage. For non-empty containers, returns &front(). Complexity Constant. Exceptions noexcept specification: noexcept See also front access the first

std::vector::assign

void assign( size_type count, const T& value ); (1) template< class InputIt > void assign( InputIt first, InputIt last ); (2) void assign( std::initializer_list<T> ilist ); (3) (since C++11) Replaces the contents of the container. 1) Replaces the contents with count copies of value value 2) Replaces the contents with copies of those in the range [first, last). This overload has the same effect as overload (1) if InputIt is an integral type. (until C++11) T

std::vector::begin

iterator begin(); const_iterator begin() const; const_iterator cbegin() const; (since C++11) Returns an iterator to the first element of the container. If the container is empty, the returned iterator will be equal to end(). Parameters (none). Return value Iterator to the first element. Exceptions (none) (until C++11) noexcept specification: noexcept (since C++11) Complexity Constant. Example See also end cend returns an iterator to the end (publ