FindFirst

Return the first element of a vector matching a predicate.

Synopsis

Declared in <util/vector.h>

template<
    typename V,
    typename L>
std::optional<V>
FindFirst(
    std::vector<V> const& vec,
    L const fnc);

Return Value

The first matching element, or std::nullopt when none match.

Parameters

NameDescription
vecThe vector to search.
fncThe predicate invoked on each element until it returns true.