diff options
author | liushuyu <liushuyu011@gmail.com> | 2022-01-08 16:02:49 -0700 |
---|---|---|
committer | liushuyu <liushuyu011@gmail.com> | 2022-01-08 16:02:49 -0700 |
commit | 099dd0c0d299d0f3541221928814e9001a69623a (patch) | |
tree | 3d417727647556113693c1a0b649e38d21583023 /src/common/logging/log.h | |
parent | 42f653ab6fc8ab07ba0db4ffb4d2b0267115a588 (diff) |
logging/log: use `underlying_type` instead of hardcoding types
Diffstat (limited to 'src/common/logging/log.h')
-rw-r--r-- | src/common/logging/log.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/common/logging/log.h b/src/common/logging/log.h index b6a14972f..096a441b8 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h @@ -16,10 +16,12 @@ // a generic formatter for enum classes (<= 32 bits) #if FMT_VERSION >= 80100 template <typename T> -struct fmt::formatter<T, std::enable_if_t<std::is_enum_v<T>, char>> : formatter<u32> { +struct fmt::formatter<T, std::enable_if_t<std::is_enum_v<T>, char>> + : formatter<std::underlying_type_t<T>> { template <typename FormatContext> auto format(const T& value, FormatContext& ctx) -> decltype(ctx.out()) { - return fmt::formatter<u32>::format(static_cast<u32>(value), ctx); + return fmt::formatter<std::underlying_type_t<T>>::format( + static_cast<std::underlying_type_t<T>>(value), ctx); } }; #endif |