diff options
Diffstat (limited to 'src/common.hpp')
-rw-r--r-- | src/common.hpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/common.hpp b/src/common.hpp index 545a0adf..01c710b9 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -62,6 +62,12 @@ inline ::std::ostream& operator<<(::std::ostream& os, const ::std::vector<T>& v) } template <typename T, typename U> +inline ::std::ostream& operator<<(::std::ostream& os, const ::std::pair<T,U>& v) { + os << "(" << v.first << ", " << v.second << ")"; + return os; +} + +template <typename T, typename U> inline ::std::ostream& operator<<(::std::ostream& os, const ::std::map<T,U>& v) { if( v.size() > 0 ) { @@ -77,6 +83,22 @@ inline ::std::ostream& operator<<(::std::ostream& os, const ::std::map<T,U>& v) return os; } +template <typename T, typename U, class Cmp> +inline ::std::ostream& operator<<(::std::ostream& os, const ::std::multimap<T,U,Cmp>& v) { + if( v.size() > 0 ) + { + bool is_first = true; + for( const auto& i : v ) + { + if(!is_first) + os << ", "; + is_first = false; + os << i.first << ": " << i.second; + } + } + return os; +} + } #endif |