blob: e0f7dc8877d6d35c4cd3ded920719d10d0724664 (
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
25
26
27
28
29
|
#ifndef VARIABLE_ASSIGNMENT_HPP
#define VARIABLE_ASSIGNMENT_HPP
#include "Expression.hpp"
#include "IdMap.hpp"
template<typename Domain>
struct VariableAssignment {
virtual ~VariableAssignment() { }
virtual const Domain& operator[](const Variable<Domain>&) const = 0;
};
template<typename Domain>
struct StableVariableAssignment
: public VariableAssignment<Domain>, public IdMap<Variable<Domain>, Domain> {
StableVariableAssignment(unsigned int length)
: IdMap<Variable<Domain>,Domain>(length, -infinity<Domain>()) { }
StableVariableAssignment(unsigned int length, const Domain& value)
: IdMap<Variable<Domain>,Domain>(length, value) { }
const Domain& operator[](const Variable<Domain>& var) const {
return IdMap<Variable<Domain>,Domain>::operator[](var);
}
Domain& operator[](const Variable<Domain>& var) {
return IdMap<Variable<Domain>,Domain>::operator[](var);
}
};
#endif
|