template<typename_Tp,typename_Alloc=allocator<_Tp>>template<typename_InputIterator,typename=std::_RequireInputIter<_InputIterator>>voidstd::forward_list<_Tp,_Alloc>::assign(_InputIterator__first,_InputIterator__last)[inline]
Assigns a range to a forward_list.
Parameters__first An input iterator.
__last An input iterator.
This function fills a forward_list with copies of the elements in the range [__first,__last).
Note that the assignment completely changes the forward_list and that the number of elements of the
resulting forward_list is the same as the number of elements assigned.
Referenced by std::forward_list<_Tp,_Alloc>::assign(), and std::forward_list<_Tp,_Alloc>::operator=().
template<typename_Tp,typename_Alloc=allocator<_Tp>>voidstd::forward_list<_Tp,_Alloc>::assign(size_type__n,const_Tp&__val)[inline]
Assigns a given value to a forward_list.
Parameters__n Number of elements to be assigned.
__val Value to be assigned.
This function fills a forward_list with __n copies of the given value. Note that the assignment
completely changes the forward_list, and that the resulting forward_list has __n elements.
template<typename_Tp,typename_Alloc=allocator<_Tp>>voidstd::forward_list<_Tp,_Alloc>::assign(std::initializer_list<_Tp>__il)[inline]
Assigns an initializer_list to a forward_list.
Parameters__il An initializer_list of value_type.
Replace the contents of the forward_list with copies of the elements in the initializer_list __il. This
is linear in il.size().
References std::forward_list<_Tp,_Alloc>::assign().
template<typename_Tp,typename_Alloc=allocator<_Tp>>const_iteratorstd::forward_list<_Tp,_Alloc>::before_begin()const[inline],[noexcept]
Returns a read-only (constant) iterator that points before the first element in the forward_list.
Iteration is done in ordinary element order.
template<typename_Tp,typename_Alloc=allocator<_Tp>>iteratorstd::forward_list<_Tp,_Alloc>::before_begin()[inline],[noexcept]
Returns a read/write iterator that points before the first element in the forward_list. Iteration is done
in ordinary element order.
template<typename_Tp,typename_Alloc=allocator<_Tp>>const_iteratorstd::forward_list<_Tp,_Alloc>::begin()const[inline],[noexcept]
Returns a read-only (constant) iterator that points to the first element in the forward_list. Iteration
is done in ordinary element order.
template<typename_Tp,typename_Alloc=allocator<_Tp>>iteratorstd::forward_list<_Tp,_Alloc>::begin()[inline],[noexcept]
Returns a read/write iterator that points to the first element in the forward_list. Iteration is done in
ordinary element order.
template<typename_Tp,typename_Alloc=allocator<_Tp>>const_iteratorstd::forward_list<_Tp,_Alloc>::cbefore_begin()const[inline],[noexcept]
Returns a read-only (constant) iterator that points before the first element in the forward_list.
Iteration is done in ordinary element order.
Referenced by std::forward_list<_Tp,_Alloc>::emplace_front(), and std::forward_list<_Tp,_Alloc>::push_front().
template<typename_Tp,typename_Alloc=allocator<_Tp>>const_iteratorstd::forward_list<_Tp,_Alloc>::cbegin()const[inline],[noexcept]
Returns a read-only (constant) iterator that points to the first element in the forward_list. Iteration
is done in ordinary element order.
template<typename_Tp,typename_Alloc=allocator<_Tp>>const_iteratorstd::forward_list<_Tp,_Alloc>::cend()const[inline],[noexcept]
Returns a read-only (constant) iterator that points one past the last element in the forward_list.
Iteration is done in ordinary element order.
template<typename_Tp,typename_Alloc=allocator<_Tp>>voidstd::forward_list<_Tp,_Alloc>::clear()[inline],[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=allocator<_Tp>>template<typename..._Args>iteratorstd::forward_list<_Tp,_Alloc>::emplace_after(const_iterator__pos,_Args&&...__args)[inline]
Constructs object in forward_list after the specified iterator.
Parameters__pos A const_iterator into the forward_list.
__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)...) after the
specified location. Due to the nature of a forward_list this operation can be done in constant time, and
does not invalidate iterators and references.
template<typename_Tp,typename_Alloc=allocator<_Tp>>template<typename..._Args>referencestd::forward_list<_Tp,_Alloc>::emplace_front(_Args&&...__args)[inline]
Constructs object in forward_list at the front of the list.
Parameters__args Arguments.
This function will insert an object of type Tp constructed with Tp(std::forward<Args>(args)...) at the
front of the list Due to the nature of a forward_list this operation can be done in constant time, and
does not invalidate iterators and references.
References std::forward_list<_Tp,_Alloc>::cbefore_begin(), and std::forward_list<_Tp,_Alloc>::front().
template<typename_Tp,typename_Alloc=allocator<_Tp>>boolstd::forward_list<_Tp,_Alloc>::empty()const[inline],[noexcept]
Returns true if the forward_list is empty. (Thus begin() would equal end().)
template<typename_Tp,typename_Alloc=allocator<_Tp>>const_iteratorstd::forward_list<_Tp,_Alloc>::end()const[inline],[noexcept]
Returns a read-only iterator that points one past the last element in the forward_list. Iteration is done
in ordinary element order.
template<typename_Tp,typename_Alloc=allocator<_Tp>>iteratorstd::forward_list<_Tp,_Alloc>::end()[inline],[noexcept]
Returns a read/write iterator that points one past the last element in the forward_list. Iteration is
done in ordinary element order.
template<typename_Tp,typename_Alloc=allocator<_Tp>>iteratorstd::forward_list<_Tp,_Alloc>::erase_after(const_iterator__pos)[inline]
Removes the element pointed to by the iterator following pos.
Parameters__pos Iterator pointing before element to be erased.
Returns
An iterator pointing to the element following the one that was erased, or end() if no such element
exists.
This function will erase the element at the given position and thus shorten the forward_list by one.
Due to the nature of a forward_list this operation can be done in constant time, and only invalidates
iterators/references to the element being removed. 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.
template<typename_Tp,typename_Alloc=allocator<_Tp>>iteratorstd::forward_list<_Tp,_Alloc>::erase_after(const_iterator__pos,const_iterator__last)[inline]
Remove a range of elements.
Parameters__pos Iterator pointing before the first element to be erased.
__last Iterator pointing to one past the last element to be erased.
Returns
@ __last.
This function will erase the elements in the range (__pos,__last) and shorten the forward_list
accordingly.
This operation is linear time in the size of the range and only invalidates iterators/references to the
element being removed. 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.
template<typename_Tp,typename_Alloc=allocator<_Tp>>referencestd::forward_list<_Tp,_Alloc>::front()[inline]
Returns a read/write reference to the data at the first element of the forward_list.
Referenced by std::forward_list<_Tp,_Alloc>::emplace_front().
template<typename_Tp,typename_Alloc=allocator<_Tp>>const_referencestd::forward_list<_Tp,_Alloc>::front()const[inline]
Returns a read-only (constant) reference to the data at the first element of the forward_list.
template<typename_Tp,typename_Alloc=allocator<_Tp>>allocator_typestd::forward_list<_Tp,_Alloc>::get_allocator()const[inline],[noexcept]
Get a copy of the memory allocation object.
template<typename_Tp,typename_Alloc>template<typename_InputIterator,typename>forward_list<_Tp,_Alloc>::iteratorforward_list::insert_after(const_iterator__pos,_InputIterator__first,_InputIterator__last)
Inserts a range into the forward_list.
Parameters__pos An iterator into the forward_list.
__first An input iterator.
__last An input iterator.
Returns
An iterator pointing to the last inserted element or __pos if __first == __last.
This function will insert copies of the data in the range [__first,__last) into the forward_list after
the location specified by __pos.
This operation is linear in the number of elements inserted and does not invalidate iterators and
references.
template<typename_Tp,typename_Alloc=allocator<_Tp>>iteratorstd::forward_list<_Tp,_Alloc>::insert_after(const_iterator__pos,const_Tp&__val)[inline]
Inserts given value into forward_list after specified iterator.
Parameters__pos An iterator into the forward_list.
__val Data to be inserted.
Returns
An iterator that points to the inserted data.
This function will insert a copy of the given value after the specified location. Due to the nature of a
forward_list this operation can be done in constant time, and does not invalidate iterators and
references.
Referenced by std::forward_list<_Tp,_Alloc>::insert_after().
template<typename_Tp,typename_Alloc>forward_list<_Tp,_Alloc>::iteratorforward_list::insert_after(const_iterator__pos,size_type__n,const_Tp&__val)
Inserts a number of copies of given data into the forward_list.
Parameters__pos An iterator into the forward_list.
__n Number of elements to be inserted.
__val Data to be inserted.
Returns
An iterator pointing to the last inserted copy of val or pos if n == 0.
This function will insert a specified number of copies of the given data after the location specified by
pos.
This operation is linear in the number of elements inserted and does not invalidate iterators and
references.
template<typename_Tp,typename_Alloc=allocator<_Tp>>iteratorstd::forward_list<_Tp,_Alloc>::insert_after(const_iterator__pos,std::initializer_list<_Tp>__il)[inline]
Inserts the contents of an initializer_list into forward_list after the specified iterator.
Parameters__pos An iterator into the forward_list.
__il An initializer_list of value_type.
Returns
An iterator pointing to the last inserted element or __pos if __il is empty.
This function will insert copies of the data in the initializer_list __il into the forward_list before
the location specified by __pos.
This operation is linear in the number of elements inserted and does not invalidate iterators and
references.
References std::forward_list<_Tp,_Alloc>::insert_after().
template<typename_Tp,typename_Alloc=allocator<_Tp>>size_typestd::forward_list<_Tp,_Alloc>::max_size()const[inline],[noexcept]
Returns the largest possible number of elements of forward_list.
References __gnu_cxx::__alloc_traits<_Alloc,typename>::max_size().
template<typename_Tp,typename_Alloc=allocator<_Tp>>voidstd::forward_list<_Tp,_Alloc>::merge(forward_list<_Tp,_Alloc>&&__list)[inline]
Merge sorted lists.
Parameters__list Sorted list to merge.
Assumes that both list and this list are sorted according to operator<(). Merges elements of __list into
this list in sorted order, leaving __list empty when complete. Elements in this list precede elements in
__list that are equal.
References std::forward_list<_Tp,_Alloc>::merge(), and std::move().
Referenced by std::forward_list<_Tp,_Alloc>::merge().
template<typename_Tp,typename_Alloc>template<typename_Comp>voidforward_list::merge(forward_list<_Tp,_Alloc>&&__list,_Comp__comp)
Merge sorted lists according to comparison function.
Parameters__list Sorted list to merge.
__comp Comparison function defining sort order.
Assumes that both __list and this list are sorted according to comp. Merges elements of __list into this
list in sorted order, leaving __list empty when complete. Elements in this list precede elements in
__list that are equivalent according to comp().
References std::__addressof(), and std::move().
template<typename_Tp,typename_Alloc>forward_list<_Tp,_Alloc>&forward_list::operator=(constforward_list<_Tp,_Alloc>&__list)
The forward_list assignment operator.
Parameters__list A forward_list of identical element and allocator types.
All the elements of __list are copied.
Whether the allocator is copied depends on the allocator traits.
References std::__addressof().
template<typename_Tp,typename_Alloc=allocator<_Tp>>forward_list&std::forward_list<_Tp,_Alloc>::operator=(forward_list<_Tp,_Alloc>&&__list)[inline],[noexcept]
The forward_list move assignment operator.
Parameters__list A forward_list of identical element and allocator types.
The contents of __list are moved into this forward_list (without copying, if the allocators permit it).
Afterwards __list is a valid, but unspecified forward_list
Whether the allocator is moved depends on the allocator traits.
References std::move().
template<typename_Tp,typename_Alloc=allocator<_Tp>>forward_list&std::forward_list<_Tp,_Alloc>::operator=(std::initializer_list<_Tp>__il)[inline]
The forward_list initializer list assignment operator.
Parameters__il An initializer_list of value_type.
Replace the contents of the forward_list with copies of the elements in the initializer_list __il. This
is linear in __il.size().
References std::forward_list<_Tp,_Alloc>::assign().
template<typename_Tp,typename_Alloc=allocator<_Tp>>voidstd::forward_list<_Tp,_Alloc>::pop_front()[inline]
Removes first element. This is a typical stack operation. It shrinks the forward_list by one. Due to the
nature of a forward_list this operation can be done in constant time, and only invalidates
iterators/references to the element being removed.
Note that no data is returned, and if the first element's data is needed, it should be retrieved before
pop_front() is called.
template<typename_Tp,typename_Alloc=allocator<_Tp>>voidstd::forward_list<_Tp,_Alloc>::push_front(const_Tp&__val)[inline]
Add data to the front of the forward_list.
Parameters__val Data to be added.
This is a typical stack operation. The function creates an element at the front of the forward_list and
assigns the given data to it. Due to the nature of a forward_list this operation can be done in constant
time, and does not invalidate iterators and references.
References std::forward_list<_Tp,_Alloc>::cbefore_begin().
template<typename_Tp,typename_Alloc>autoforward_list::remove(const_Tp&__val)
Remove all elements equal to value.
Parameters__val The value to remove.
Removes every element in the list equal to __val. Remaining elements stay in list order. 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=allocator<_Tp>>template<typename_Pred>__remove_return_typestd::forward_list<_Tp,_Alloc>::remove_if(_Pred__pred)
Remove all elements satisfying a predicate.
Parameters__pred Unary predicate function or object.
Removes every element in the list for which the predicate returns true. Remaining elements stay in list
order. 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>voidforward_list::resize(size_type__sz)
Resizes the forward_list to the specified number of elements.
Parameters__sz Number of elements the forward_list should contain.
This function will resize the forward_list to the specified number of elements. If the number is smaller
than the forward_list's current number of elements the forward_list is truncated, otherwise the
forward_list is extended and the new elements are default constructed.
template<typename_Tp,typename_Alloc>voidforward_list::resize(size_type__sz,constvalue_type&__val)
Resizes the forward_list to the specified number of elements.
Parameters__sz Number of elements the forward_list should contain.
__val Data with which new elements should be populated.
This function will resize the forward_list to the specified number of elements. If the number is smaller
than the forward_list's current number of elements the forward_list is truncated, otherwise the
forward_list is extended and new elements are populated with given data.
template<typename_Tp,typename_Alloc=allocator<_Tp>>voidstd::forward_list<_Tp,_Alloc>::reverse()[inline],[noexcept]
Reverse the elements in list. Reverse the order of elements in the list in linear time.
template<typename_Tp,typename_Alloc=allocator<_Tp>>voidstd::forward_list<_Tp,_Alloc>::sort()[inline]
Sort the elements of the list. Sorts the elements of this list in NlogN time. Equivalent elements remain
in list order.
References std::forward_list<_Tp,_Alloc>::sort().
Referenced by std::forward_list<_Tp,_Alloc>::sort().
template<typename_Tp,class_Alloc>template<typename_Comp>voidforward_list::sort(_Comp__comp)
Sort the forward_list using a comparison function. Sorts the elements of this list in NlogN time.
Equivalent elements remain in list order.
template<typename_Tp,typename_Alloc=allocator<_Tp>>voidstd::forward_list<_Tp,_Alloc>::splice_after(const_iterator__pos,forward_list<_Tp,_Alloc>&&,const_iterator__before,const_iterator__last)[inline],[noexcept]
Insert range from another forward_list.
Parameters__pos Iterator referencing the element to insert after.
__list Source list.
__before Iterator referencing before the start of range in list.
__last Iterator referencing the end of range in list.
Removes elements in the range (__before,__last) and inserts them after __pos in constant time.
Undefined if __pos is in (__before,__last).
template<typename_Tp,typename_Alloc=allocator<_Tp>>voidstd::forward_list<_Tp,_Alloc>::splice_after(const_iterator__pos,forward_list<_Tp,_Alloc>&&__list)[inline],[noexcept]
Insert contents of another forward_list.
Parameters__pos Iterator referencing the element to insert after.
__list Source list.
The elements of list are inserted in constant time after the element referenced by pos. list becomes an
empty list.
Requires this != x.
template<typename_Tp,typename_Alloc>voidforward_list::splice_after(const_iterator__pos,forward_list<_Tp,_Alloc>&&__list,const_iterator__i)[noexcept]
Insert element from another forward_list.
Parameters__pos Iterator referencing the element to insert after.
__list Source list.
__i Iterator referencing the element before the element to move.
Removes the element in list list referenced by i and inserts it into the current list after pos.
template<typename_Tp,typename_Alloc=allocator<_Tp>>voidstd::forward_list<_Tp,_Alloc>::splice_after(const_iterator__pos,forward_list<_Tp,_Alloc>&,const_iterator__before,const_iterator__last)[inline],[noexcept]
Insert range from another forward_list.
Parameters__pos Iterator referencing the element to insert after.
__list Source list.
__before Iterator referencing before the start of range in list.
__last Iterator referencing the end of range in list.
Removes elements in the range (__before,__last) and inserts them after __pos in constant time.
Undefined if __pos is in (__before,__last).
template<typename_Tp,typename_Alloc=allocator<_Tp>>voidstd::forward_list<_Tp,_Alloc>::swap(forward_list<_Tp,_Alloc>&__list)[inline],[noexcept]
Swaps data with another forward_list.
Parameters__list A forward_list of the same element and allocator types.
This exchanges the elements between two lists in constant time. Note that the global std::swap() function
is specialized such that std::swap(l1,l2) will feed to this function.
Whether the allocators are swapped depends on the allocator traits.
References std::swap().
template<typename_Tp,typename_Alloc=allocator<_Tp>>__remove_return_typestd::forward_list<_Tp,_Alloc>::unique()[inline]
Remove consecutive duplicate elements. For each consecutive set of elements with the same value, remove
all but the first one. Remaining elements stay in list order. 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.
References std::forward_list<_Tp,_Alloc>::unique().
Referenced by std::forward_list<_Tp,_Alloc>::unique().
template<typename_Tp,typename_Alloc=allocator<_Tp>>template<typename_BinPred>__remove_return_typestd::forward_list<_Tp,_Alloc>::unique(_BinPred__binary_pred)
Remove consecutive elements satisfying a predicate.
Parameters__binary_pred Binary predicate function or object.
For each consecutive set of elements [first,last) that satisfy predicate(first,i) where i is an iterator
in [first,last), remove all but the first one. Remaining elements stay in list order. 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.