summaryrefslogtreecommitdiff
path: root/impl/Variable.hpp
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@carlo-laptop>2012-05-28 13:00:50 +1000
committerCarlo Zancanaro <carlo@carlo-laptop>2012-05-28 13:00:50 +1000
commitea05c9c5fa30b8822f618e861d12a09df1f8f017 (patch)
treecb8717d9773ef77978dc8e1d9093560e3cf26532 /impl/Variable.hpp
parentee8547cf3c89c51ff10603814e6f745466bc4c79 (diff)
Fix memory error and x = max(-inf, expr) stuff.
Diffstat (limited to 'impl/Variable.hpp')
-rw-r--r--impl/Variable.hpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/impl/Variable.hpp b/impl/Variable.hpp
index c46db02..5ebbbed 100644
--- a/impl/Variable.hpp
+++ b/impl/Variable.hpp
@@ -16,13 +16,22 @@ struct Variable : public Operator<T> {
std::string name() const {
return _name;
}
- T operator() (const std::vector< Expression<T>* >& args, const VariableAssignment<T>& ass) const {
+ //T operator() (const std::vector< Expression<T>* >& args, const VariableAssignment<T>& ass) const {
+ virtual T operator() (const std::vector< Expression<T>* >& args, const VariableAssignment<T>& assignment, VariableSet<T>* visited) const {
//assert(args.size() == 0)
- return ass[*this];
+ if (visited != NULL)
+ visited->insert(*this);
+ return assignment[*this];
}
private:
const unsigned int _id;
const std::string _name;
};
+template<typename T>
+std::ostream& operator<<(std::ostream& cout, const Variable<T>& v) {
+ cout << v.name() << "(" << v.id() << ")";
+ return cout;
+}
+
#endif