From 5d7252681da3b26845fc4e5dcf0b0e94ed9fabb1 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Fri, 6 Apr 2012 14:02:26 +1000 Subject: Move everything into impl/ and add a Makefile. --- impl/Max.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 impl/Max.h (limited to 'impl/Max.h') diff --git a/impl/Max.h b/impl/Max.h new file mode 100644 index 0000000..b3b5d65 --- /dev/null +++ b/impl/Max.h @@ -0,0 +1,22 @@ +#ifndef MAX_H +#define MAX_H + +#include "Expression.h" + +template +struct Max : public Expression { + Max(Expression* left, Expression* right) + : _left(left), _right(right) { } + + T eval(const std::map& mappings) const { + T left = _left->eval(mappings); + T right = _right->eval(mappings); + return left < right ? right : left; + } + + private: + Expression* _left; + Expression* _right; +}; + +#endif -- cgit v1.2.3