Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / include / __functional / ranges_operations.h
blobc344fc38f98ddd9b9ba4d2f8e45b15fc362259c9
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_RANGES_OPERATIONS_H
11 #define _LIBCPP___FUNCTIONAL_RANGES_OPERATIONS_H
13 #include <__concepts/equality_comparable.h>
14 #include <__concepts/totally_ordered.h>
15 #include <__config>
16 #include <__type_traits/integral_constant.h>
17 #include <__type_traits/predicate_traits.h>
18 #include <__utility/forward.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 >= 20
28 namespace ranges {
30 struct equal_to {
31 template <class _Tp, class _Up>
32 requires equality_comparable_with<_Tp, _Up>
33 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
34 noexcept(noexcept(bool(_VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u)))) {
35 return _VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u);
38 using is_transparent = void;
41 struct not_equal_to {
42 template <class _Tp, class _Up>
43 requires equality_comparable_with<_Tp, _Up>
44 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
45 noexcept(noexcept(bool(!(_VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u))))) {
46 return !(_VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u));
49 using is_transparent = void;
52 struct less {
53 template <class _Tp, class _Up>
54 requires totally_ordered_with<_Tp, _Up>
55 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
56 noexcept(noexcept(bool(_VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u)))) {
57 return _VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u);
60 using is_transparent = void;
63 struct less_equal {
64 template <class _Tp, class _Up>
65 requires totally_ordered_with<_Tp, _Up>
66 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
67 noexcept(noexcept(bool(!(_VSTD::forward<_Up>(__u) < _VSTD::forward<_Tp>(__t))))) {
68 return !(_VSTD::forward<_Up>(__u) < _VSTD::forward<_Tp>(__t));
71 using is_transparent = void;
74 struct greater {
75 template <class _Tp, class _Up>
76 requires totally_ordered_with<_Tp, _Up>
77 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
78 noexcept(noexcept(bool(_VSTD::forward<_Up>(__u) < _VSTD::forward<_Tp>(__t)))) {
79 return _VSTD::forward<_Up>(__u) < _VSTD::forward<_Tp>(__t);
82 using is_transparent = void;
85 struct greater_equal {
86 template <class _Tp, class _Up>
87 requires totally_ordered_with<_Tp, _Up>
88 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
89 noexcept(noexcept(bool(!(_VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u))))) {
90 return !(_VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u));
93 using is_transparent = void;
96 } // namespace ranges
98 template <class _Lhs, class _Rhs>
99 struct __is_trivial_equality_predicate<ranges::equal_to, _Lhs, _Rhs> : true_type {};
101 #endif // _LIBCPP_STD_VER >= 20
103 _LIBCPP_END_NAMESPACE_STD
105 #endif // _LIBCPP___FUNCTIONAL_RANGES_OPERATIONS_H