Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:51

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___FUNCTIONAL_DEFAULT_SEARCHER_H
0011 #define _LIBCPP___FUNCTIONAL_DEFAULT_SEARCHER_H
0012 
0013 #include <__algorithm/search.h>
0014 #include <__config>
0015 #include <__functional/identity.h>
0016 #include <__functional/operations.h>
0017 #include <__iterator/iterator_traits.h>
0018 #include <__utility/pair.h>
0019 
0020 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0021 #  pragma GCC system_header
0022 #endif
0023 
0024 _LIBCPP_BEGIN_NAMESPACE_STD
0025 
0026 #if _LIBCPP_STD_VER >= 17
0027 
0028 // default searcher
0029 template <class _ForwardIterator, class _BinaryPredicate = equal_to<>>
0030 class _LIBCPP_TEMPLATE_VIS default_searcher {
0031 public:
0032   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
0033   default_searcher(_ForwardIterator __f, _ForwardIterator __l, _BinaryPredicate __p = _BinaryPredicate())
0034       : __first_(__f), __last_(__l), __pred_(__p) {}
0035 
0036   template <typename _ForwardIterator2>
0037   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator2, _ForwardIterator2>
0038   operator()(_ForwardIterator2 __f, _ForwardIterator2 __l) const {
0039     auto __proj = __identity();
0040     return std::__search_impl(__f, __l, __first_, __last_, __pred_, __proj, __proj);
0041   }
0042 
0043 private:
0044   _ForwardIterator __first_;
0045   _ForwardIterator __last_;
0046   _BinaryPredicate __pred_;
0047 };
0048 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(default_searcher);
0049 
0050 #endif // _LIBCPP_STD_VER >= 17
0051 
0052 _LIBCPP_END_NAMESPACE_STD
0053 
0054 #endif // _LIBCPP___FUNCTIONAL_DEFAULT_SEARCHER_H