共用方式為


forward_list::remove_if

Erases elements from a forward list for which a specified predicate is satisfied.

template<class Predicate>
    void remove_if(Predicate _Pred);

Parameters

Parameter

Description

_Pred

The unary predicate which, if satisfied by an element, results in the deletion of that element from the list.

Remarks

The member function removes from the controlled sequence all elements, designated by the iterator P, for which _Pred(*P) is true.

An exception occurs only if _Pred throws an exception. In that case, the controlled sequence is left in an unspecified state and the exception is rethrown.

Requirements

Header: <forward_list>

Namespace: std

See Also

Reference

forward_list Class