A.2.2. Other Read-Only Algorithms

These algorithms require input iterators for their first two arguments.

The equal and mismatch algorithms also take an additional input iterator that denotes the start of a second range. They also provide 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.

for_each(beg, end, unaryOp)

Applies the callable object (§ 10.3.2, p. 388) unaryOp to each element in its input range. The return value from unaryOp (if any) is ignored. If the iterators allow writing to elements through the dereference operator, then unaryOp may modify the elements.

mismatch(beg1, end1, beg2) ...

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.