diff --git a/include/fmt/core.h b/include/fmt/core.h index 5d458b7c..dbefe110 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -314,6 +314,8 @@ template using remove_cvref_t = typename std::remove_cv>::type; template struct type_identity { using type = T; }; template using type_identity_t = typename type_identity::type; +template +using underlying_t = typename std::underlying_type::type; struct monostate { constexpr monostate() {} @@ -1416,8 +1418,8 @@ template struct arg_mapper { !has_fallback_formatter::value)> FMT_CONSTEXPR FMT_INLINE auto map(const T& val) -> decltype(std::declval().map( - static_cast::type>(val))) { - return map(static_cast::type>(val)); + static_cast>(val))) { + return map(static_cast>(val)); } template constexpr bool is_ascii_letter(Char c) { // Converts a character to ASCII. Returns a number > 127 on conversion failure. template ::value)> -constexpr auto to_ascii(Char value) -> Char { - return value; +constexpr auto to_ascii(Char c) -> Char { + return c; } template ::value)> -constexpr auto to_ascii(Char value) -> - typename std::underlying_type::type { - return value; +constexpr auto to_ascii(Char c) -> underlying_t { + return c; } template diff --git a/include/fmt/format.h b/include/fmt/format.h index 996cc999..dcd1d58a 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2354,8 +2354,7 @@ template < type::custom_type, FMT_ENABLE_IF(check)> FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { - return write( - out, static_cast::type>(value)); + return write(out, static_cast>(value)); } template auto ptr(const std::shared_ptr& p) -> const void* { \endrst */ template -constexpr auto underlying(Enum e) noexcept -> - typename std::underlying_type::type { - return static_cast::type>(e); +constexpr auto underlying(Enum e) noexcept -> underlying_t { + return static_cast>(e); } #ifdef __cpp_lib_byte