summaryrefslogtreecommitdiff
path: root/src/expr/node.h
diff options
context:
space:
mode:
authorAina Niemetz <aina.niemetz@gmail.com>2018-03-05 11:26:53 -0800
committerGitHub <noreply@github.com>2018-03-05 11:26:53 -0800
commit78cd7af7b3897d630ad375f72d43b4c67df6d557 (patch)
treec57b3ed2495c932d2487bbc2f004c0487c4910cb /src/expr/node.h
parent5325b6e57714b49e8449cd5f962493aeb39d41b4 (diff)
Add uniform way to serialize containers of Expr to stream. (#1638)
Diffstat (limited to 'src/expr/node.h')
-rw-r--r--src/expr/node.h27
1 files changed, 5 insertions, 22 deletions
diff --git a/src/expr/node.h b/src/expr/node.h
index 84278ff8a..e1b979570 100644
--- a/src/expr/node.h
+++ b/src/expr/node.h
@@ -923,23 +923,6 @@ inline std::ostream& operator<<(std::ostream& out, TNode n) {
return out;
}
-namespace {
-
-template <typename T>
-void nodeContainerToOut(std::ostream& out, const T& container)
-{
- out << "[";
- bool is_first = true;
- for (const auto& item : container)
- {
- out << (!is_first ? ", " : "") << item;
- is_first = false;
- }
- out << "]";
-}
-
-}
-
/**
* Serialize a vector of nodes to given stream.
*
@@ -951,7 +934,7 @@ template <bool RC>
std::ostream& operator<<(std::ostream& out,
const std::vector<NodeTemplate<RC>>& container)
{
- nodeContainerToOut(out, container);
+ container_to_stream(out, container);
return out;
}
@@ -966,7 +949,7 @@ template <bool RC>
std::ostream& operator<<(std::ostream& out,
const std::set<NodeTemplate<RC>>& container)
{
- nodeContainerToOut(out, container);
+ container_to_stream(out, container);
return out;
}
@@ -982,7 +965,7 @@ std::ostream& operator<<(
std::ostream& out,
const std::unordered_set<NodeTemplate<RC>, hash_function>& container)
{
- nodeContainerToOut(out, container);
+ container_to_stream(out, container);
return out;
}
@@ -998,7 +981,7 @@ std::ostream& operator<<(
std::ostream& out,
const std::map<NodeTemplate<RC>, V>& container)
{
- nodeContainerToOut(out, container);
+ container_to_stream(out, container);
return out;
}
@@ -1014,7 +997,7 @@ std::ostream& operator<<(
std::ostream& out,
const std::unordered_map<NodeTemplate<RC>, V, HF>& container)
{
- nodeContainerToOut(out, container);
+ container_to_stream(out, container);
return out;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback