Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / include / __algorithm / ranges_includes.h
blobaa35080c8cfd4b9703faa99540d87d2eb890d477
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-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___ALGORITHM_RANGES_INCLUDES_H
10 #define _LIBCPP___ALGORITHM_RANGES_INCLUDES_H
12 #include <__algorithm/includes.h>
13 #include <__algorithm/make_projected.h>
14 #include <__config>
15 #include <__functional/identity.h>
16 #include <__functional/invoke.h>
17 #include <__functional/ranges_operations.h>
18 #include <__iterator/concepts.h>
19 #include <__iterator/iterator_traits.h>
20 #include <__iterator/projected.h>
21 #include <__ranges/access.h>
22 #include <__ranges/concepts.h>
23 #include <__utility/forward.h>
24 #include <__utility/move.h>
26 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
27 # pragma GCC system_header
28 #endif
30 #if _LIBCPP_STD_VER >= 20
32 _LIBCPP_BEGIN_NAMESPACE_STD
34 namespace ranges {
35 namespace __includes {
37 struct __fn {
38 template <input_iterator _Iter1,
39 sentinel_for<_Iter1> _Sent1,
40 input_iterator _Iter2,
41 sentinel_for<_Iter2> _Sent2,
42 class _Proj1 = identity,
43 class _Proj2 = identity,
44 indirect_strict_weak_order<projected<_Iter1, _Proj1>, projected<_Iter2, _Proj2>> _Comp = ranges::less>
45 _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
46 _Iter1 __first1,
47 _Sent1 __last1,
48 _Iter2 __first2,
49 _Sent2 __last2,
50 _Comp __comp = {},
51 _Proj1 __proj1 = {},
52 _Proj2 __proj2 = {}) const {
53 return std::__includes(
54 std::move(__first1),
55 std::move(__last1),
56 std::move(__first2),
57 std::move(__last2),
58 std::move(__comp),
59 std::move(__proj1),
60 std::move(__proj2));
63 template <input_range _Range1,
64 input_range _Range2,
65 class _Proj1 = identity,
66 class _Proj2 = identity,
67 indirect_strict_weak_order<projected<iterator_t<_Range1>, _Proj1>, projected<iterator_t<_Range2>, _Proj2>>
68 _Comp = ranges::less>
69 _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
70 _Range1&& __range1, _Range2&& __range2, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
71 return std::__includes(
72 ranges::begin(__range1),
73 ranges::end(__range1),
74 ranges::begin(__range2),
75 ranges::end(__range2),
76 std::move(__comp),
77 std::move(__proj1),
78 std::move(__proj2));
82 } // namespace __includes
84 inline namespace __cpo {
85 inline constexpr auto includes = __includes::__fn{};
86 } // namespace __cpo
87 } // namespace ranges
89 _LIBCPP_END_NAMESPACE_STD
91 #endif // _LIBCPP_STD_VER >= 20
93 #endif // _LIBCPP___ALGORITHM_RANGES_INCLUDES_H