Mercurial > hg > vampy
view Debug.h @ 113:c7694d24500c
Fix crash when plugin library is loaded and unloaded without any plugins being queried (so extension manager is never initialised)
author | Chris Cannam |
---|---|
date | Tue, 26 Feb 2019 12:46:24 +0000 |
parents | 146d14ab15e7 |
children |
line wrap: on
line source
#ifndef DEBUG_H_INCLUDED #define DEBUG_H_INCLUDED #include <iostream> #include <cstdlib> class MyDebug { public: MyDebug() : want(std::getenv("VAMPY_VERBOSE") != 0) { } template <typename T> MyDebug &operator<<(const T &t) { if (want) std::cerr << t; return *this; } MyDebug &operator<<(std::ostream &(*o)(std::ostream &)) { if (want) std::cerr << o; return *this; } private: bool want; }; #define DSTREAM (MyDebug()) #endif