diff options
Diffstat (limited to 'Constant.h')
-rw-r--r-- | Constant.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Constant.h b/Constant.h new file mode 100644 index 0000000..bab8cd9 --- /dev/null +++ b/Constant.h @@ -0,0 +1,22 @@ +#ifndef CONSTANT_H +#define CONSTANT_H + +#include "Expression.h" + +template<class T> +struct Constant : public Expression<T> { + Constant(const T& value) : _value(value) { } + + T value() const { + return this->_value; + } + + T eval(const std::map<std::string, T>&) const { + return _value; + } + + private: + const T _value; +}; + +#endif |