#pragma once #include #include #include namespace vcpkg::Debug { extern std::atomic g_debugging; template void print(System::Color c, const Args&... args) { if (g_debugging) System::print2(c, "[DEBUG] ", args...); } template void print(const Args&... args) { if (g_debugging) System::print2("[DEBUG] ", args...); } template, class = std::enable_if_t::value>> R time(LineInfo line, F&& f) { if (g_debugging) { auto timer = Chrono::ElapsedTimer::create_started(); auto&& result = f(); System::print2("[DEBUG] ", line, " took ", timer, '\n'); return static_cast(result); } else return f(); } template, class = std::enable_if_t::value>> void time(LineInfo line, F&& f) { if (g_debugging) { auto timer = Chrono::ElapsedTimer::create_started(); f(); System::print2("[DEBUG] ", line, " took ", timer, '\n'); } else f(); } }