std::list<T,Allocator>::erase From cppreference.com <cpp |container |list std::list (1) iterator erase(iterator pos); (until C++11) iterator erase(const_iterator pos); (since C++11) (2) iterator erase(iterator first, iterator last); ...
Iterator invalidation OperationsInvalidated All read only operationsNever. swap,std::swapend() clear,operator=,assignAlways. reserve,shrink_to_fitIf the vector changed capacity, all of them. If not, none. eraseErased elements and all elements after them (includingend()). ...
insert_iter_initializer_list.pass.cpp insert_iter_iter.pass.cpp insert_rvalue.pass.cpp insert_size_value.pass.cpp insert_value.pass.cpp pop_back.invalidation.pass.cpp pop_back.pass.cpp pop_front.invalidation.pass.cpp pop_front.pass.cpp push_back.pass.cpp push_back_rvalue.pas...
insert_iter_initializer_list.pass.cpp insert_iter_iter.pass.cpp insert_rvalue.pass.cpp insert_size_value.pass.cpp insert_value.pass.cpp pop_back.invalidation.pass.cpp pop_back.pass.cpp pop_front.invalidation.pass.cpp pop_front.pass.cpp push_back.pass.cpp push_back_rvalue.pas...
Iterator invalidation OperationsInvalidated All read only operations,swap,std::swapNever clear,rehash,reserve,operator=Always insert,emplace,emplace_hint,operator[]Only if causes rehash eraseOnly to the element erased Notes The swap functions do not invalidate any of the iterators inside the container,...
std::list template<class...Args> iterator emplace(const_iterator pos, Args&&...args); (since C++11) Inserts a new element into the container directly beforepos. The element is constructed throughstd::allocator_traits::construct, which uses placement-new to construct the element in-place at ...
pos-iterator to the element to remove first, last-range of elements to remove key-key value of the elements to remove x-a value of any type that can be transparently compared with a key denoting the elements to remove Return value
Information on iterator invalidation is copied fromhere Parameters rg-acontainer compatible range, that is, aninput_rangewhose elements are convertible toT Return value (none) Complexity N+M·log(M), whereNissize()before the operation andMisranges::distance(rg). ...
iterator insert(const_iterator hint, value_type&&value); (4)(since C++11) template<classInputIt> voidinsert(InputIt first, InputIt last); (5)(since C++11) voidinsert(std::initializer_list<value_type>ilist); (6)(since C++11) insert_return_type insert(node_type&&nh); ...
pos-iterator to the element to remove first, last-range of elements to remove key-key value of the elements to remove x-a value of any type that can be transparently compared with a key denoting the elements to remove Return value