find
Prototypetemplate<class InputIterator, class EqualityComparable>
InputIterator find(InputIterator first, InputIterator last,
const EqualityComparable& value);
DescriptionReturns the first iterator DefinitionDefined in the standard header algorithm, and in the nonstandard backward-compatibility header algo.h. Requirements on types
Preconditions
ComplexityLinear: at most ExampleList<int> L;
L.push_back(3);
L.push_back(1);
L.push_back(7);
List<int>::iterator result = find(L.begin(), L.end(), 7);
assert(result == L.end() || *result == 7);
NotesSee also |