Debian Codegraph @

testing/projects/cpp_func_overloads/src/operators.cpp

raw
1 #include <overload/operators.hpp>
2
3 namespace overload {
4 template <>
5 std::ostream &operator<< <std::ostream, CustomType>(std::ostream &out, const CustomType& ct) {
6 return out << ct.value();
7 }
8
9 bool operator==(const CustomType &lhs, const CustomType &rhs) {
10 return lhs.value() == rhs.value();
11 }
12
13 bool operator!=(const CustomType &lhs, const CustomType &rhs) {
14 return !(lhs == rhs);
15 }
16
17 bool operator<(const CustomType &lhs, const CustomType &rhs) {
18 return lhs.value() < rhs.value();
19 }
20
21 bool operator>(const CustomType &lhs, const CustomType &rhs) {
22 return lhs.value() > rhs.value();
23 }
24
25 bool operator<=(const CustomType &lhs, const CustomType &rhs) {
26 return lhs.value() <= rhs.value();
27 }
28
29 bool operator>=(const CustomType &lhs, const CustomType &rhs) {
30 return lhs.value() >= rhs.value();
31 }
32 }