[mlir] Improve error message when number of operands and types differ (#118488)
[llvm-project.git] / libcxx / include / __functional / default_searcher.h
blobdb89d10757c1b1fb10d3d67f6c28e1d878db4ead
1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___FUNCTIONAL_DEFAULT_SEARCHER_H
11 #define _LIBCPP___FUNCTIONAL_DEFAULT_SEARCHER_H
13 #include <__algorithm/search.h>
14 #include <__config>
15 #include <__functional/identity.h>
16 #include <__functional/operations.h>
17 #include <__iterator/iterator_traits.h>
18 #include <__utility/pair.h>
20 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
21 # pragma GCC system_header
22 #endif
24 _LIBCPP_BEGIN_NAMESPACE_STD
26 #if _LIBCPP_STD_VER >= 17
28 // default searcher
29 template <class _ForwardIterator, class _BinaryPredicate = equal_to<>>
30 class _LIBCPP_TEMPLATE_VIS default_searcher {
31 public:
32 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
33 default_searcher(_ForwardIterator __f, _ForwardIterator __l, _BinaryPredicate __p = _BinaryPredicate())
34 : __first_(__f), __last_(__l), __pred_(__p) {}
36 template <typename _ForwardIterator2>
37 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator2, _ForwardIterator2>
38 operator()(_ForwardIterator2 __f, _ForwardIterator2 __l) const {
39 auto __proj = __identity();
40 return std::__search_impl(__f, __l, __first_, __last_, __pred_, __proj, __proj);
43 private:
44 _ForwardIterator __first_;
45 _ForwardIterator __last_;
46 _BinaryPredicate __pred_;
48 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(default_searcher);
50 #endif // _LIBCPP_STD_VER >= 17
52 _LIBCPP_END_NAMESPACE_STD
54 #endif // _LIBCPP___FUNCTIONAL_DEFAULT_SEARCHER_H