copy_if
Copy all elements in a given range that test true for a specified condition.
template<class InputIterator, class OutputIterator, class BinaryPredicate>
OutputIterator copy_if(
InputIterator_First,
InputIterator _Last,
BinaryPredicate _Comp
);
Parameters
_First
An input iterator that indicates the start of a range to check for a condition._Last
An input iterator that indicates the end of a range._Comp
The condition to test for. This is provided by a user-defined predicate function object that defines the condition to be satisfied by the element being searched for. A predicate takes a single argument and returns true or false.
Return Value
Returns an iterator that provides a copy of all the elements that fulfill the condition.
Remarks
The template function evaluates:
if (_Comp(*_Dest))
*_Dest++ = *(_First + N))
once for each N in the range [0, _Last - _First), for strictly increasing values of N starting with the lowest value. It then returns _Dest. If _Dest and _First designate regions of storage, _Dest must not be in the range [_First, _Last).
Requirements
Header: <algorithm>
Namespace: std