From 09f4f3f23b5181883c7423a171edd5ec6467df02 Mon Sep 17 00:00:00 2001 From: liushuyu Date: Sat, 8 Jan 2022 21:42:11 -0700 Subject: logging/log.h: move enum class formatter to a separate file ... ... to common/logging/formatter.h --- src/common/logging/formatter.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/common/logging/formatter.h (limited to 'src/common/logging/formatter.h') diff --git a/src/common/logging/formatter.h b/src/common/logging/formatter.h new file mode 100644 index 000000000..552cde75a --- /dev/null +++ b/src/common/logging/formatter.h @@ -0,0 +1,23 @@ +// Copyright 2022 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include + +#include + +// adapted from https://github.com/fmtlib/fmt/issues/2704 +// a generic formatter for enum classes +#if FMT_VERSION >= 80100 +template +struct fmt::formatter, char>> + : formatter> { + template + auto format(const T& value, FormatContext& ctx) -> decltype(ctx.out()) { + return fmt::formatter>::format( + static_cast>(value), ctx); + } +}; +#endif -- cgit v1.2.3