Effective implementation of algorithms (Master Thesis)
Effective and error-free implementation of algorithms
src/debug/ppdebug.h
Go to the documentation of this file.
00001 #ifndef H_PPDEBUG
00002 #define H_PPDEBUG
00003 
00009 #include "template/template.h"
00010 #define D(var) { cout << #var << ": " << (var) << endl; }
00011 
00012 // DO NOT TRY TO MAKE A MISTYPE!!!!
00013 #define TPL_T template <class T>
00014 #define TPL_ST template <class S, class T>
00015 
00016 #define OSTREAM(X...) ostream& operator << (ostream &out, const X& temp)
00017 
00018 TPL_ST OSTREAM(pair<S,T>) \
00019     { out << "(" << temp.fi << "," << temp.se << ")"; return out; } 
00020 
00021 TPL_T OSTREAM(pair<T*, T*>) \
00022     { out << "[ "; for(T* q = temp.fi; q != temp.se; q++) out << *q << ", "; out << "]"; \
00023         return out; };
00024 
00025 
00026 #define _OUT(X, Y...) X OSTREAM(Y) { \
00027         out << "[ "; FOREACH(it, temp) out << *it << ", "; out << "]"; \
00028         return out; };
00029 
00030 _OUT(TPL_T, vector<T>);
00031 _OUT(TPL_T, list<T>);
00032 _OUT(TPL_T, set<T>);
00033 _OUT(TPL_T, multiset<T>);
00034 
00035 _OUT(TPL_ST, map<S,T>);
00036 _OUT(TPL_ST, multimap<S,T>);
00037 _OUT(TPL_ST, set<S,T>);
00038 
00039 
00040 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines