template<typename_Tp,typename_Alloc=std::allocator<_Tp>>template<typename_ForwardIterator>constexprpointerstd::vector<_Tp,_Alloc>::_M_allocate_and_copy(size_type__n,_ForwardIterator__first,_ForwardIterator__last)[inline],[constexpr],[protected]
Memory expansion handler. Uses the member allocation function to obtain n bytes of memory, and then
copies [first,last) into it.
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprvoidstd::vector<_Tp,_Alloc>::_M_range_check(size_type__n)const[inline],[constexpr],[protected]
Safety check used only from at().
References std::vector<_Tp,_Alloc>::size().
Referenced by std::vector<_Tp,_Alloc>::at(), and std::vector<_Tp,_Alloc>::at().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>template<typename_InputIterator,typename=std::_RequireInputIter<_InputIterator>>constexprvoidstd::vector<_Tp,_Alloc>::assign(_InputIterator__first,_InputIterator__last)[inline],[constexpr]
Assigns a range to a vector.
Parameters__first An input iterator.
__last An input iterator.
This function fills a vector with copies of the elements in the range [__first,__last).
Note that the assignment completely changes the vector and that the resulting vector's size is the same
as the number of elements assigned.
References std::__iterator_category().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprvoidstd::vector<_Tp,_Alloc>::assign(initializer_list<value_type>__l)[inline],[constexpr]
Assigns an initializer list to a vector.
Parameters__l An initializer_list.
This function fills a vector with copies of the elements in the initializer list __l.
Note that the assignment completely changes the vector and that the resulting vector's size is the same
as the number of elements assigned.
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprvoidstd::vector<_Tp,_Alloc>::assign(size_type__n,constvalue_type&__val)[inline],[constexpr]
Assigns a given value to a vector.
Parameters__n Number of elements to be assigned.
__val Value to be assigned.
This function fills a vector with __n copies of the given value. Note that the assignment completely
changes the vector and that the resulting vector's size is the same as the number of elements assigned.
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprreferencestd::vector<_Tp,_Alloc>::at(size_type__n)[inline],[constexpr]
Provides access to the data contained in the vector.
Parameters__n The index of the element for which data should be accessed.
Returns
Read/write reference to data.
Exceptionsstd::out_of_range If __n is an invalid index.
This function provides for safer data access. The parameter is first checked that it is in the range of
the vector. The function throws out_of_range if the check fails.
References std::vector<_Tp,_Alloc>::_M_range_check().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprconst_referencestd::vector<_Tp,_Alloc>::at(size_type__n)const[inline],[constexpr]
Provides access to the data contained in the vector.
Parameters__n The index of the element for which data should be accessed.
Returns
Read-only (constant) reference to data.
Exceptionsstd::out_of_range If __n is an invalid index.
This function provides for safer data access. The parameter is first checked that it is in the range of
the vector. The function throws out_of_range if the check fails.
References std::vector<_Tp,_Alloc>::_M_range_check().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprconst_referencestd::vector<_Tp,_Alloc>::back()const[inline],[constexpr],[noexcept]
Returns a read-only (constant) reference to the data at the last element of the vector.
References std::vector<_Tp,_Alloc>::end().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprreferencestd::vector<_Tp,_Alloc>::back()[inline],[constexpr],[noexcept]
Returns a read/write reference to the data at the last element of the vector.
References std::vector<_Tp,_Alloc>::end().
Referenced by std::piecewise_constant_distribution<_RealType>::max(), and
std::piecewise_linear_distribution<_RealType>::max().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprconst_iteratorstd::vector<_Tp,_Alloc>::begin()const[inline],[constexpr],[noexcept]
Returns a read-only (constant) iterator that points to the first element in the vector. Iteration is done
in ordinary element order.
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexpriteratorstd::vector<_Tp,_Alloc>::begin()[inline],[constexpr],[noexcept]
Returns a read/write iterator that points to the first element in the vector. Iteration is done in
ordinary element order.
Referenced by std::vector<_Tp,_Alloc>::vector(), std::vector<_Tp,_Alloc>::crend(), std::vector<_Tp,_Alloc>::empty(), std::vector<_Tp,_Alloc>::erase(), std::vector<_Tp,_Alloc>::erase(),
std::vector<_Tp,_Alloc>::front(), std::vector<_Tp,_Alloc>::front(), std::vector<_Tp,_Alloc>::insert(), std::vector<_Tp,_Alloc>::insert(), std::vector<_Tp,_Alloc>::insert(), std::vector<_Tp,_Alloc>::rend(), and std::vector<_Tp,_Alloc>::rend().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprsize_typestd::vector<_Tp,_Alloc>::capacity()const[inline],[constexpr],[noexcept]
Returns the total number of elements that the vector can hold before needing to allocate more memory.
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprconst_iteratorstd::vector<_Tp,_Alloc>::cbegin()const[inline],[constexpr],[noexcept]
Returns a read-only (constant) iterator that points to the first element in the vector. Iteration is done
in ordinary element order.
Referenced by std::vector<_Tp,_Alloc>::erase(), std::vector<_Tp,_Alloc>::erase(), std::vector<_Tp,_Alloc>::insert(), std::vector<_Tp,_Alloc>::insert(), and std::vector<_Tp,_Alloc>::insert().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprconst_iteratorstd::vector<_Tp,_Alloc>::cend()const[inline],[constexpr],[noexcept]
Returns a read-only (constant) iterator that points one past the last element in the vector. Iteration is
done in ordinary element order.
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprvoidstd::vector<_Tp,_Alloc>::clear()[inline],[constexpr],[noexcept]
Erases all the elements. Note that this function only erases the elements, and that if the elements
themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the
user's responsibility.
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprconst_reverse_iteratorstd::vector<_Tp,_Alloc>::crbegin()const[inline],[constexpr],[noexcept]
Returns a read-only (constant) reverse iterator that points to the last element in the vector. Iteration
is done in reverse element order.
References std::vector<_Tp,_Alloc>::end().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprconst_reverse_iteratorstd::vector<_Tp,_Alloc>::crend()const[inline],[constexpr],[noexcept]
Returns a read-only (constant) reverse iterator that points to one before the first element in the
vector. Iteration is done in reverse element order.
References std::vector<_Tp,_Alloc>::begin().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexpr_Tp*std::vector<_Tp,_Alloc>::data()[inline],[constexpr],[noexcept]
Returns a pointer such that [data(), data() + size()) is a valid range. For a non-empty vector, data() ==
&front().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>template<typename..._Args>constexpriteratorstd::vector<_Tp,_Alloc>::emplace(const_iterator__position,_Args&&...__args)[inline],[constexpr]
Inserts an object in vector before specified iterator.
Parameters__position A const_iterator into the vector.
__args Arguments.
Returns
An iterator that points to the inserted data.
This function will insert an object of type T constructed with T(std::forward<Args>(args)...) before the
specified location. Note that this kind of operation could be expensive for a vector and if it is
frequently used the user should consider using std::list.
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprboolstd::vector<_Tp,_Alloc>::empty()const[inline],[constexpr],[noexcept]
Returns true if the vector is empty. (Thus begin() would equal end().)
References std::vector<_Tp,_Alloc>::begin(), and std::vector<_Tp,_Alloc>::end().
Referenced by std::piecewise_constant_distribution<_RealType>::densities(),
std::piecewise_linear_distribution<_RealType>::densities(), std::piecewise_constant_distribution<_RealType>::intervals(), std::piecewise_linear_distribution<_RealType>::intervals(),
std::discrete_distribution<_IntType>::max(), std::piecewise_constant_distribution<_RealType>::max(),
std::piecewise_linear_distribution<_RealType>::max(), std::piecewise_constant_distribution<_RealType>::min(), std::piecewise_linear_distribution<_RealType>::min(), and std::discrete_distribution<_IntType>::probabilities().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprconst_iteratorstd::vector<_Tp,_Alloc>::end()const[inline],[constexpr],[noexcept]
Returns a read-only (constant) iterator that points one past the last element in the vector. Iteration is
done in ordinary element order.
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexpriteratorstd::vector<_Tp,_Alloc>::end()[inline],[constexpr],[noexcept]
Returns a read/write iterator that points one past the last element in the vector. Iteration is done in
ordinary element order.
Referenced by std::vector<_Tp,_Alloc>::vector(), std::vector<_Tp,_Alloc>::back(), std::vector<_Tp,_Alloc>::back(), std::vector<_Tp,_Alloc>::crbegin(), std::vector<_Tp,_Alloc>::empty(),
std::vector<_Tp,_Alloc>::push_back(), std::vector<_Tp,_Alloc>::rbegin(), std::vector<_Tp,_Alloc>::rbegin(), and std::vector<_Tp,_Alloc>::resize().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexpriteratorstd::vector<_Tp,_Alloc>::erase(const_iterator__first,const_iterator__last)[inline],[constexpr]
Remove a range of elements.
Parameters__first Iterator pointing to the first element to be erased.
__last Iterator pointing to one past the last element to be erased.
Returns
An iterator pointing to the element pointed to by __last prior to erasing (or end()).
This function will erase the elements in the range [__first,__last) and shorten the vector accordingly.
Note This operation could be expensive and if it is frequently used the user should consider using
std::list. The user is also cautioned that this function only erases the elements, and that if the
elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer
is the user's responsibility.
References std::vector<_Tp,_Alloc>::begin(), and std::vector<_Tp,_Alloc>::cbegin().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexpriteratorstd::vector<_Tp,_Alloc>::erase(const_iterator__position)[inline],[constexpr]
Remove element at given position.
Parameters__position Iterator pointing to element to be erased.
Returns
An iterator pointing to the next element (or end()).
This function will erase the element at the given position and thus shorten the vector by one.
Note This operation could be expensive and if it is frequently used the user should consider using
std::list. The user is also cautioned that this function only erases the element, and that if the element
is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's
responsibility.
References std::vector<_Tp,_Alloc>::begin(), and std::vector<_Tp,_Alloc>::cbegin().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprconst_referencestd::vector<_Tp,_Alloc>::front()const[inline],[constexpr],[noexcept]
Returns a read-only (constant) reference to the data at the first element of the vector.
References std::vector<_Tp,_Alloc>::begin().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprreferencestd::vector<_Tp,_Alloc>::front()[inline],[constexpr],[noexcept]
Returns a read/write reference to the data at the first element of the vector.
References std::vector<_Tp,_Alloc>::begin().
Referenced by std::piecewise_constant_distribution<_RealType>::min(), and
std::piecewise_linear_distribution<_RealType>::min().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprallocator_typestd::_Vector_base<_Tp,_Alloc>::get_allocator()const[inline],[constexpr],[noexcept]
Get a copy of the memory allocation object.
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>template<typename_InputIterator,typename=std::_RequireInputIter<_InputIterator>>constexpriteratorstd::vector<_Tp,_Alloc>::insert(const_iterator__position,_InputIterator__first,_InputIterator__last)[inline],[constexpr]
Inserts a range into the vector.
Parameters__position A const_iterator into the vector.
__first An input iterator.
__last An input iterator.
Returns
An iterator that points to the inserted data.
This function will insert copies of the data in the range [__first,__last) into the vector before the
location specified by pos.
Note that this kind of operation could be expensive for a vector and if it is frequently used the user
should consider using std::list.
References std::__iterator_category(), std::vector<_Tp,_Alloc>::begin(), and std::vector<_Tp,_Alloc>::cbegin().
template<typename_Tp,typename_Alloc>constexprvector<_Tp,_Alloc>::iteratorvector::insert(const_iterator__position,constvalue_type&__x)[constexpr]
Inserts given value into vector before specified iterator.
Parameters__position A const_iterator into the vector.
__x Data to be inserted.
Returns
An iterator that points to the inserted data.
This function will insert a copy of the given value before the specified location. Note that this kind of
operation could be expensive for a vector and if it is frequently used the user should consider using
std::list.
References std::begin(), std::cbegin(), std::end(), and std::move().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexpriteratorstd::vector<_Tp,_Alloc>::insert(const_iterator__position,initializer_list<value_type>__l)[inline],[constexpr]
Inserts an initializer_list into the vector.
Parameters__position An iterator into the vector.
__l An initializer_list.
This function will insert copies of the data in the initializer_list l into the vector before the
location specified by position.
Note that this kind of operation could be expensive for a vector and if it is frequently used the user
should consider using std::list.
References std::vector<_Tp,_Alloc>::begin(), and std::vector<_Tp,_Alloc>::cbegin().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexpriteratorstd::vector<_Tp,_Alloc>::insert(const_iterator__position,size_type__n,constvalue_type&__x)[inline],[constexpr]
Inserts a number of copies of given data into the vector.
Parameters__position A const_iterator into the vector.
__n Number of elements to be inserted.
__x Data to be inserted.
Returns
An iterator that points to the inserted data.
This function will insert a specified number of copies of the given data before the location specified by
position.
Note that this kind of operation could be expensive for a vector and if it is frequently used the user
should consider using std::list.
References std::vector<_Tp,_Alloc>::begin(), and std::vector<_Tp,_Alloc>::cbegin().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexpriteratorstd::vector<_Tp,_Alloc>::insert(const_iterator__position,value_type&&__x)[inline],[constexpr]
Inserts given rvalue into vector before specified iterator.
Parameters__position A const_iterator into the vector.
__x Data to be inserted.
Returns
An iterator that points to the inserted data.
This function will insert a copy of the given rvalue before the specified location. Note that this kind
of operation could be expensive for a vector and if it is frequently used the user should consider using
std::list.
References std::move().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprsize_typestd::vector<_Tp,_Alloc>::max_size()const[inline],[constexpr],[noexcept]
Returns the size() of the largest possible vector.
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprvector&std::vector<_Tp,_Alloc>::operator=(constvector<_Tp,_Alloc>&__x)[constexpr]
Vector assignment operator.
Parameters__x A vector of identical element and allocator types.
All the elements of __x are copied, but any unused capacity in __x will not be copied.
Whether the allocator is copied depends on the allocator traits.
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprvector&std::vector<_Tp,_Alloc>::operator=(initializer_list<value_type>__l)[inline],[constexpr]
Vector list assignment operator.
Parameters__l An initializer_list.
This function fills a vector with copies of the elements in the initializer list __l.
Note that the assignment completely changes the vector and that the resulting vector's size is the same
as the number of elements assigned.
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprvector&std::vector<_Tp,_Alloc>::operator=(vector<_Tp,_Alloc>&&__x)[inline],[constexpr],[noexcept]
Vector move assignment operator.
Parameters__x A vector of identical element and allocator types.
The contents of __x are moved into this vector (without copying, if the allocators permit it). Afterwards
__x is a valid, but unspecified vector.
Whether the allocator is moved depends on the allocator traits.
References std::move().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprconst_referencestd::vector<_Tp,_Alloc>::operator[](size_type__n)const[inline],[constexpr],[noexcept]
Subscript access to the data contained in the vector.
Parameters__n The index of the element for which data should be accessed.
Returns
Read-only (constant) reference to data.
This operator allows for easy, array-style, data access. Note that data access with this operator is
unchecked and out_of_range lookups are not defined. (For checked lookups see at().)
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprreferencestd::vector<_Tp,_Alloc>::operator[](size_type__n)[inline],[constexpr],[noexcept]
Subscript access to the data contained in the vector.
Parameters__n The index of the element for which data should be accessed.
Returns
Read/write reference to data.
This operator allows for easy, array-style, data access. Note that data access with this operator is
unchecked and out_of_range lookups are not defined. (For checked lookups see at().)
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprvoidstd::vector<_Tp,_Alloc>::pop_back()[inline],[constexpr],[noexcept]
Removes last element. This is a typical stack operation. It shrinks the vector by one.
Note that no data is returned, and if the last element's data is needed, it should be retrieved before
pop_back() is called.
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprvoidstd::vector<_Tp,_Alloc>::push_back(constvalue_type&__x)[inline],[constexpr]
Add data to the end of the vector.
Parameters__x Data to be added.
This is a typical stack operation. The function creates an element at the end of the vector and assigns
the given data to it. Due to the nature of a vector this operation can be done in constant time if the
vector has preallocated space available.
References std::vector<_Tp,_Alloc>::end().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprconst_reverse_iteratorstd::vector<_Tp,_Alloc>::rbegin()const[inline],[constexpr],[noexcept]
Returns a read-only (constant) reverse iterator that points to the last element in the vector. Iteration
is done in reverse element order.
References std::vector<_Tp,_Alloc>::end().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprreverse_iteratorstd::vector<_Tp,_Alloc>::rbegin()[inline],[constexpr],[noexcept]
Returns a read/write reverse iterator that points to the last element in the vector. Iteration is done in
reverse element order.
References std::vector<_Tp,_Alloc>::end().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprconst_reverse_iteratorstd::vector<_Tp,_Alloc>::rend()const[inline],[constexpr],[noexcept]
Returns a read-only (constant) reverse iterator that points to one before the first element in the
vector. Iteration is done in reverse element order.
References std::vector<_Tp,_Alloc>::begin().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprreverse_iteratorstd::vector<_Tp,_Alloc>::rend()[inline],[constexpr],[noexcept]
Returns a read/write reverse iterator that points to one before the first element in the vector.
Iteration is done in reverse element order.
References std::vector<_Tp,_Alloc>::begin().
template<typename_Tp,typename_Alloc>constexprvoidvector::reserve(size_type__n)[constexpr]
Attempt to preallocate enough memory for specified number of elements.
Parameters__n Number of elements required.
Exceptionsstd::length_error If n exceeds max_size().
This function attempts to reserve enough memory for the vector to hold the specified number of elements.
If the number requested is more than max_size(), length_error is thrown.
The advantage of this function is that if optimal code is a necessity and the user can determine the
number of elements that will be required, the user can reserve the memory in advance, and thus prevent a
possible reallocation of memory and copying of vector data.
References std::_Destroy(), and std::size().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprvoidstd::vector<_Tp,_Alloc>::resize(size_type__new_size)[inline],[constexpr]
Resizes the vector to the specified number of elements.
Parameters__new_size Number of elements the vector should contain.
This function will resize the vector to the specified number of elements. If the number is smaller than
the vector's current size the vector is truncated, otherwise default constructed elements are appended.
References std::vector<_Tp,_Alloc>::size().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprvoidstd::vector<_Tp,_Alloc>::resize(size_type__new_size,constvalue_type&__x)[inline],[constexpr]
Resizes the vector to the specified number of elements.
Parameters__new_size Number of elements the vector should contain.
__x Data with which new elements should be populated.
This function will resize the vector to the specified number of elements. If the number is smaller than
the vector's current size the vector is truncated, otherwise the vector is extended and new elements are
populated with given data.
References std::vector<_Tp,_Alloc>::end(), and std::vector<_Tp,_Alloc>::size().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprvoidstd::vector<_Tp,_Alloc>::shrink_to_fit()[inline],[constexpr]
A non-binding request to reduce capacity() to size().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprsize_typestd::vector<_Tp,_Alloc>::size()const[inline],[constexpr],[noexcept]
Returns the number of elements in the vector.
Referenced by std::vector<_Tp,_Alloc>::_M_range_check(), std::discrete_distribution<_IntType>::max(), std::vector<_Tp,_Alloc>::resize(), and std::vector<_Tp,_Alloc>::resize().
template<typename_Tp,typename_Alloc=std::allocator<_Tp>>constexprvoidstd::vector<_Tp,_Alloc>::swap(vector<_Tp,_Alloc>&__x)[inline],[constexpr],[noexcept]
Swaps data with another vector.
Parameters__x A vector of the same element and allocator types.
This exchanges the elements between two vectors in constant time. (Three pointers, so it should be quite
fast.) Note that the global std::swap() function is specialized such that std::swap(v1,v2) will feed to
this function.
Whether the allocators are swapped depends on the allocator traits.