aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxx/include/compare
blob: b0c61e786d7841fa9bddd470ff3b01f70bc0ed3c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
// -*- C++ -*- 
//===-------------------------- compare -----------------------------------===// 
// 
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// 
//===----------------------------------------------------------------------===// 
 
#ifndef _LIBCPP_COMPARE 
#define _LIBCPP_COMPARE 
 
/* 
    compare synopsis 
 
namespace std { 
  // [cmp.categories], comparison category types 
  class partial_ordering; 
  class weak_ordering; 
  class strong_ordering; 
 
  // named comparison functions 
  constexpr bool is_eq  (partial_ordering cmp) noexcept { return cmp == 0; } 
  constexpr bool is_neq (partial_ordering cmp) noexcept { return cmp != 0; } 
  constexpr bool is_lt  (partial_ordering cmp) noexcept { return cmp < 0; } 
  constexpr bool is_lteq(partial_ordering cmp) noexcept { return cmp <= 0; } 
  constexpr bool is_gt  (partial_ordering cmp) noexcept { return cmp > 0; } 
  constexpr bool is_gteq(partial_ordering cmp) noexcept { return cmp >= 0; } 
 
  // [cmp.common], common comparison category type 
  template<class... Ts> 
  struct common_comparison_category { 
    using type = see below; 
  }; 
  template<class... Ts> 
    using common_comparison_category_t = typename common_comparison_category<Ts...>::type; 
 
  // [cmp.concept], concept three_way_comparable 
  template<class T, class Cat = partial_ordering> 
    concept three_way_comparable = see below; 
  template<class T, class U, class Cat = partial_ordering> 
    concept three_way_comparable_with = see below; 
 
  // [cmp.result], result of three-way comparison 
  template<class T, class U = T> struct compare_three_way_result; 
 
  template<class T, class U = T> 
    using compare_three_way_result_t = typename compare_three_way_result<T, U>::type; 
 
  // [comparisons.three.way], class compare_three_way 
  struct compare_three_way; // C++20 
 
  // [cmp.alg], comparison algorithms 
  template<class T> constexpr strong_ordering strong_order(const T& a, const T& b); 
  template<class T> constexpr weak_ordering weak_order(const T& a, const T& b); 
  template<class T> constexpr partial_ordering partial_order(const T& a, const T& b); 
 
  // [cmp.partialord], Class partial_ordering 
  class partial_ordering { 
  public: 
    // valid values 
    static const partial_ordering less; 
    static const partial_ordering equivalent; 
    static const partial_ordering greater; 
    static const partial_ordering unordered; 
 
    // comparisons 
    friend constexpr bool operator==(partial_ordering v, unspecified) noexcept; 
    friend constexpr bool operator==(partial_ordering v, partial_ordering w) noexcept = default; 
    friend constexpr bool operator< (partial_ordering v, unspecified) noexcept; 
    friend constexpr bool operator> (partial_ordering v, unspecified) noexcept; 
    friend constexpr bool operator<=(partial_ordering v, unspecified) noexcept; 
    friend constexpr bool operator>=(partial_ordering v, unspecified) noexcept; 
    friend constexpr bool operator< (unspecified, partial_ordering v) noexcept; 
    friend constexpr bool operator> (unspecified, partial_ordering v) noexcept; 
    friend constexpr bool operator<=(unspecified, partial_ordering v) noexcept; 
    friend constexpr bool operator>=(unspecified, partial_ordering v) noexcept; 
    friend constexpr partial_ordering operator<=>(partial_ordering v, unspecified) noexcept; 
    friend constexpr partial_ordering operator<=>(unspecified, partial_ordering v) noexcept; 
  }; 
 
  // [cmp.weakord], Class weak_ordering 
  class weak_ordering { 
  public: 
    // valid values 
    static const weak_ordering less; 
    static const weak_ordering equivalent; 
    static const weak_ordering greater; 
 
    // conversions 
    constexpr operator partial_ordering() const noexcept; 
 
    // comparisons 
    friend constexpr bool operator==(weak_ordering v, unspecified) noexcept; 
    friend constexpr bool operator==(weak_ordering v, weak_ordering w) noexcept = default; 
    friend constexpr bool operator< (weak_ordering v, unspecified) noexcept; 
    friend constexpr bool operator> (weak_ordering v, unspecified) noexcept; 
    friend constexpr bool operator<=(weak_ordering v, unspecified) noexcept; 
    friend constexpr bool operator>=(weak_ordering v, unspecified) noexcept; 
    friend constexpr bool operator< (unspecified, weak_ordering v) noexcept; 
    friend constexpr bool operator> (unspecified, weak_ordering v) noexcept; 
    friend constexpr bool operator<=(unspecified, weak_ordering v) noexcept; 
    friend constexpr bool operator>=(unspecified, weak_ordering v) noexcept; 
    friend constexpr weak_ordering operator<=>(weak_ordering v, unspecified) noexcept; 
    friend constexpr weak_ordering operator<=>(unspecified, weak_ordering v) noexcept; 
  }; 
 
  // [cmp.strongord], Class strong_ordering 
  class strong_ordering { 
  public: 
    // valid values 
    static const strong_ordering less; 
    static const strong_ordering equal; 
    static const strong_ordering equivalent; 
    static const strong_ordering greater; 
 
    // conversions 
    constexpr operator partial_ordering() const noexcept; 
    constexpr operator weak_ordering() const noexcept; 
 
    // comparisons 
    friend constexpr bool operator==(strong_ordering v, unspecified) noexcept; 
    friend constexpr bool operator==(strong_ordering v, strong_ordering w) noexcept = default; 
    friend constexpr bool operator< (strong_ordering v, unspecified) noexcept; 
    friend constexpr bool operator> (strong_ordering v, unspecified) noexcept; 
    friend constexpr bool operator<=(strong_ordering v, unspecified) noexcept; 
    friend constexpr bool operator>=(strong_ordering v, unspecified) noexcept; 
    friend constexpr bool operator< (unspecified, strong_ordering v) noexcept; 
    friend constexpr bool operator> (unspecified, strong_ordering v) noexcept; 
    friend constexpr bool operator<=(unspecified, strong_ordering v) noexcept; 
    friend constexpr bool operator>=(unspecified, strong_ordering v) noexcept; 
    friend constexpr strong_ordering operator<=>(strong_ordering v, unspecified) noexcept; 
    friend constexpr strong_ordering operator<=>(unspecified, strong_ordering v) noexcept; 
  }; 
} 
*/ 
 
#include <__compare/common_comparison_category.h> 
#include <__compare/compare_three_way.h> 
#include <__compare/compare_three_way_result.h> 
#include <__compare/is_eq.h> 
#include <__compare/ordering.h> 
#include <__compare/three_way_comparable.h> 
#include <__config> 
 
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER 
#pragma GCC system_header 
#endif 
 
_LIBCPP_BEGIN_NAMESPACE_STD 
 
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) 
 
// [cmp.alg], comparison algorithms 
// TODO: unimplemented 
template<class _Tp> constexpr strong_ordering strong_order(const _Tp& __lhs, const _Tp& __rhs); 
template<class _Tp> constexpr weak_ordering weak_order(const _Tp& __lhs, const _Tp& __rhs); 
template<class _Tp> constexpr partial_ordering partial_order(const _Tp& __lhs, const _Tp& __rhs); 
 
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) 
 
_LIBCPP_END_NAMESPACE_STD 
 
#endif // _LIBCPP_COMPARE