A.2.1. Algorithms to Find an Object
These algorithms search an input range for a specific value or sequence of values.
Each algorithm provides two overloaded versions. The first version uses equality (==
) operator of the underlying type to compare elements; the second version compares elements using the user-supplied unaryPred
or binaryPred
.
Simple Find Algorithms
These algorithms look for specific values and require input iterators.
find(beg, end, val)find_if(beg, end, unaryPred)find_if_not(beg, end, unaryPred)count(beg, end, val)count_if(beg, end, unaryPred)
find
returns an iterator to the first element in the input range equal to val
. find_if
returns an iterator to the first element for which unaryPred
succeeds; find_if_not
returns an iterator ...
Get C++ Primer, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.