blob: b3b5d6513dcfbf417817103e337b773a59d79e2e (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#ifndef MAX_H
#define MAX_H
#include "Expression.h"
template<class T>
struct Max : public Expression<T> {
Max(Expression<T>* left, Expression<T>* right)
: _left(left), _right(right) { }
T eval(const std::map<std::string, T>& mappings) const {
T left = _left->eval(mappings);
T right = _right->eval(mappings);
return left < right ? right : left;
}
private:
Expression<T>* _left;
Expression<T>* _right;
};
#endif
|