Partilhar via


all_of

Returns true when a condition is present at each element in the given range.

template<class InputIterator, class Predicate>
    bool all_of(
        InputIterator _First, 
        InputIterator _Last, 
        BinaryPredicate _Comp
    );

Parameters

  • _First
    An input iterator that indicates where to start to check for a condition. The iterator marks where a range of elements starts.

  • _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 a user-defined predicate function object that defines the condition to be satisfied by an element being checked. A predicate takes a single argument and returns true or false.

Return Value

Returns true if the condition is detected at each element in the indicated range, and false if the condition is not detected at least one time.

Remarks

The template function returns true only if, for each N in the range [0, _Last - _First), the predicate _Comp(*(_First + N)) is true.

Requirements

Header: <algorithm>

Namespace: std

See Also

Reference

any_of

none_of

Standard Template Library

Other Resources

<algorithm> Members