blob: 74334262d3b7abfd671eecaafef7668564c71183 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#ifndef VARIABLE_H
#define VARIABLE_H
#include <string>
#include "Expression.h"
template<class T>
struct Variable : public Expression<T> {
Variable(const std::string& name)
: _name(name) { }
std::string name() const {
return this->_name;
}
T eval(const std::map<std::string, T>& values) const {
return values.find(_name)->second;
}
private:
const std::string _name;
};
#endif
|