Path: blob/main/contrib/llvm-project/libcxx/include/__functional/default_searcher.h
35260 views
// -*- C++ -*-1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//89#ifndef _LIBCPP___FUNCTIONAL_DEFAULT_SEARCHER_H10#define _LIBCPP___FUNCTIONAL_DEFAULT_SEARCHER_H1112#include <__algorithm/search.h>13#include <__config>14#include <__functional/identity.h>15#include <__functional/operations.h>16#include <__iterator/iterator_traits.h>17#include <__utility/pair.h>1819#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)20# pragma GCC system_header21#endif2223_LIBCPP_BEGIN_NAMESPACE_STD2425#if _LIBCPP_STD_VER >= 172627// default searcher28template <class _ForwardIterator, class _BinaryPredicate = equal_to<>>29class _LIBCPP_TEMPLATE_VIS default_searcher {30public:31_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX2032default_searcher(_ForwardIterator __f, _ForwardIterator __l, _BinaryPredicate __p = _BinaryPredicate())33: __first_(__f), __last_(__l), __pred_(__p) {}3435template <typename _ForwardIterator2>36_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator2, _ForwardIterator2>37operator()(_ForwardIterator2 __f, _ForwardIterator2 __l) const {38auto __proj = __identity();39return std::__search_impl(__f, __l, __first_, __last_, __pred_, __proj, __proj);40}4142private:43_ForwardIterator __first_;44_ForwardIterator __last_;45_BinaryPredicate __pred_;46};47_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(default_searcher);4849#endif // _LIBCPP_STD_VER >= 175051_LIBCPP_END_NAMESPACE_STD5253#endif // _LIBCPP___FUNCTIONAL_DEFAULT_SEARCHER_H545556