File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -46,12 +46,31 @@ struct mul
46
46
}
47
47
};
48
48
49
+ template<typename T, class Comparator>
50
+ struct min
51
+ {
52
+ T operator ()(const T lhs, const T rhs, in Comparator comp)
53
+ {
54
+ return comp (lhs, rhs) ? lhs : rhs;
55
+ }
56
+ };
57
+
49
58
template<typename T>
50
59
struct min
51
60
{
52
61
T operator ()(const T lhs, const T rhs)
53
62
{
54
- return lhs>rhs ? rhs : lhs;
63
+ comparator_lt_t comp;
64
+ return min (lhs, rhs, comp);
65
+ }
66
+ };
67
+
68
+ template<typename T, class Comparator>
69
+ struct max
70
+ {
71
+ T operator ()(const T lhs, const T rhs, in Comparator comp)
72
+ {
73
+ return comp (lhs, rhs) ? lhs : rhs;
55
74
}
56
75
};
57
76
@@ -60,7 +79,8 @@ struct max
60
79
{
61
80
T operator ()(const T lhs, const T rhs)
62
81
{
63
- return lhs>rhs ? lhs : rhs;
82
+ comparator_gt_t comp;
83
+ return max (lhs, rhs, comp);
64
84
}
65
85
};
66
86
You can’t perform that action at this time.
0 commit comments