AK: Add enabled template parameter to dbgln.

This commit is contained in:
asynts 2021-01-12 22:10:24 +01:00 committed by Andreas Kling
parent 971425d7b1
commit 4953c73fc1
Notes: sideshowbarker 2024-07-18 23:11:43 +09:00
2 changed files with 10 additions and 14 deletions

View file

@ -392,11 +392,16 @@ inline void warnln() { outln(stderr); }
void vdbgln(StringView fmtstr, TypeErasedFormatParams);
template<typename... Parameters>
void dbgln(StringView fmtstr, const Parameters&... parameters) { vdbgln(fmtstr, VariadicFormatParams { parameters... }); }
template<typename... Parameters>
void dbgln(const char* fmtstr, const Parameters&... parameters) { dbgln(StringView { fmtstr }, parameters...); }
inline void dbgln() { dbgln(""); }
template<bool enabled = true, typename... Parameters>
void dbgln(StringView fmtstr, const Parameters&... parameters)
{
if constexpr (enabled)
vdbgln(fmtstr, VariadicFormatParams { parameters... });
}
template<bool enabled = true, typename... Parameters>
void dbgln(const char* fmtstr, const Parameters&... parameters) { dbgln<enabled>(StringView { fmtstr }, parameters...); }
template<bool enabled = true>
void dbgln() { dbgln<enabled>(""); }
template<typename T, typename = void>
struct HasFormatter : TrueType {

View file

@ -133,15 +133,6 @@ class WeakPtr;
template<typename T, size_t inline_capacity = 0>
class Vector;
template<typename... Parameters>
void dbgln(const char* fmtstr, const Parameters&...);
template<typename... Parameters>
void warnln(const char* fmtstr, const Parameters&...);
template<typename... Parameters>
void outln(const char* fmtstr, const Parameters&...);
}
using AK::Array;