Skip to content

Commit 787d129

Browse files
committed
adds operator implementations for less than, greater than, equals, and not equals
1 parent dca2b87 commit 787d129

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

include/attwoodn/expression_tree.hpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,38 @@
33
#include <iostream>
44

55
namespace attwoodn::expression_tree {
6+
7+
namespace op {
8+
9+
template<typename A, typename B>
10+
class less_than {
11+
bool operator()(A a, B b) {
12+
return a < b;
13+
}
14+
};
15+
16+
template<typename A, typename B>
17+
class greater_than {
18+
bool operator()(A a, B b) {
19+
return a > b;
20+
}
21+
};
22+
23+
template<typename A, typename B>
24+
class equals {
25+
bool operator()(A a, B b) {
26+
return a == b;
27+
}
28+
};
29+
30+
template<typename A, typename B>
31+
class not_equals {
32+
bool operator()(A a, B b) {
33+
return a != b;
34+
}
35+
};
36+
}
37+
638
static inline void say_hello() {
739
std::cout << "hello world!" << std::endl;
840
}

0 commit comments

Comments
 (0)