From a7c69ec12aec23036bfdb6447e7c38b001a40f3d Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Mon, 15 Oct 2012 11:45:31 +1100 Subject: 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. --- impl/EquationSystem.hpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'impl/EquationSystem.hpp') diff --git a/impl/EquationSystem.hpp b/impl/EquationSystem.hpp index c0734aa..2fd24bd 100644 --- a/impl/EquationSystem.hpp +++ b/impl/EquationSystem.hpp @@ -96,17 +96,12 @@ struct EquationSystem { } Variable* varFromExpr(const Expression& expr) const { - if (_expr_to_var) { // we've indexed: - const MaxExpression* maxExpr = dynamic_cast*>(&expr); - if (maxExpr) { - return (*_expr_to_var)[*maxExpr]; - } else { - return NULL; - } + assert(_expr_to_var); // make sure we've indexed + const MaxExpression* maxExpr = expr.toMaxExpression();//dynamic_cast*>(&expr); + if (maxExpr) { + return (*_expr_to_var)[*maxExpr]; } else { - std::cout << "throw exception" << *(char*)NULL; return NULL; - //throw "Must index max expressions before attempting lookup"; } } -- cgit v1.2.3