libbmb
Modern implementation of STL
Loading...
Searching...
No Matches
compare.h
Go to the documentation of this file.
1#pragma once
2
9namespace bmb {
10
13 template <typename T, typename U>
14 auto operator()(const T& x, const U& y) const {
15 return x <=> y;
16 }
17};
18
20struct equal_to {
21 template <typename T, typename U>
22 bool operator()(const T& x, const U& y) const {
23 return x == y;
24 }
25};
26
29 template <typename T, typename U>
30 bool operator()(const T& x, const U& y) const {
31 return x != y;
32 }
33};
34
36struct less {
37 template <typename T, typename U>
38 bool operator()(const T& x, const U& y) const {
39 return x < y;
40 }
41};
42
44struct less_equal {
45 template <typename T, typename U>
46 bool operator()(const T& x, const U& y) const {
47 return x <= y;
48 }
49};
50
52struct greater {
53 template <typename T, typename U>
54 bool operator()(const T& x, const U& y) const {
55 return x > y;
56 }
57};
58
61 template <typename T, typename U>
62 bool operator()(const T& x, const U& y) const {
63 return x >= y;
64 }
65};
66
67} // namespace bmb
Definition algo_base.h:14
constexpr T && forward(remove_ref_t< T > &value) noexcept
Forward a lvalue.
Definition move.h:33
compare_three_way
Definition compare.h:12
auto operator()(const T &x, const U &y) const
Definition compare.h:14
equal_to
Definition compare.h:20
bool operator()(const T &x, const U &y) const
Definition compare.h:22
greater_equal
Definition compare.h:60
bool operator()(const T &x, const U &y) const
Definition compare.h:62
greater
Definition compare.h:52
bool operator()(const T &x, const U &y) const
Definition compare.h:54
less_equal
Definition compare.h:44
bool operator()(const T &x, const U &y) const
Definition compare.h:46
less
Definition compare.h:36
bool operator()(const T &x, const U &y) const
Definition compare.h:38
not_equal_to
Definition compare.h:28
bool operator()(const T &x, const U &y) const
Definition compare.h:30