Книга: Standard Template Library Programmer
find
Разделы на этой странице:
find
Category: algorithms
Component type: function
Prototype
template<class InputIterator, class EqualityComparable>
InputIterator find(InputIterator first, InputIterator last, const EqualityComparable& value);
Description
Returns the first iterator i in the range [first, last) such that *i == value. Returns last if no such iterator exists.
Definition
Defined in the standard header algorithm, and in the nonstandard backward-compatibility header algo.h.
Requirements on types
• EqualityComparable is a model of EqualityComparable.
• InputIterator is a model of InputIterator.
• Equality is defined between objects of type EqualityComparable and objects of InputIterator's value type.
Preconditions
• [first, last) is a valid range.
Complexity
Linear: at most last – first comparisons for equality.
Example
list <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);
See also
find_if.
- Finding Files by Searching with find
- Finding Files from an Index with locate
- 6.4.5. Finding the Owner
- 6.4.6. Finding the Copies
- 13.2.3 Finding Free Blocks Quickly
- 14.4.4. Поиск по дереву и использование возвращенного указателя: tfind() и tsearch()
- Функция find_vma()
- Функция find_vma_prev()
- Функция find_vma_intersection()
- 1.4.3. Отображение содержимого окна Finder
- 18. Test equipment and fault-finding
- find_first_of