JNGL
debug.hpp
1 // Copyright 2012-2018 Jan Niklas Hasse <[email protected]>
2 // For conditions of distribution and use, see copyright notice in LICENSE.txt
3 
4 #pragma once
5 
6 #ifndef NDEBUG
7 #include "message.hpp"
8 
9 #include <sstream>
10 #endif
11 
12 namespace jngl {
13 
14 template <class T>
15 #ifdef NDEBUG
16 void debug(const T&) {
17 #else
18 void debug(const T& t) {
20  s << t;
21  printMessage(s.str());
22 #endif
23 }
24 
25 template <class T>
26 #ifdef NDEBUG
27 void debugLn(const T&) {
28 #else
29 void debugLn(const T& t) {
31  s << t << std::endl;
32  printMessage(s.str());
33 #endif
34 }
35 
36 } // namespace jngl
sstream
message.hpp
std::stringstream
jngl
JNGL's main namespace.
Definition: App.hpp:9
std::endl
T endl(T... args)
std::stringstream::str
T str(T... args)
jngl::printMessage
void printMessage(const std::string &text)
Prints text on stdout.