diff options
Diffstat (limited to 'src/common.hpp')
-rw-r--r-- | src/common.hpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/common.hpp b/src/common.hpp index deaf4ed1..21f1663e 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -6,4 +6,27 @@ #define FOREACH(basetype, it, src) for(basetype::const_iterator it = src.begin(); it != src.end(); ++ it) #define FOREACH_M(basetype, it, src) for(basetype::iterator it = src.begin(); it != src.end(); ++ it) +#include <iostream> +#include <vector> + +#define DEBUG(ss) do{ ::std::cerr << __func__ << ": " << ss << ::std::endl; } while(0) + +namespace AST { +template <typename T> +inline ::std::ostream& operator<<(::std::ostream& os, const ::std::vector<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; +} +} + #endif |