diff options
author | John Hodge (sonata) <tpg@mutabah.net> | 2015-01-22 14:51:07 +0800 |
---|---|---|
committer | John Hodge (sonata) <tpg@mutabah.net> | 2015-01-22 14:51:07 +0800 |
commit | 76d70d4cbfbdf09082d35a224a4c7f2d2b501974 (patch) | |
tree | a0b3ce0ea0f624e56e57edc6850542e9f4081eae /src/common.hpp | |
parent | 8d1acfa3993e64b0266365379602799350855f3f (diff) | |
download | mrust-76d70d4cbfbdf09082d35a224a4c7f2d2b501974.tar.gz |
Added bounds to _ types, propagating type params further (and replacing when needed)
Diffstat (limited to 'src/common.hpp')
-rw-r--r-- | src/common.hpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/common.hpp b/src/common.hpp index b9b90270..c73db0e8 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -5,6 +5,7 @@ #include <iostream> #include <vector> +#include <map> #include <cassert> #include <sstream> @@ -115,6 +116,22 @@ inline ::std::ostream& operator<<(::std::ostream& os, const ::std::vector<T>& v) return os; } +template <typename T, typename U> +inline ::std::ostream& operator<<(::std::ostream& os, const ::std::map<T,U>& 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 |