From 942f7025ce5c1e24330d001cd350c4fc0712a560 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Mon, 26 Sep 2016 12:47:56 +0800 Subject: common - Add print for std::set --- src/common.hpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') 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 #include #include +#include #include #include #include @@ -223,6 +224,21 @@ inline ::std::ostream& operator<<(::std::ostream& os, const ::std::vector& v) } return os; } +template +inline ::std::ostream& operator<<(::std::ostream& os, const ::std::set& 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 inline ::std::ostream& operator<<(::std::ostream& os, const ::std::pair& v) { -- cgit v1.2.3