[func.search.default]

# 22 General utilities library [[utilities]](./#utilities)

## 22.10 Function objects [[function.objects]](function.objects#func.search.default)

### 22.10.18 Searchers [[func.search]](func.search#default)

#### 22.10.18.2 Class template default_searcher [func.search.default]

[ð](#lib:default_searcher)

namespace std {template<class ForwardIterator1, class BinaryPredicate = equal_to<>>class default_searcher {public:constexpr default_searcher(ForwardIterator1 pat_first, ForwardIterator1 pat_last,
 BinaryPredicate pred = BinaryPredicate()); template<class ForwardIterator2>constexpr pair<ForwardIterator2, ForwardIterator2>operator()(ForwardIterator2 first, ForwardIterator2 last) const; private: ForwardIterator1 pat_first_; // *exposition only* ForwardIterator1 pat_last_; // *exposition only* BinaryPredicate pred_; // *exposition only*};}

[ð](#lib:default_searcher,constructor)

`constexpr default_searcher(ForwardIterator1 pat_first, ForwardIterator1 pat_last,
                           BinaryPredicate pred = BinaryPredicate());
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15331)

*Effects*: Constructs a default_searcher object, initializing pat_first_ with pat_first, pat_last_ with pat_last, andpred_ with pred[.](#1.sentence-1)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15338)

*Throws*: Any exception thrown by the copy constructor of BinaryPredicate orForwardIterator1[.](#2.sentence-1)

[ð](#lib:operator(),default_searcher)

`template<class ForwardIterator2>
  constexpr pair<ForwardIterator2, ForwardIterator2>
    operator()(ForwardIterator2 first, ForwardIterator2 last) const;
`

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15352)

*Effects*: Returns a pair of iterators i and j such that

- [(3.1)](#3.1)

i == search(first, last, pat_first_, pat_last_, pred_), and

- [(3.2)](#3.2)

if i == last, then j == last,
otherwise j == next(i, distance(pat_first_, pat_last_))[.](#3.sentence-1)
