.TH "std::vector< _Tp, _Alloc >" 3cxx "Tue Feb 2 2021" "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::vector< _Tp, _Alloc > \- A standard container which offers fixed time access to individual elements in any order\&. .SH SYNOPSIS .br .PP .PP Inherits \fBstd::_Vector_base< _Tp, std::allocator< _Tp > >\fP\&. .SS "Public Types" .in +1c .ti -1c .RI "typedef _Alloc \fBallocator_type\fP" .br .ti -1c .RI "typedef __gnu_cxx::__normal_iterator< const_pointer, \fBvector\fP > \fBconst_iterator\fP" .br .ti -1c .RI "typedef _Alloc_traits::const_pointer \fBconst_pointer\fP" .br .ti -1c .RI "typedef _Alloc_traits::const_reference \fBconst_reference\fP" .br .ti -1c .RI "typedef \fBstd::reverse_iterator\fP< const_iterator > \fBconst_reverse_iterator\fP" .br .ti -1c .RI "typedef ptrdiff_t \fBdifference_type\fP" .br .ti -1c .RI "typedef __gnu_cxx::__normal_iterator< pointer, \fBvector\fP > \fBiterator\fP" .br .ti -1c .RI "typedef _Base::pointer \fBpointer\fP" .br .ti -1c .RI "typedef _Alloc_traits::reference \fBreference\fP" .br .ti -1c .RI "typedef \fBstd::reverse_iterator\fP< iterator > \fBreverse_iterator\fP" .br .ti -1c .RI "typedef size_t \fBsize_type\fP" .br .ti -1c .RI "typedef _Tp \fBvalue_type\fP" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBvector\fP () noexcept(\fBis_nothrow_default_constructible\fP< _Alloc >::value)" .br .RI "Creates a vector with no elements\&. " .ti -1c .RI "template> \fBvector\fP (_InputIterator __first, _InputIterator __last, const allocator_type &__a=allocator_type())" .br .RI "Builds a vector from a range\&. " .ti -1c .RI "\fBvector\fP (const allocator_type &__a) noexcept" .br .RI "Creates a vector with no elements\&. " .ti -1c .RI "\fBvector\fP (const \fBvector\fP &__x)" .br .RI "Vector copy constructor\&. " .ti -1c .RI "\fBvector\fP (const \fBvector\fP &__x, const allocator_type &__a)" .br .RI "Copy constructor with alternative allocator\&. " .ti -1c .RI "\fBvector\fP (\fBinitializer_list\fP< value_type > __l, const allocator_type &__a=allocator_type())" .br .RI "Builds a vector from an initializer list\&. " .ti -1c .RI "\fBvector\fP (size_type __n, const allocator_type &__a=allocator_type())" .br .RI "Creates a vector with default constructed elements\&. " .ti -1c .RI "\fBvector\fP (size_type __n, const value_type &__value, const allocator_type &__a=allocator_type())" .br .RI "Creates a vector with copies of an exemplar element\&. " .ti -1c .RI "\fBvector\fP (\fBvector\fP &&__rv, const allocator_type &__m) noexcept(_Alloc_traits::_S_always_equal())" .br .RI "Move constructor with alternative allocator\&. " .ti -1c .RI "\fBvector\fP (\fBvector\fP &&__x) noexcept" .br .RI "Vector move constructor\&. " .ti -1c .RI "\fB~vector\fP () noexcept" .br .ti -1c .RI "template auto \fB_M_emplace_aux\fP (const_iterator __position, _Args &&\&.\&.\&. __args) \-> iterator" .br .ti -1c .RI "template> void \fBassign\fP (_InputIterator __first, _InputIterator __last)" .br .RI "Assigns a range to a vector\&. " .ti -1c .RI "void \fBassign\fP (\fBinitializer_list\fP< value_type > __l)" .br .RI "Assigns an initializer list to a vector\&. " .ti -1c .RI "void \fBassign\fP (size_type __n, const value_type &__val)" .br .RI "Assigns a given value to a vector\&. " .ti -1c .RI "reference \fBat\fP (size_type __n)" .br .RI "Provides access to the data contained in the vector\&. " .ti -1c .RI "const_reference \fBat\fP (size_type __n) const" .br .RI "Provides access to the data contained in the vector\&. " .ti -1c .RI "const_reference \fBback\fP () const noexcept" .br .ti -1c .RI "reference \fBback\fP () noexcept" .br .ti -1c .RI "const_iterator \fBbegin\fP () const noexcept" .br .ti -1c .RI "iterator \fBbegin\fP () noexcept" .br .ti -1c .RI "size_type \fBcapacity\fP () const noexcept" .br .ti -1c .RI "const_iterator \fBcbegin\fP () const noexcept" .br .ti -1c .RI "const_iterator \fBcend\fP () const noexcept" .br .ti -1c .RI "void \fBclear\fP () noexcept" .br .ti -1c .RI "\fBconst_reverse_iterator\fP \fBcrbegin\fP () const noexcept" .br .ti -1c .RI "\fBconst_reverse_iterator\fP \fBcrend\fP () const noexcept" .br .ti -1c .RI "const _Tp * \fBdata\fP () const noexcept" .br .ti -1c .RI "_Tp * \fBdata\fP () noexcept" .br .ti -1c .RI "template iterator \fBemplace\fP (const_iterator __position, _Args &&\&.\&.\&. __args)" .br .RI "Inserts an object in vector before specified iterator\&. " .ti -1c .RI "template void \fBemplace_back\fP (_Args &&\&.\&.\&. __args)" .br .ti -1c .RI "bool \fBempty\fP () const noexcept" .br .ti -1c .RI "const_iterator \fBend\fP () const noexcept" .br .ti -1c .RI "iterator \fBend\fP () noexcept" .br .ti -1c .RI "iterator \fBerase\fP (const_iterator __first, const_iterator __last)" .br .RI "Remove a range of elements\&. " .ti -1c .RI "iterator \fBerase\fP (const_iterator __position)" .br .RI "Remove element at given position\&. " .ti -1c .RI "const_reference \fBfront\fP () const noexcept" .br .ti -1c .RI "reference \fBfront\fP () noexcept" .br .ti -1c .RI "allocator_type \fBget_allocator\fP () const noexcept" .br .RI "Get a copy of the memory allocation object\&. " .ti -1c .RI "template> iterator \fBinsert\fP (const_iterator __position, _InputIterator __first, _InputIterator __last)" .br .RI "Inserts a range into the vector\&. " .ti -1c .RI "iterator \fBinsert\fP (const_iterator __position, const value_type &__x)" .br .RI "Inserts given value into vector before specified iterator\&. " .ti -1c .RI "iterator \fBinsert\fP (const_iterator __position, \fBinitializer_list\fP< value_type > __l)" .br .RI "Inserts an initializer_list into the vector\&. " .ti -1c .RI "iterator \fBinsert\fP (const_iterator __position, size_type __n, const value_type &__x)" .br .RI "Inserts a number of copies of given data into the vector\&. " .ti -1c .RI "iterator \fBinsert\fP (const_iterator __position, value_type &&__x)" .br .RI "Inserts given rvalue into vector before specified iterator\&. " .ti -1c .RI "size_type \fBmax_size\fP () const noexcept" .br .ti -1c .RI "\fBvector\fP & \fBoperator=\fP (const \fBvector\fP &__x)" .br .RI "Vector assignment operator\&. " .ti -1c .RI "\fBvector\fP & \fBoperator=\fP (\fBinitializer_list\fP< value_type > __l)" .br .RI "Vector list assignment operator\&. " .ti -1c .RI "\fBvector\fP & \fBoperator=\fP (\fBvector\fP &&__x) noexcept(_Alloc_traits::_S_nothrow_move())" .br .RI "Vector move assignment operator\&. " .ti -1c .RI "const_reference \fBoperator[]\fP (size_type __n) const noexcept" .br .RI "Subscript access to the data contained in the vector\&. " .ti -1c .RI "reference \fBoperator[]\fP (size_type __n) noexcept" .br .RI "Subscript access to the data contained in the vector\&. " .ti -1c .RI "void \fBpop_back\fP () noexcept" .br .RI "Removes last element\&. " .ti -1c .RI "void \fBpush_back\fP (const value_type &__x)" .br .RI "Add data to the end of the vector\&. " .ti -1c .RI "void \fBpush_back\fP (value_type &&__x)" .br .ti -1c .RI "\fBconst_reverse_iterator\fP \fBrbegin\fP () const noexcept" .br .ti -1c .RI "\fBreverse_iterator\fP \fBrbegin\fP () noexcept" .br .ti -1c .RI "\fBconst_reverse_iterator\fP \fBrend\fP () const noexcept" .br .ti -1c .RI "\fBreverse_iterator\fP \fBrend\fP () noexcept" .br .ti -1c .RI "void \fBreserve\fP (size_type __n)" .br .RI "Attempt to preallocate enough memory for specified number of elements\&. " .ti -1c .RI "void \fBresize\fP (size_type __new_size)" .br .RI "Resizes the vector to the specified number of elements\&. " .ti -1c .RI "void \fBresize\fP (size_type __new_size, const value_type &__x)" .br .RI "Resizes the vector to the specified number of elements\&. " .ti -1c .RI "void \fBshrink_to_fit\fP ()" .br .ti -1c .RI "size_type \fBsize\fP () const noexcept" .br .ti -1c .RI "void \fBswap\fP (\fBvector\fP &__x) noexcept" .br .RI "Swaps data with another vector\&. " .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "pointer \fB_M_allocate\fP (size_t __n)" .br .ti -1c .RI "pointer \fB_M_allocate\fP (size_t __n)" .br .ti -1c .RI "template pointer \fB_M_allocate_and_copy\fP (size_type __n, _ForwardIterator __first, _ForwardIterator __last)" .br .ti -1c .RI "template void \fB_M_assign_aux\fP (_ForwardIterator __first, _ForwardIterator __last, \fBstd::forward_iterator_tag\fP)" .br .ti -1c .RI "template void \fB_M_assign_aux\fP (_InputIterator __first, _InputIterator __last, \fBstd::input_iterator_tag\fP)" .br .ti -1c .RI "template void \fB_M_assign_dispatch\fP (_InputIterator __first, _InputIterator __last, __false_type)" .br .ti -1c .RI "template void \fB_M_assign_dispatch\fP (_Integer __n, _Integer __val, __true_type)" .br .ti -1c .RI "size_type \fB_M_check_len\fP (size_type __n, const char *__s) const" .br .ti -1c .RI "void \fB_M_deallocate\fP (pointer __p, size_t __n)" .br .ti -1c .RI "void \fB_M_deallocate\fP (pointer __p, size_t __n)" .br .ti -1c .RI "void \fB_M_default_append\fP (size_type __n)" .br .ti -1c .RI "void \fB_M_default_initialize\fP (size_type __n)" .br .ti -1c .RI "template iterator \fB_M_emplace_aux\fP (const_iterator __position, _Args &&\&.\&.\&. __args)" .br .ti -1c .RI "iterator \fB_M_emplace_aux\fP (const_iterator __position, value_type &&__v)" .br .ti -1c .RI "iterator \fB_M_erase\fP (iterator __first, iterator __last)" .br .ti -1c .RI "iterator \fB_M_erase\fP (iterator __position)" .br .ti -1c .RI "void \fB_M_erase_at_end\fP (pointer __pos) noexcept" .br .ti -1c .RI "void \fB_M_fill_assign\fP (size_type __n, const value_type &__val)" .br .ti -1c .RI "void \fB_M_fill_initialize\fP (size_type __n, const value_type &__value)" .br .ti -1c .RI "void \fB_M_fill_insert\fP (iterator __pos, size_type __n, const value_type &__x)" .br .ti -1c .RI "const _Tp_alloc_type & \fB_M_get_Tp_allocator\fP () const noexcept" .br .ti -1c .RI "const _Tp_alloc_type & \fB_M_get_Tp_allocator\fP () const noexcept" .br .ti -1c .RI "_Tp_alloc_type & \fB_M_get_Tp_allocator\fP () noexcept" .br .ti -1c .RI "template void \fB_M_initialize_dispatch\fP (_InputIterator __first, _InputIterator __last, __false_type)" .br .ti -1c .RI "template void \fB_M_initialize_dispatch\fP (_Integer __n, _Integer __value, __true_type)" .br .ti -1c .RI "template void \fB_M_insert_aux\fP (iterator __position, _Arg &&__arg)" .br .ti -1c .RI "template void \fB_M_insert_dispatch\fP (iterator __pos, _InputIterator __first, _InputIterator __last, __false_type)" .br .ti -1c .RI "template void \fB_M_insert_dispatch\fP (iterator __pos, _Integer __n, _Integer __val, __true_type)" .br .ti -1c .RI "iterator \fB_M_insert_rval\fP (const_iterator __position, value_type &&__v)" .br .ti -1c .RI "void \fB_M_range_check\fP (size_type __n) const" .br .RI "Safety check used only from at()\&. " .ti -1c .RI "template void \fB_M_range_initialize\fP (_ForwardIterator __first, _ForwardIterator __last, \fBstd::forward_iterator_tag\fP)" .br .ti -1c .RI "template void \fB_M_range_initialize\fP (_InputIterator __first, _InputIterator __last, \fBstd::input_iterator_tag\fP)" .br .ti -1c .RI "template void \fB_M_range_insert\fP (iterator __pos, _ForwardIterator __first, _ForwardIterator __last, \fBstd::forward_iterator_tag\fP)" .br .ti -1c .RI "template void \fB_M_range_insert\fP (iterator __pos, _InputIterator __first, _InputIterator __last, \fBstd::input_iterator_tag\fP)" .br .ti -1c .RI "template void \fB_M_realloc_insert\fP (iterator __position, _Args &&\&.\&.\&. __args)" .br .ti -1c .RI "bool \fB_M_shrink_to_fit\fP ()" .br .ti -1c .RI "allocator_type \fBget_allocator\fP () const noexcept" .br .in -1c .SS "Protected Attributes" .in +1c .ti -1c .RI "_Vector_impl \fB_M_impl\fP" .br .in -1c .SH "Detailed Description" .PP .SS "template> .br class std::vector< _Tp, _Alloc >" A standard container which offers fixed time access to individual elements in any order\&. .PP \fBTemplate Parameters\fP .RS 4 \fI_Tp\fP Type of element\&. .br \fI_Alloc\fP Allocator type, defaults to allocator<_Tp>\&. .RE .PP Meets the requirements of a \fCcontainer\fP, a \fCreversible container\fP, and a \fCsequence\fP, including the \fCoptional sequence requirements\fP with the exception of \fCpush_front\fP and \fCpop_front\fP\&. .PP In some terminology a vector can be described as a dynamic C-style array, it offers fast and efficient access to individual elements in any order and saves the user from worrying about memory and size allocation\&. Subscripting ( \fC\fP[] ) access is also provided as with C-style arrays\&. .PP Definition at line 339 of file stl_vector\&.h\&. .SH "Constructor & Destructor Documentation" .PP .SS "template> \fBstd::vector\fP< _Tp, _Alloc >::\fBvector\fP ()\fC [inline]\fP, \fC [noexcept]\fP" .PP Creates a vector with no elements\&. .PP Definition at line 391 of file stl_vector\&.h\&. .SS "template> \fBstd::vector\fP< _Tp, _Alloc >::\fBvector\fP (const allocator_type & __a)\fC [inline]\fP, \fC [explicit]\fP, \fC [noexcept]\fP" .PP Creates a vector with no elements\&. .PP \fBParameters\fP .RS 4 \fI__a\fP An allocator object\&. .RE .PP .PP Definition at line 402 of file stl_vector\&.h\&. .SS "template> \fBstd::vector\fP< _Tp, _Alloc >::\fBvector\fP (size_type __n, const allocator_type & __a = \fCallocator_type()\fP)\fC [inline]\fP, \fC [explicit]\fP" .PP Creates a vector with default constructed elements\&. .PP \fBParameters\fP .RS 4 \fI__n\fP The number of elements to initially create\&. .br \fI__a\fP An allocator\&. .RE .PP This constructor fills the vector with \fI__n\fP default constructed elements\&. .PP Definition at line 415 of file stl_vector\&.h\&. .SS "template> \fBstd::vector\fP< _Tp, _Alloc >::\fBvector\fP (size_type __n, const value_type & __value, const allocator_type & __a = \fCallocator_type()\fP)\fC [inline]\fP" .PP Creates a vector with copies of an exemplar element\&. .PP \fBParameters\fP .RS 4 \fI__n\fP The number of elements to initially create\&. .br \fI__value\fP An element to copy\&. .br \fI__a\fP An allocator\&. .RE .PP This constructor fills the vector with \fI__n\fP copies of \fI__value\fP\&. .PP Definition at line 427 of file stl_vector\&.h\&. .SS "template> \fBstd::vector\fP< _Tp, _Alloc >::\fBvector\fP (const \fBvector\fP< _Tp, _Alloc > & __x)\fC [inline]\fP" .PP Vector copy constructor\&. .PP \fBParameters\fP .RS 4 \fI__x\fP A vector of identical element and allocator types\&. .RE .PP All the elements of \fI__x\fP are copied, but any unused capacity in \fI__x\fP will not be copied (i\&.e\&. capacity() == size() in the new vector)\&. .PP The newly-created vector uses a copy of the allocator object used by \fI__x\fP (unless the allocator traits dictate a different object)\&. .PP Definition at line 458 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::begin(), and std::vector< _Tp, _Alloc >::end()\&. .SS "template> \fBstd::vector\fP< _Tp, _Alloc >::\fBvector\fP (\fBvector\fP< _Tp, _Alloc > && __x)\fC [inline]\fP, \fC [noexcept]\fP" .PP Vector move constructor\&. .PP \fBParameters\fP .RS 4 \fI__x\fP A vector of identical element and allocator types\&. .RE .PP The newly-created vector contains the exact contents of \fI__x\fP\&. The contents of \fI__x\fP are a valid, but unspecified vector\&. .PP Definition at line 476 of file stl_vector\&.h\&. .SS "template> \fBstd::vector\fP< _Tp, _Alloc >::\fBvector\fP (const \fBvector\fP< _Tp, _Alloc > & __x, const allocator_type & __a)\fC [inline]\fP" .PP Copy constructor with alternative allocator\&. .PP Definition at line 480 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::begin(), and std::vector< _Tp, _Alloc >::end()\&. .SS "template> \fBstd::vector\fP< _Tp, _Alloc >::\fBvector\fP (\fBvector\fP< _Tp, _Alloc > && __rv, const allocator_type & __m)\fC [inline]\fP, \fC [noexcept]\fP" .PP Move constructor with alternative allocator\&. .PP Definition at line 490 of file stl_vector\&.h\&. .SS "template> \fBstd::vector\fP< _Tp, _Alloc >::\fBvector\fP (\fBinitializer_list\fP< value_type > __l, const allocator_type & __a = \fCallocator_type()\fP)\fC [inline]\fP" .PP Builds a vector from an initializer list\&. .PP \fBParameters\fP .RS 4 \fI__l\fP An initializer_list\&. .br \fI__a\fP An allocator\&. .RE .PP Create a vector consisting of copies of the elements in the initializer_list \fI__l\fP\&. .PP This will call the element type's copy constructor N times (where N is \fI__l\&.size()\fP) and do no memory reallocation\&. .PP Definition at line 515 of file stl_vector\&.h\&. .SS "template> template> \fBstd::vector\fP< _Tp, _Alloc >::\fBvector\fP (_InputIterator __first, _InputIterator __last, const allocator_type & __a = \fCallocator_type()\fP)\fC [inline]\fP" .PP Builds a vector from a range\&. .PP \fBParameters\fP .RS 4 \fI__first\fP An input iterator\&. .br \fI__last\fP An input iterator\&. .br \fI__a\fP An allocator\&. .RE .PP Create a vector consisting of copies of the elements from [first,last)\&. .PP If the iterators are forward, bidirectional, or random-access, then this will call the elements' copy constructor N times (where N is distance(first,last)) and do no memory reallocation\&. But if only input iterators are used, then this will do at most 2N calls to the copy constructor, and logN memory reallocations\&. .PP Definition at line 543 of file stl_vector\&.h\&. .SS "template> \fBstd::vector\fP< _Tp, _Alloc >::~\fBvector\fP ()\fC [inline]\fP, \fC [noexcept]\fP" The dtor only erases the elements, and note 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\&. .PP Definition at line 565 of file stl_vector\&.h\&. .PP References std::_Destroy()\&. .SH "Member Function Documentation" .PP .SS "template> template pointer \fBstd::vector\fP< _Tp, _Alloc >::_M_allocate_and_copy (size_type __n, _ForwardIterator __first, _ForwardIterator __last)\fC [inline]\fP, \fC [protected]\fP" Memory expansion handler\&. Uses the member allocation function to obtain \fIn\fP bytes of memory, and then copies [first,last) into it\&. .PP Definition at line 1395 of file stl_vector\&.h\&. .SS "template> void \fBstd::vector\fP< _Tp, _Alloc >::_M_range_check (size_type __n) const\fC [inline]\fP, \fC [protected]\fP" .PP Safety check used only from at()\&. .PP Definition at line 957 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::size()\&. .PP Referenced by std::vector< _Tp, _Alloc >::at()\&. .SS "template> template> void \fBstd::vector\fP< _Tp, _Alloc >::assign (_InputIterator __first, _InputIterator __last)\fC [inline]\fP" .PP Assigns a range to a vector\&. .PP \fBParameters\fP .RS 4 \fI__first\fP An input iterator\&. .br \fI__last\fP An input iterator\&. .RE .PP This function fills a vector with copies of the elements in the range [__first,__last)\&. .PP Note that the assignment completely changes the vector and that the resulting vector's size is the same as the number of elements assigned\&. .PP Definition at line 655 of file stl_vector\&.h\&. .SS "template> void \fBstd::vector\fP< _Tp, _Alloc >::assign (\fBinitializer_list\fP< value_type > __l)\fC [inline]\fP" .PP Assigns an initializer list to a vector\&. .PP \fBParameters\fP .RS 4 \fI__l\fP An initializer_list\&. .RE .PP This function fills a vector with copies of the elements in the initializer list \fI__l\fP\&. .PP Note that the assignment completely changes the vector and that the resulting vector's size is the same as the number of elements assigned\&. .PP Definition at line 681 of file stl_vector\&.h\&. .SS "template> void \fBstd::vector\fP< _Tp, _Alloc >::assign (size_type __n, const value_type & __val)\fC [inline]\fP" .PP Assigns a given value to a vector\&. .PP \fBParameters\fP .RS 4 \fI__n\fP Number of elements to be assigned\&. .br \fI__val\fP Value to be assigned\&. .RE .PP This function fills a vector with \fI__n\fP 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\&. .PP Definition at line 636 of file stl_vector\&.h\&. .SS "template> reference \fBstd::vector\fP< _Tp, _Alloc >::at (size_type __n)\fC [inline]\fP" .PP Provides access to the data contained in the vector\&. .PP \fBParameters\fP .RS 4 \fI__n\fP The index of the element for which data should be accessed\&. .RE .PP \fBReturns\fP .RS 4 Read/write reference to data\&. .RE .PP \fBExceptions\fP .RS 4 \fIstd::out_of_range\fP If \fI__n\fP is an invalid index\&. .RE .PP 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\&. .PP Definition at line 979 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::_M_range_check()\&. .SS "template> const_reference \fBstd::vector\fP< _Tp, _Alloc >::at (size_type __n) const\fC [inline]\fP" .PP Provides access to the data contained in the vector\&. .PP \fBParameters\fP .RS 4 \fI__n\fP The index of the element for which data should be accessed\&. .RE .PP \fBReturns\fP .RS 4 Read-only (constant) reference to data\&. .RE .PP \fBExceptions\fP .RS 4 \fIstd::out_of_range\fP If \fI__n\fP is an invalid index\&. .RE .PP 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\&. .PP Definition at line 997 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::_M_range_check()\&. .SS "template> const_reference \fBstd::vector\fP< _Tp, _Alloc >::back () const\fC [inline]\fP, \fC [noexcept]\fP" Returns a read-only (constant) reference to the data at the last element of the vector\&. .PP Definition at line 1041 of file stl_vector\&.h\&. .SS "template> reference \fBstd::vector\fP< _Tp, _Alloc >::back ()\fC [inline]\fP, \fC [noexcept]\fP" Returns a read/write reference to the data at the last element of the vector\&. .PP Definition at line 1030 of file stl_vector\&.h\&. .PP Referenced by std::piecewise_constant_distribution< _RealType >::max(), and std::piecewise_linear_distribution< _RealType >::max()\&. .SS "template> const_iterator \fBstd::vector\fP< _Tp, _Alloc >::begin () const\fC [inline]\fP, \fC [noexcept]\fP" Returns a read-only (constant) iterator that points to the first element in the vector\&. Iteration is done in ordinary element order\&. .PP Definition at line 707 of file stl_vector\&.h\&. .SS "template> iterator \fBstd::vector\fP< _Tp, _Alloc >::begin ()\fC [inline]\fP, \fC [noexcept]\fP" Returns a read/write iterator that points to the first element in the vector\&. Iteration is done in ordinary element order\&. .PP Definition at line 698 of file stl_vector\&.h\&. .PP Referenced by std::vector< _Tp, _Alloc >::vector(), std::match_results< _Bi_iter, _Alloc >::begin(), std::vector< _Tp, _Alloc >::crend(), std::vector< _Tp, _Alloc >::empty(), std::vector< _Tp, _Alloc >::erase(), std::vector< _Tp, _Alloc >::insert(), std::operator<(), std::operator==(), and std::vector< _Tp, _Alloc >::rend()\&. .SS "template> size_type \fBstd::vector\fP< _Tp, _Alloc >::capacity () const\fC [inline]\fP, \fC [noexcept]\fP" Returns the total number of elements that the vector can hold before needing to allocate more memory\&. .PP Definition at line 885 of file stl_vector\&.h\&. .SS "template> const_iterator \fBstd::vector\fP< _Tp, _Alloc >::cbegin () const\fC [inline]\fP, \fC [noexcept]\fP" Returns a read-only (constant) iterator that points to the first element in the vector\&. Iteration is done in ordinary element order\&. .PP Definition at line 771 of file stl_vector\&.h\&. .PP Referenced by std::vector< _Tp, _Alloc >::erase(), and std::vector< _Tp, _Alloc >::insert()\&. .SS "template> const_iterator \fBstd::vector\fP< _Tp, _Alloc >::cend () const\fC [inline]\fP, \fC [noexcept]\fP" Returns a read-only (constant) iterator that points one past the last element in the vector\&. Iteration is done in ordinary element order\&. .PP Definition at line 780 of file stl_vector\&.h\&. .SS "template> void \fBstd::vector\fP< _Tp, _Alloc >::clear ()\fC [inline]\fP, \fC [noexcept]\fP" 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\&. .PP Definition at line 1385 of file stl_vector\&.h\&. .SS "template> \fBconst_reverse_iterator\fP \fBstd::vector\fP< _Tp, _Alloc >::crbegin () const\fC [inline]\fP, \fC [noexcept]\fP" Returns a read-only (constant) reverse iterator that points to the last element in the vector\&. Iteration is done in reverse element order\&. .PP Definition at line 789 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::end()\&. .SS "template> \fBconst_reverse_iterator\fP \fBstd::vector\fP< _Tp, _Alloc >::crend () const\fC [inline]\fP, \fC [noexcept]\fP" 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\&. .PP Definition at line 798 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::begin()\&. .SS "template> _Tp* \fBstd::vector\fP< _Tp, _Alloc >::data ()\fC [inline]\fP, \fC [noexcept]\fP" Returns a pointer such that [data(), data() + size()) is a valid range\&. For a non-empty vector, data() == &front()\&. .PP Definition at line 1055 of file stl_vector\&.h\&. .PP Referenced by std::regex_traits< _Ch_type >::transform_primary()\&. .SS "template> template iterator \fBstd::vector\fP< _Tp, _Alloc >::emplace (const_iterator __position, _Args &&\&.\&.\&. __args)\fC [inline]\fP" .PP Inserts an object in vector before specified iterator\&. .PP \fBParameters\fP .RS 4 \fI__position\fP A const_iterator into the vector\&. .br \fI__args\fP Arguments\&. .RE .PP \fBReturns\fP .RS 4 An iterator that points to the inserted data\&. .RE .PP This function will insert an object of type T constructed with T(std::forward(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\&. .PP Definition at line 1135 of file stl_vector\&.h\&. .SS "template> bool \fBstd::vector\fP< _Tp, _Alloc >::empty () const\fC [inline]\fP, \fC [noexcept]\fP" Returns true if the vector is empty\&. (Thus begin() would equal end()\&.) .PP Definition at line 894 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::begin(), and std::vector< _Tp, _Alloc >::end()\&. .PP 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(), std::discrete_distribution< _IntType >::probabilities(), std::match_results< _Bi_iter, _Alloc >::ready(), and std::match_results< _Bi_iter, _Alloc >::size()\&. .SS "template> const_iterator \fBstd::vector\fP< _Tp, _Alloc >::end () const\fC [inline]\fP, \fC [noexcept]\fP" Returns a read-only (constant) iterator that points one past the last element in the vector\&. Iteration is done in ordinary element order\&. .PP Definition at line 725 of file stl_vector\&.h\&. .SS "template> iterator \fBstd::vector\fP< _Tp, _Alloc >::end ()\fC [inline]\fP, \fC [noexcept]\fP" Returns a read/write iterator that points one past the last element in the vector\&. Iteration is done in ordinary element order\&. .PP Definition at line 716 of file stl_vector\&.h\&. .PP Referenced by std::vector< _Tp, _Alloc >::vector(), std::vector< _Tp, _Alloc >::crbegin(), std::vector< _Tp, _Alloc >::empty(), std::match_results< _Bi_iter, _Alloc >::end(), std::operator<(), std::operator==(), std::vector< _Tp, _Alloc >::rbegin(), and std::vector< _Tp, _Alloc >::resize()\&. .SS "template> iterator \fBstd::vector\fP< _Tp, _Alloc >::erase (const_iterator __first, const_iterator __last)\fC [inline]\fP" .PP Remove a range of elements\&. .PP \fBParameters\fP .RS 4 \fI__first\fP Iterator pointing to the first element to be erased\&. .br \fI__last\fP Iterator pointing to one past the last element to be erased\&. .RE .PP \fBReturns\fP .RS 4 An iterator pointing to the element pointed to by \fI__last\fP prior to erasing (or end())\&. .RE .PP This function will erase the elements in the range [__first,__last) and shorten the vector accordingly\&. .PP 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\&. .PP Definition at line 1344 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::begin(), and std::vector< _Tp, _Alloc >::cbegin()\&. .SS "template> iterator \fBstd::vector\fP< _Tp, _Alloc >::erase (const_iterator __position)\fC [inline]\fP" .PP Remove element at given position\&. .PP \fBParameters\fP .RS 4 \fI__position\fP Iterator pointing to element to be erased\&. .RE .PP \fBReturns\fP .RS 4 An iterator pointing to the next element (or end())\&. .RE .PP This function will erase the element at the given position and thus shorten the vector by one\&. .PP 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\&. .PP Definition at line 1317 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::begin(), and std::vector< _Tp, _Alloc >::cbegin()\&. .SS "template> const_reference \fBstd::vector\fP< _Tp, _Alloc >::front () const\fC [inline]\fP, \fC [noexcept]\fP" Returns a read-only (constant) reference to the data at the first element of the vector\&. .PP Definition at line 1019 of file stl_vector\&.h\&. .SS "template> reference \fBstd::vector\fP< _Tp, _Alloc >::front ()\fC [inline]\fP, \fC [noexcept]\fP" Returns a read/write reference to the data at the first element of the vector\&. .PP Definition at line 1008 of file stl_vector\&.h\&. .PP Referenced by std::piecewise_constant_distribution< _RealType >::min(), and std::piecewise_linear_distribution< _RealType >::min()\&. .SS "template> allocator_type \fBstd::_Vector_base\fP< _Tp, _Alloc >::get_allocator\fC [inline]\fP, \fC [noexcept]\fP" .PP Get a copy of the memory allocation object\&. .PP Definition at line 245 of file stl_vector\&.h\&. .PP Referenced by std::match_results< _Bi_iter, _Alloc >::get_allocator()\&. .SS "template> template> iterator \fBstd::vector\fP< _Tp, _Alloc >::insert (const_iterator __position, _InputIterator __first, _InputIterator __last)\fC [inline]\fP" .PP Inserts a range into the vector\&. .PP \fBParameters\fP .RS 4 \fI__position\fP A const_iterator into the vector\&. .br \fI__first\fP An input iterator\&. .br \fI__last\fP An input iterator\&. .RE .PP \fBReturns\fP .RS 4 An iterator that points to the inserted data\&. .RE .PP This function will insert copies of the data in the range [__first,__last) into the vector before the location specified by \fIpos\fP\&. .PP 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\&. .PP Definition at line 1266 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::begin(), and std::vector< _Tp, _Alloc >::cbegin()\&. .SS "template \fBvector\fP< _Tp, _Alloc >::iterator vector::insert (const_iterator __position, const value_type & __x)" .PP Inserts given value into vector before specified iterator\&. .PP \fBParameters\fP .RS 4 \fI__position\fP A const_iterator into the vector\&. .br \fI__x\fP Data to be inserted\&. .RE .PP \fBReturns\fP .RS 4 An iterator that points to the inserted data\&. .RE .PP 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\&. .PP Definition at line 118 of file vector\&.tcc\&. .PP References std::begin(), and std::end()\&. .SS "template> iterator \fBstd::vector\fP< _Tp, _Alloc >::insert (const_iterator __position, \fBinitializer_list\fP< value_type > __l)\fC [inline]\fP" .PP Inserts an initializer_list into the vector\&. .PP \fBParameters\fP .RS 4 \fI__position\fP An iterator into the vector\&. .br \fI__l\fP An initializer_list\&. .RE .PP This function will insert copies of the data in the initializer_list \fIl\fP into the vector before the location specified by \fIposition\fP\&. .PP 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\&. .PP Definition at line 1197 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::begin(), and std::vector< _Tp, _Alloc >::cbegin()\&. .SS "template> iterator \fBstd::vector\fP< _Tp, _Alloc >::insert (const_iterator __position, size_type __n, const value_type & __x)\fC [inline]\fP" .PP Inserts a number of copies of given data into the vector\&. .PP \fBParameters\fP .RS 4 \fI__position\fP A const_iterator into the vector\&. .br \fI__n\fP Number of elements to be inserted\&. .br \fI__x\fP Data to be inserted\&. .RE .PP \fBReturns\fP .RS 4 An iterator that points to the inserted data\&. .RE .PP This function will insert a specified number of copies of the given data before the location specified by \fIposition\fP\&. .PP 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\&. .PP Definition at line 1222 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::begin(), and std::vector< _Tp, _Alloc >::cbegin()\&. .SS "template> iterator \fBstd::vector\fP< _Tp, _Alloc >::insert (const_iterator __position, value_type && __x)\fC [inline]\fP" .PP Inserts given rvalue into vector before specified iterator\&. .PP \fBParameters\fP .RS 4 \fI__position\fP A const_iterator into the vector\&. .br \fI__x\fP Data to be inserted\&. .RE .PP \fBReturns\fP .RS 4 An iterator that points to the inserted data\&. .RE .PP 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\&. .PP Definition at line 1180 of file stl_vector\&.h\&. .SS "template> size_type \fBstd::vector\fP< _Tp, _Alloc >::max_size () const\fC [inline]\fP, \fC [noexcept]\fP" Returns the size() of the largest possible vector\&. .PP Definition at line 810 of file stl_vector\&.h\&. .PP References __gnu_cxx::__alloc_traits< _Tp_alloc_type >::max_size()\&. .PP Referenced by std::match_results< _Bi_iter, _Alloc >::max_size()\&. .SS "template \fBvector\fP< _Tp, _Alloc > & vector::operator= (const \fBvector\fP< _Tp, _Alloc > & __x)" .PP Vector assignment operator\&. .PP \fBParameters\fP .RS 4 \fI__x\fP A vector of identical element and allocator types\&. .RE .PP All the elements of \fI__x\fP are copied, but any unused capacity in \fI__x\fP will not be copied\&. .PP Whether the allocator is copied depends on the allocator traits\&. .PP Definition at line 186 of file vector\&.tcc\&. .SS "template> \fBvector\fP& \fBstd::vector\fP< _Tp, _Alloc >::operator= (\fBinitializer_list\fP< value_type > __l)\fC [inline]\fP" .PP Vector list assignment operator\&. .PP \fBParameters\fP .RS 4 \fI__l\fP An initializer_list\&. .RE .PP This function fills a vector with copies of the elements in the initializer list \fI__l\fP\&. .PP Note that the assignment completely changes the vector and that the resulting vector's size is the same as the number of elements assigned\&. .PP Definition at line 617 of file stl_vector\&.h\&. .SS "template> \fBvector\fP& \fBstd::vector\fP< _Tp, _Alloc >::operator= (\fBvector\fP< _Tp, _Alloc > && __x)\fC [inline]\fP, \fC [noexcept]\fP" .PP Vector move assignment operator\&. .PP \fBParameters\fP .RS 4 \fI__x\fP A vector of identical element and allocator types\&. .RE .PP The contents of \fI__x\fP are moved into this vector (without copying, if the allocators permit it)\&. Afterwards \fI__x\fP is a valid, but unspecified vector\&. .PP Whether the allocator is moved depends on the allocator traits\&. .PP Definition at line 596 of file stl_vector\&.h\&. .SS "template> const_reference \fBstd::vector\fP< _Tp, _Alloc >::operator[] (size_type __n) const\fC [inline]\fP, \fC [noexcept]\fP" .PP Subscript access to the data contained in the vector\&. .PP \fBParameters\fP .RS 4 \fI__n\fP The index of the element for which data should be accessed\&. .RE .PP \fBReturns\fP .RS 4 Read-only (constant) reference to data\&. .RE .PP 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()\&.) .PP Definition at line 948 of file stl_vector\&.h\&. .SS "template> reference \fBstd::vector\fP< _Tp, _Alloc >::operator[] (size_type __n)\fC [inline]\fP, \fC [noexcept]\fP" .PP Subscript access to the data contained in the vector\&. .PP \fBParameters\fP .RS 4 \fI__n\fP The index of the element for which data should be accessed\&. .RE .PP \fBReturns\fP .RS 4 Read/write reference to data\&. .RE .PP 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()\&.) .PP Definition at line 930 of file stl_vector\&.h\&. .SS "template> void \fBstd::vector\fP< _Tp, _Alloc >::pop_back ()\fC [inline]\fP, \fC [noexcept]\fP" .PP Removes last element\&. This is a typical stack operation\&. It shrinks the vector by one\&. .PP Note that no data is returned, and if the last element's data is needed, it should be retrieved before pop_back() is called\&. .PP Definition at line 1112 of file stl_vector\&.h\&. .SS "template> void \fBstd::vector\fP< _Tp, _Alloc >::push_back (const value_type & __x)\fC [inline]\fP" .PP Add data to the end of the vector\&. .PP \fBParameters\fP .RS 4 \fI__x\fP Data to be added\&. .RE .PP 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\&. .PP Definition at line 1074 of file stl_vector\&.h\&. .SS "template> \fBconst_reverse_iterator\fP \fBstd::vector\fP< _Tp, _Alloc >::rbegin () const\fC [inline]\fP, \fC [noexcept]\fP" Returns a read-only (constant) reverse iterator that points to the last element in the vector\&. Iteration is done in reverse element order\&. .PP Definition at line 743 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::end()\&. .SS "template> \fBreverse_iterator\fP \fBstd::vector\fP< _Tp, _Alloc >::rbegin ()\fC [inline]\fP, \fC [noexcept]\fP" Returns a read/write reverse iterator that points to the last element in the vector\&. Iteration is done in reverse element order\&. .PP Definition at line 734 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::end()\&. .SS "template> \fBconst_reverse_iterator\fP \fBstd::vector\fP< _Tp, _Alloc >::rend () const\fC [inline]\fP, \fC [noexcept]\fP" 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\&. .PP Definition at line 761 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::begin()\&. .SS "template> \fBreverse_iterator\fP \fBstd::vector\fP< _Tp, _Alloc >::rend ()\fC [inline]\fP, \fC [noexcept]\fP" Returns a read/write reverse iterator that points to one before the first element in the vector\&. Iteration is done in reverse element order\&. .PP Definition at line 752 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::begin()\&. .SS "template void vector::reserve (size_type __n)" .PP Attempt to preallocate enough memory for specified number of elements\&. .PP \fBParameters\fP .RS 4 \fI__n\fP Number of elements required\&. .RE .PP \fBExceptions\fP .RS 4 \fIstd::length_error\fP If \fIn\fP exceeds \fCmax_size()\fP\&. .RE .PP 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\&. .PP 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\&. .PP Definition at line 66 of file vector\&.tcc\&. .SS "template> void \fBstd::vector\fP< _Tp, _Alloc >::resize (size_type __new_size)\fC [inline]\fP" .PP Resizes the vector to the specified number of elements\&. .PP \fBParameters\fP .RS 4 \fI__new_size\fP Number of elements the vector should contain\&. .RE .PP 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\&. .PP Definition at line 824 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::size()\&. .PP Referenced by __gnu_parallel::__shrink_and_double()\&. .SS "template> void \fBstd::vector\fP< _Tp, _Alloc >::resize (size_type __new_size, const value_type & __x)\fC [inline]\fP" .PP Resizes the vector to the specified number of elements\&. .PP \fBParameters\fP .RS 4 \fI__new_size\fP Number of elements the vector should contain\&. .br \fI__x\fP Data with which new elements should be populated\&. .RE .PP 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\&. .PP Definition at line 844 of file stl_vector\&.h\&. .PP References std::vector< _Tp, _Alloc >::end(), and std::vector< _Tp, _Alloc >::size()\&. .SS "template> void \fBstd::vector\fP< _Tp, _Alloc >::shrink_to_fit ()\fC [inline]\fP" A non-binding request to reduce capacity() to size()\&. .PP Definition at line 876 of file stl_vector\&.h\&. .SS "template> size_type \fBstd::vector\fP< _Tp, _Alloc >::size () const\fC [inline]\fP, \fC [noexcept]\fP" Returns the number of elements in the vector\&. .PP Definition at line 805 of file stl_vector\&.h\&. .PP Referenced by __gnu_parallel::__shrink(), __gnu_parallel::__shrink_and_double(), std::vector< _Tp, _Alloc >::_M_range_check(), __gnu_parallel::list_partition(), std::discrete_distribution< _IntType >::max(), std::operator==(), std::vector< _Tp, _Alloc >::resize(), std::match_results< _Bi_iter, _Alloc >::size(), and std::regex_traits< _Ch_type >::transform_primary()\&. .SS "template> void \fBstd::vector\fP< _Tp, _Alloc >::swap (\fBvector\fP< _Tp, _Alloc > & __x)\fC [inline]\fP, \fC [noexcept]\fP" .PP Swaps data with another vector\&. .PP \fBParameters\fP .RS 4 \fI__x\fP A vector of the same element and allocator types\&. .RE .PP 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\&. .PP Whether the allocators are swapped depends on the allocator traits\&. .PP Definition at line 1367 of file stl_vector\&.h\&. .PP Referenced by std::match_results< _Bi_iter, _Alloc >::swap()\&. .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.