1050b064fSChristopher Di Bella // -*- C++ -*- 2050b064fSChristopher Di Bella //===----------------------------------------------------------------------===// 3050b064fSChristopher Di Bella // 4050b064fSChristopher Di Bella // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5050b064fSChristopher Di Bella // See https://llvm.org/LICENSE.txt for license information. 6050b064fSChristopher Di Bella // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7050b064fSChristopher Di Bella // 8050b064fSChristopher Di Bella //===----------------------------------------------------------------------===// 9050b064fSChristopher Di Bella 10050b064fSChristopher Di Bella #ifndef _LIBCPP___FUNCTIONAL_DEFAULT_SEARCHER_H 11050b064fSChristopher Di Bella #define _LIBCPP___FUNCTIONAL_DEFAULT_SEARCHER_H 12050b064fSChristopher Di Bella 13050b064fSChristopher Di Bella #include <__algorithm/search.h> 14050b064fSChristopher Di Bella #include <__config> 15101d1e9bSNikolas Klauser #include <__functional/identity.h> 16050b064fSChristopher Di Bella #include <__functional/operations.h> 17050b064fSChristopher Di Bella #include <__iterator/iterator_traits.h> 18ea2206d7SArthur O'Dwyer #include <__utility/pair.h> 19050b064fSChristopher Di Bella 20050b064fSChristopher Di Bella #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 21050b064fSChristopher Di Bella # pragma GCC system_header 22050b064fSChristopher Di Bella #endif 23050b064fSChristopher Di Bella 24050b064fSChristopher Di Bella _LIBCPP_BEGIN_NAMESPACE_STD 25050b064fSChristopher Di Bella 264f15267dSNikolas Klauser #if _LIBCPP_STD_VER >= 17 27050b064fSChristopher Di Bella 28050b064fSChristopher Di Bella // default searcher 29050b064fSChristopher Di Bella template <class _ForwardIterator, class _BinaryPredicate = equal_to<>> 30050b064fSChristopher Di Bella class _LIBCPP_TEMPLATE_VIS default_searcher { 31050b064fSChristopher Di Bella public: 324c198542SLouis Dionne _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 33*9783f28cSLouis Dionne default_searcher(_ForwardIterator __f, _ForwardIterator __l, _BinaryPredicate __p = _BinaryPredicate()) __first_(__f)34050b064fSChristopher Di Bella : __first_(__f), __last_(__l), __pred_(__p) {} 35050b064fSChristopher Di Bella 36050b064fSChristopher Di Bella template <typename _ForwardIterator2> 37*9783f28cSLouis Dionne _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator2, _ForwardIterator2> operator()38*9783f28cSLouis Dionne operator()(_ForwardIterator2 __f, _ForwardIterator2 __l) const { 39101d1e9bSNikolas Klauser auto __proj = __identity(); 40101d1e9bSNikolas Klauser return std::__search_impl(__f, __l, __first_, __last_, __pred_, __proj, __proj); 41050b064fSChristopher Di Bella } 42050b064fSChristopher Di Bella 43050b064fSChristopher Di Bella private: 44050b064fSChristopher Di Bella _ForwardIterator __first_; 45050b064fSChristopher Di Bella _ForwardIterator __last_; 46050b064fSChristopher Di Bella _BinaryPredicate __pred_; 47050b064fSChristopher Di Bella }; 48c2df7076SLouis Dionne _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(default_searcher); 49050b064fSChristopher Di Bella 504f15267dSNikolas Klauser #endif // _LIBCPP_STD_VER >= 17 51050b064fSChristopher Di Bella 52050b064fSChristopher Di Bella _LIBCPP_END_NAMESPACE_STD 53050b064fSChristopher Di Bella 54050b064fSChristopher Di Bella #endif // _LIBCPP___FUNCTIONAL_DEFAULT_SEARCHER_H 55