#pragma once #include #include class debug_ostream { public: debug_ostream(): m_active(false) {} void activate() { m_active = true; } void deactivate() { m_active = false; } template debug_ostream& operator<<(const T& arg) { if (m_active) std::cout << arg; return *this; } debug_ostream& operator<<( std::basic_ostream& (*func) (std::basic_ostream&) ) { if (m_active) std::cout << *func; return *this; } private: bool m_active; }; extern debug_ostream debug_cout;