Files
2025-10-25 03:02:53 +03:00

2.1 KiB

[func.search.default]

22 General utilities library [utilities]

22.10 Function objects [function.objects]

22.10.18 Searchers [func.search]

22.10.18.2 Class template default_searcher [func.search.default]

🔗

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()); templateconstexpr pair<ForwardIterator2, ForwardIterator2>operator()(ForwardIterator2 first, ForwardIterator2 last) const; private: ForwardIterator1 pat_first_; // exposition only ForwardIterator1 pat_last_; // exposition only BinaryPredicate pred_; // exposition only};}

🔗

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

1

#

Effects: Constructs a default_searcher object, initializing pat_first_ with pat_first, pat_last_ with pat_last, andpred_ with pred.

2

#

Throws: Any exception thrown by the copy constructor of BinaryPredicate orForwardIterator1.

🔗

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

3

#

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

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

if i == last, then j == last, otherwise j == next(i, distance(pat_first_, pat_last_)).