chore(cpp): add debugging output

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2023-07-29 16:01:18 +02:00
parent e9a7fb0955
commit 7c7377e138
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -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 <typename Head, typename... Tail>
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 <typename T>