summaryrefslogtreecommitdiff
path: root/impl/Expression.hpp
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 11:45:31 +1100
committerCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 11:45:31 +1100
commita7c69ec12aec23036bfdb6447e7c38b001a40f3d (patch)
tree03d7fc971195d623ff35e9f01773ae95bbe9a688 /impl/Expression.hpp
parentbb9a899b7c45b830c6b70e2811130a41ebb31ee5 (diff)
Fix up to build with clang (and fix another bug)
- Remove exceptions - Remove dynamic casts The bug was relating to MaxStrategy not cleaning up the influence sets after propagating changes. I just added a call to .clear() and it seems fine.
Diffstat (limited to 'impl/Expression.hpp')
-rw-r--r--impl/Expression.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/impl/Expression.hpp b/impl/Expression.hpp
index eedaa52..00bc9cd 100644
--- a/impl/Expression.hpp
+++ b/impl/Expression.hpp
@@ -23,6 +23,10 @@ template<typename Domain>
struct Expression {
virtual ~Expression() { }
+ virtual const MaxExpression<Domain>* toMaxExpression() const {
+ return NULL;
+ }
+
virtual Domain eval(const VariableAssignment<Domain>&) const = 0;
virtual Domain eval(const VariableAssignment<Domain>& rho,
const MaxStrategy<Domain>&) const {
@@ -141,6 +145,10 @@ struct MaxExpression : public OperatorExpression<Domain> {
MaxExpression(const unsigned int& id, const Maximum<Domain>& op, const std::vector<Expression<Domain>*>& arguments)
: OperatorExpression<Domain>(op, arguments), _id(id) { }
+ const MaxExpression* toMaxExpression() const {
+ return this;
+ }
+
virtual Domain eval(const VariableAssignment<Domain>& rho, const MaxStrategy<Domain>& strat) const {
return this->_arguments[strat.get(*this)]->eval(rho, strat);
}