summaryrefslogtreecommitdiff
path: root/Constant.h
blob: bab8cd9569d437d01a584816b4566db8467f7494 (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 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