mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-19 20:18:49 +00:00
Improve conversion
This commit is contained in:
parent
f164e4c72f
commit
bfce29ffef
@ -402,18 +402,17 @@ FMT_DISABLE_CONVERSION_TO_INT(long double);
|
|||||||
|
|
||||||
// Disambiguates conversions to different integral types.
|
// Disambiguates conversions to different integral types.
|
||||||
struct type_selector {
|
struct type_selector {
|
||||||
using char2 = struct { char a[2]; };
|
static int convert(...);
|
||||||
static char convert(...);
|
static int convert(int);
|
||||||
static char convert(int);
|
static unsigned convert(unsigned);
|
||||||
static char convert(unsigned);
|
static long convert(long);
|
||||||
static char convert(long);
|
static unsigned long convert(unsigned long);
|
||||||
static char convert(unsigned long);
|
static long long convert(long long);
|
||||||
static char2 convert(long long);
|
static unsigned long long convert(unsigned long long);
|
||||||
static char2 convert(unsigned long long);
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static constexpr type select() {
|
static constexpr type select() {
|
||||||
return sizeof(convert(std::declval<T>())) == 1 ? INT : LONG_LONG;
|
return sizeof(convert(std::declval<T>())) == sizeof(int) ? INT : LONG_LONG;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user