any_of

Returns true when a condition is present at least once in the specified range of elements.

template<class InputIterator, class UnaryPredicate>
    bool any_of(
        InputIterator _First, 
        InputIterator _Last, 
        UnaryPredicate _Comp
    );

Parameters

  • _First
    An input iterator that indicates where to start checking a range of elements for a condition.

  • _Last
    An input iterator that indicates the end of the range of elements to check for a condition.

  • _Comp
    A condition to test for. This is provided by a user-defined predicate function object. The predicate defines the condition to be satisfied by the element being tested. A predicate takes a single argument and returns true or false.

Return Value

Returns true if the condition is detected at least once in the indicated range, false if the condition is never detected.

Remarks

The template function returns true only if, for some N in the range

[0, _Last - _First), the predicate _Comp(*(_First + N)) is true.

Requirements

Header: <algorithm>

Namespace: std

See Also

Reference

none_of

all_of

Standard Template Library