#pragma once #include #include struct print { print() { if(false) std::cout.setstate(std::ios_base::failbit); } ~print() { if(false) { std::cout.clear(); } else { std::cout << std::endl << std::flush; } } }; struct noprint { noprint() { if(true) std::cout.setstate(std::ios_base::failbit); } ~noprint() { if(true) { std::cout.clear(); } else { std::cout << std::endl << std::flush; } } }; #ifdef LOG_DEBUG #define DEBUG (print(), std::cout << "DEBUG[" << __FILENAME__ << ":" << __LINE__ << " in " << __func__ << "()]: ") #define WARN (print(), std::cout << "WARN [" << __FILENAME__ << ":" << __LINE__ << " in " << __func__ << "()]: ") #else #define DEBUG (noprint(), std::cout << "") #define WARN (noprint(), std::cout << "") #endif #ifdef LOG_DEBUG #define STEP \ do { DEBUG << "Stepping through, Hit Enter..."; \ std::cin.get(); \ } while (0) #else #define STEP (void)(0) #endif namespace io { void debug(std::string msg); }