Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

find


Algorithm

Summary

Finds an occurrence of value in a sequence.

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

None

Synopsis

#include <algorithm>
template <class InputIterator, class T>
  InputIterator find(InputIterator first, 
                      InputIterator last,
                      const T& value);

Description

The find algorithm lets you search for the first occurrence of a particular value in a sequence. find returns the first iterator i in the range [first, last) for which the following condition holds:

*i == value.

If find does not find a match for value, it returns the iterator last.

Type T must be EqualityComparable.

Complexity

find performs at most last-first comparisons.

Example

Program Output

Warnings

If your compiler does not support default template parameters, then you always need to supply the Allocator template argument. For instance, you have to write:

vector<int,allocator<int> >

instead of:

vector<int>

If your compiler does not support namespaces, then you do not need the using declaration for std.

See Also

adjacent_find, find_first_of, find_if



Previous fileTop of documentContentsIndexNext file
©Copyright 1998, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.
OEM Release, June 1998