summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-09-26 12:47:56 +0800
committerJohn Hodge <tpg@mutabah.net>2016-09-26 12:47:56 +0800
commit942f7025ce5c1e24330d001cd350c4fc0712a560 (patch)
treef0132f3c0feb7a7097da4d3d7412ce26f0bf7873
parent84a25f125148ec6b23bc679407c838bcf7ea5da9 (diff)
downloadmrust-942f7025ce5c1e24330d001cd350c4fc0712a560.tar.gz
common - Add print for std::set
-rw-r--r--src/common.hpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/common.hpp b/src/common.hpp
index 35113670..e58fc0da 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -6,6 +6,7 @@
#include <iostream>
#include <vector>
#include <map>
+#include <set>
#include <cassert>
#include <sstream>
#include <memory>
@@ -223,6 +224,21 @@ inline ::std::ostream& operator<<(::std::ostream& os, const ::std::vector<T>& v)
}
return os;
}
+template <typename T>
+inline ::std::ostream& operator<<(::std::ostream& os, const ::std::set<T>& v) {
+ if( v.size() > 0 )
+ {
+ bool is_first = true;
+ for( const auto& i : v )
+ {
+ if(!is_first)
+ os << ", ";
+ is_first = false;
+ os << i;
+ }
+ }
+ return os;
+}
template <typename T, typename U>
inline ::std::ostream& operator<<(::std::ostream& os, const ::std::pair<T,U>& v) {