PicoBlog

Daily bit(e) of C++ | 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).

Leave a comment

ncG1vNJzZmirmaK8r8DOrZ9nq6WXwLWtwqRlnKedZL1wsMCio7Jlkp7BpnnOn2ScZaOpsae1zZ1krKyUm7avsL6inWZulmk%3D

Lynna Burgamy

Update: 2024-12-04