view Debug.h @ 91:c4510e5f7a17

Move more List types from the exposed names list to the commented-out "builtin objects" section. These aren't our own custom types
author Chris Cannam
date Mon, 14 Jan 2019 16:16:43 +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