mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-06 15:55:00 +00:00
Simplify FMT_FORMAT_AS
This commit is contained in:
parent
7401fe046a
commit
de8d0171a2
@ -2690,15 +2690,9 @@ struct formatter<T, Char,
|
|||||||
-> decltype(ctx.out());
|
-> decltype(ctx.out());
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FMT_FORMAT_AS(Type, Base) \
|
#define FMT_FORMAT_AS(Type, Base) \
|
||||||
template <typename Char> \
|
template <typename Char> \
|
||||||
struct formatter<Type, Char> : formatter<Base, 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); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
FMT_FORMAT_AS(signed char, int);
|
FMT_FORMAT_AS(signed char, int);
|
||||||
FMT_FORMAT_AS(unsigned char, unsigned);
|
FMT_FORMAT_AS(unsigned char, unsigned);
|
||||||
|
Loading…
Reference in New Issue
Block a user