Daily bit(e) of C++ | std::find, std::find_if, std::find_if_not
Daily bit(e) of C++ ♻️134, Look up elements in a range by value or a predicate using the linear find algorithms: std::find, std::find_if, std::find_if_not.
If you want to look up an element in a range by value or by predicate, the most straightforward options are the three linear find algorithms:
std::find (find element by value)
std::find_if (find element using a positive predicate)
std::find_if_not (find element using a negative predicate)
All three algorithms have parallel (C++17) and range variants (C++20).