From bfce29ffef27a47cdd9c526963b230ae977c41bb Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 2 Feb 2018 18:40:36 -0800 Subject: [PATCH] Improve conversion --- include/fmt/core.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 697f4a60..45d8dd37 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -402,18 +402,17 @@ FMT_DISABLE_CONVERSION_TO_INT(long double); // Disambiguates conversions to different integral types. struct type_selector { - using char2 = struct { char a[2]; }; - static char convert(...); - static char convert(int); - static char convert(unsigned); - static char convert(long); - static char convert(unsigned long); - static char2 convert(long long); - static char2 convert(unsigned long long); + static int convert(...); + static int convert(int); + static unsigned convert(unsigned); + static long convert(long); + static unsigned long convert(unsigned long); + static long long convert(long long); + static unsigned long long convert(unsigned long long); template static constexpr type select() { - return sizeof(convert(std::declval())) == 1 ? INT : LONG_LONG; + return sizeof(convert(std::declval())) == sizeof(int) ? INT : LONG_LONG; } };