C++ std::forward_list Methods


Example

Method nameDefinition
operator=assigns values to the container
assignassigns values to the container
get_allocatorreturns the associated allocator
------------
Element access
frontaccess the first element
------------
Iterators
before_beginreturns an iterator to the element before beginning
cbefore_beginreturns a constant iterator to the element before beginning
beginreturns an iterator to the beginning
cbeginreturns a const iterator to the beginning
endreturns an iterator to the end
cendreturns a iterator to the end
Capacity
emptychecks whether the container is empty
max_sizereturns the maximum possible number of elements
Modifiers
clearclears the contents
insert_afterinserts elements after an element
emplace_afterconstructs elements in-place after an element
erase_aftererases an element after an element
push_frontinserts an element to the beginning
emplace_frontconstructs an element in-place at the beginning
pop_frontremoves the first element
resizechanges the number of elements stored
swapswaps the contents
Operations
mergemerges two sorted lists
splice_aftermoves elements from another forward_list
removeremoves elements satisfying specific criteria
remove_ifremoves elements satisfying specific criteria
reversereverses the order of the elements
uniqueremoves consecutive duplicate elements
sortsorts the elements