Simplify FMT_FORMAT_AS

This commit is contained in:
Victor Zverovich 2023-05-20 18:28:01 -07:00
parent 7401fe046a
commit de8d0171a2

View File

@ -2690,15 +2690,9 @@ struct formatter<T, Char,
-> decltype(ctx.out());
};
#define FMT_FORMAT_AS(Type, Base) \
template <typename Char> \
struct formatter<Type, Char> : formatter<Base, Char> { \
template <typename FormatContext> \
auto format(Type const& val, FormatContext& ctx) const \
-> decltype(ctx.out()) { \
return formatter<Base, Char>::format(static_cast<Base>(val), ctx); \
} \
}
#define FMT_FORMAT_AS(Type, Base) \
template <typename Char> \
struct formatter<Type, Char> : formatter<Base, Char> {}
FMT_FORMAT_AS(signed char, int);
FMT_FORMAT_AS(unsigned char, unsigned);