5 #ifndef VCCC_UTILITY_CXX20_REL_OPS_HPP_
6 #define VCCC_UTILITY_CXX20_REL_OPS_HPP_
20 template<
typename T,
typename U,
typename =
void>
22 template<
typename T,
typename U>
25 void_t<decltype(
std::declval<T>() == std::declval<U>() )>
26 > : std::is_convertible<decltype( std::declval<T>() == std::declval<U>() ), bool> {};
28 template<
typename T,
typename U,
typename =
void>
30 template<
typename T,
typename U>
33 void_t<decltype(
std::declval<T>() < std::declval<U>() )>
34 > : std::is_convertible<decltype( std::declval<T>() < std::declval<U>() ), bool> {};
131 #if __cplusplus < 202002L
133 template<typename T, typename U, std::enable_if_t<conjunction<
134 negation<std::is_same<T, U>>,
135 detail::has_operator_equal_2<const U&, const T&>
137 constexpr bool operator==(const T& a, const U& b) noexcept(noexcept(b == a)) {
145 struct is_equality_comparable_impl {
146 template<typename T, typename U>
147 static constexpr std::false_type test(...);
148 template<typename T, typename U>
149 static constexpr auto test(void_t<decltype( std::declval<T>() == std::declval<U>() )>* = nullptr)
150 -> std::is_convertible<decltype( std::declval<T>() == std::declval<U>() ), bool>;
152 template<typename T, typename U>
153 using type = decltype(test<T, U>(0));
158 template<typename T, typename U>
159 struct is_equality_comparable : detail::is_equality_comparable_impl::type<T, U> {};
163 template<typename T, typename U, std::enable_if_t<conjunction<
164 negation<std::is_same<T, U>>,
165 is_equality_comparable<T, U>,
166 negation< detail::has_operator_less_2<const T&, const U&> >,
167 detail::has_operator_less_2<const U&, const T&>
169 constexpr bool operator<(const T& a, const U& b) noexcept(noexcept(!( (b < a) || (a == b)))) {
171 return !( (b < a) || (a == b));
176 struct is_less_than_comparable_impl {
177 template<typename T, typename U>
178 static constexpr std::false_type test(...);
179 template<typename T, typename U>
180 static constexpr auto test(void_t<decltype( std::declval<T>() < std::declval<U>() )>* = nullptr)
181 -> std::is_convertible<decltype( std::declval<T>() < std::declval<U>() ), bool>;
183 template<typename T, typename U>
184 using type = decltype(test<T, U>(0));
189 template<typename T, typename U>
190 struct is_less_than_comparable : detail::is_less_than_comparable_impl::type<T, U> {};
193 template<typename T, typename U, std::enable_if_t<is_equality_comparable<T, U>::value, int> = 0>
194 constexpr bool operator!=(const T& a, const U& b) noexcept(noexcept(!(a == b))) {
199 template<typename T, typename U, std::enable_if_t<is_less_than_comparable<U, T>::value, int> = 0>
200 constexpr bool operator>(const T& a, const U& b) noexcept(noexcept(b < a)) {
205 template<typename T, typename U, std::enable_if_t<is_less_than_comparable<U, T>::value, int> = 0>
206 constexpr bool operator<=(const T& a, const U& b) noexcept(noexcept(!(b < a))) {
211 template<typename T, typename U, std::enable_if_t<is_less_than_comparable<T, U>::value, int> = 0>
212 constexpr bool operator>=(const T& a, const U& b) noexcept(noexcept(!(a < b))) {
218 struct is_non_equality_comparable_impl {
219 template<typename T, typename U>
220 static constexpr std::false_type test(...);
221 template<typename T, typename U>
222 static constexpr auto test(void_t<decltype( std::declval<T>() != std::declval<U>() )>* = nullptr)
223 -> std::is_convertible<decltype( std::declval<T>() != std::declval<U>() ), bool>;
225 template<typename T, typename U>
226 using type = decltype(test<T, U>(0));
229 struct is_less_equal_than_comparable_impl {
230 template<typename T, typename U>
231 static constexpr std::false_type test(...);
232 template<typename T, typename U>
233 static constexpr auto test(void_t<decltype( std::declval<T>() <= std::declval<U>() )>* = nullptr)
234 -> std::is_convertible<decltype( std::declval<T>() <= std::declval<U>() ), bool>;
236 template<typename T, typename U>
237 using type = decltype(test<T, U>(0));
240 struct is_greater_than_comparable_impl {
241 template<typename T, typename U>
242 static constexpr std::false_type test(...);
243 template<typename T, typename U>
244 static constexpr auto test(void_t<decltype( std::declval<T>() > std::declval<U>() )>* = nullptr)
245 -> std::is_convertible<decltype( std::declval<T>() > std::declval<U>() ), bool>;
247 template<typename T, typename U>
248 using type = decltype(test<T, U>(0));
251 struct is_greater_equal_than_comparable_impl {
252 template<typename T, typename U>
253 static constexpr std::false_type test(...);
254 template<typename T, typename U>
255 static constexpr auto test(void_t<decltype( std::declval<T>() >= std::declval<U>() )>* = nullptr)
256 -> std::is_convertible<decltype( std::declval<T>() >= std::declval<U>() ), bool>;
258 template<typename T, typename U>
259 using type = decltype(test<T, U>(0));
264 template<typename T, typename U>
265 struct is_non_equality_comparable : detail::is_non_equality_comparable_impl::type<T, U> {};
266 template<typename T, typename U>
267 struct is_less_equal_than_comparable : detail::is_less_equal_than_comparable_impl::type<T, U> {};
268 template<typename T, typename U>
269 struct is_greater_than_comparable : detail::is_greater_than_comparable_impl::type<T, U> {};
270 template<typename T, typename U>
271 struct is_greater_equal_than_comparable : detail::is_greater_equal_than_comparable_impl::type<T, U> {};
Definition: matrix.hpp:495
Definition: directory.h:12
Definition: cxx20_rel_ops.hpp:21
Definition: cxx20_rel_ops.hpp:29