diff options
Diffstat (limited to 'impl/Variable.hpp')
-rw-r--r-- | impl/Variable.hpp | 13 |
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 |