共用方式為


forward_list::erase_after

Removes elements from the forward list after a specified position.

iterator erase_after(const_iterator _Where);
iterator erase_after(const_iterator _First, const_iterator _Last);

Parameters

Parameter

Description

_Where

The position in the target forward list where the element is erased.

_First

The beginning of the range to erase.

_Last

The end of the range to erase.

Return Value

An iterator that designates the first element remaining beyond any elements removed, or forward_list::end if no such element exists.

Remarks

The first member function removes the element of the controlled sequence just after _Where.

The second member function removes the elements of the controlled sequence in the range (_First, _Last) (neither end point is included).

Erasing N elements causes N destructor calls. Reallocation occurs, so iterators and references become invalid for the erased elements.

The member functions never throw an exception.

Requirements

Header: <forward_list>

Namespace: std

See Also

Reference

forward_list Class