diff options
author | Aina Niemetz <aina.niemetz@gmail.com> | 2018-03-05 11:26:53 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-05 11:26:53 -0800 |
commit | 78cd7af7b3897d630ad375f72d43b4c67df6d557 (patch) | |
tree | c57b3ed2495c932d2487bbc2f004c0487c4910cb /src/expr/expr_template.cpp | |
parent | 5325b6e57714b49e8449cd5f962493aeb39d41b4 (diff) |
Add uniform way to serialize containers of Expr to stream. (#1638)
Diffstat (limited to 'src/expr/expr_template.cpp')
-rw-r--r-- | src/expr/expr_template.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/expr/expr_template.cpp b/src/expr/expr_template.cpp index f4dd294a7..6bcd15027 100644 --- a/src/expr/expr_template.cpp +++ b/src/expr/expr_template.cpp @@ -54,6 +54,42 @@ std::ostream& operator<<(std::ostream& out, const Expr& e) { } } +std::ostream& operator<<(std::ostream& out, const std::vector<Expr>& container) +{ + container_to_stream(out, container); + return out; +} + +std::ostream& operator<<(std::ostream& out, const std::set<Expr>& container) +{ + container_to_stream(out, container); + return out; +} + +std::ostream& operator<<( + std::ostream& out, + const std::unordered_set<Expr, ExprHashFunction>& container) +{ + container_to_stream(out, container); + return out; +} + +template <typename V> +std::ostream& operator<<(std::ostream& out, const std::map<Expr, V>& container) +{ + container_to_stream(out, container); + return out; +} + +template <typename V> +std::ostream& operator<<( + std::ostream& out, + const std::unordered_map<Expr, V, ExprHashFunction>& container) +{ + container_to_stream(out, container); + return out; +} + TypeCheckingException::TypeCheckingException(const TypeCheckingException& t) : Exception(t.d_msg), d_expr(new Expr(t.getExpression())) { |