19#ifndef FENNEC_LANG_COMPARE_H
20#define FENNEC_LANG_COMPARE_H
22#include <fennec/lang/type_operators.h>
29template<
typename T0,
typename T1 = T0>
struct equality;
31template<
typename T0,
typename T1>
requires has_equals_v<T0, T1>
32struct equality<T0, T1> {
33 constexpr bool operator()(
const T0& x,
const T1& y)
const {
38template<
typename T0,
typename T1>
requires(not has_equals_v<T0, T1>
39 and has_less_v<T0, T1> and has_less_v<T1, T0>)
40struct equality<T0, T1> {
41 constexpr bool operator()(
const T0& x,
const T1& y)
const {
42 return not(x < y) and not(y < x);
46template<
typename T0,
typename T1>
requires(not(has_equals_v<T0, T1>)
47 and(not has_less_v<T0, T1> or not has_less_v<T1, T0>)
48 and(has_greater_v<T0, T1> and has_greater_v<T1, T0>))
49struct equality<T0, T1> {
50 constexpr bool operator()(
const T0& x,
const T1& y)
const {
51 return not(x > y) and not(y > x);
58template<
typename T0,
typename T1 = T0>
struct inequality;
60template<
typename T0,
typename T1>
requires has_nequals_v<T0, T1>
61struct inequality<T0, T1> {
62 constexpr bool operator()(
const T0& x,
const T1& y)
const {
67template<
typename T0,
typename T1>
requires has_less_v<T0, T1> and has_less_v<T1, T0>
68struct inequality<T0, T1> {
69 constexpr bool operator()(
const T0& x,
const T1& y)
const {
70 return (x < y) or (y < x);
74template<
typename T0,
typename T1>
requires has_greater_v<T0, T1> and has_greater_v<T1, T0>
75struct inequality<T0, T1> {
76 constexpr bool operator()(
const T0& x,
const T1& y)
const {
77 return (x > y) or (y > x);
84template<
typename T0,
typename T1 = T0>
requires has_less_v<T0, T1>
86 constexpr bool operator()(
const T0& x,
const T1& y)
const {
94template<
typename T0,
typename T1 = T0>
requires has_less_equals_v<T0, T1>
96 constexpr bool operator()(
const T0& x,
const T1& y)
const {
104template<
typename T0,
typename T1 = T0>
requires has_greater_v<T0, T1>
106 constexpr bool operator()(
const T0& x,
const T1& y)
const {
114template<
typename T0,
typename T1 = T0>
requires has_greater_equals_v<T0, T1>
115struct greater_equals {
116 constexpr bool operator()(
const T0& x,
const T1& y)
const {
constexpr genType y()
Definition constants.h:672