blob: 1965de0bb7ebf73fd628c94532ce336cc3b41e7b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#pragma once
#include <iostream>
#include <ostream>
class debug_ostream
{
public:
debug_ostream(): m_active(false) {}
void activate()
{
m_active = true;
}
void deactivate()
{
m_active = false;
}
template<typename T>
debug_ostream& operator<<(const T& arg) {
if (m_active)
std::cout << arg;
return *this;
}
debug_ostream& operator<<(
std::basic_ostream<char>& (*func)
(std::basic_ostream<char>&) ) {
if (m_active)
std::cout << *func;
return *this;
}
private:
bool m_active;
};
extern debug_ostream debug_cout;
|