From 7c7377e13832bd28b05b09812b0449b399c9f89f Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Sat, 29 Jul 2023 16:01:18 +0200 Subject: [PATCH] chore(cpp): add debugging output Signed-off-by: Matej Focko --- .common/cpp/skeleton.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.common/cpp/skeleton.cpp b/.common/cpp/skeleton.cpp index 5ce8bb9..da8fc11 100644 --- a/.common/cpp/skeleton.cpp +++ b/.common/cpp/skeleton.cpp @@ -59,6 +59,24 @@ inline void answer(const T &ans) { inline void yes() { std::cout << "YES\n"; } inline void no() { std::cout << "NO\n"; } inline void yesno(bool ans) { std::cout << (ans ? "YES" : "NO") << "\n"; } +#pragma endregion /* output */ + +#pragma region debug +void dbg_out() { std::cerr << std::endl; } +template +void dbg_out(Head H, Tail... T) { + std::cerr << ' ' << H; + dbg_out(T...); +} +#ifdef LOCAL +#define dbg(...) \ + std::cerr << '[' << __FILE__ << ':' << __LINE__ << "] (" << #__VA_ARGS__ \ + << "):", \ + dbg_out(__VA_ARGS__) +#else +#define dbg(...) +#endif +#pragma endregion debug #pragma region input template