mirror of
https://github.com/fmtlib/fmt.git
synced 2025-03-13 19:19:10 +00:00
Consolidate formatters
This commit is contained in:
parent
6369af37d3
commit
256a826d63
@ -2681,21 +2681,6 @@ struct formatter<T, Char,
|
||||
-> decltype(ctx.out());
|
||||
};
|
||||
|
||||
#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);
|
||||
FMT_FORMAT_AS(short, int);
|
||||
FMT_FORMAT_AS(unsigned short, unsigned);
|
||||
FMT_FORMAT_AS(long, detail::long_type);
|
||||
FMT_FORMAT_AS(unsigned long, detail::ulong_type);
|
||||
FMT_FORMAT_AS(Char*, const Char*);
|
||||
FMT_FORMAT_AS(std::basic_string<Char>, basic_string_view<Char>);
|
||||
FMT_FORMAT_AS(std::nullptr_t, const void*);
|
||||
FMT_FORMAT_AS(detail::std_string_view<Char>, basic_string_view<Char>);
|
||||
|
||||
template <typename Char = char> struct runtime_format_string {
|
||||
basic_string_view<Char> str;
|
||||
};
|
||||
|
@ -4088,6 +4088,20 @@ struct formatter<T, Char, enable_if_t<detail::has_format_as<T>::value>>
|
||||
}
|
||||
};
|
||||
|
||||
#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);
|
||||
FMT_FORMAT_AS(short, int);
|
||||
FMT_FORMAT_AS(unsigned short, unsigned);
|
||||
FMT_FORMAT_AS(long, detail::long_type);
|
||||
FMT_FORMAT_AS(unsigned long, detail::ulong_type);
|
||||
FMT_FORMAT_AS(Char*, const Char*);
|
||||
FMT_FORMAT_AS(std::basic_string<Char>, basic_string_view<Char>);
|
||||
FMT_FORMAT_AS(std::nullptr_t, const void*);
|
||||
FMT_FORMAT_AS(detail::std_string_view<Char>, basic_string_view<Char>);
|
||||
FMT_FORMAT_AS(void*, const void*);
|
||||
|
||||
template <typename Char, size_t N>
|
||||
|
Loading…
x
Reference in New Issue
Block a user