diff --git a/include/fmt/std.h b/include/fmt/std.h index fe1c2c47..227f4841 100644 --- a/include/fmt/std.h +++ b/include/fmt/std.h @@ -58,6 +58,9 @@ inline void write_escaped_path( } // namespace detail #if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1920 +// For MSVC 2017 and earlier using the partial specialization +// would cause an ambiguity error, therefore we provide it only +// conditionally. template struct formatter : formatter> { @@ -70,32 +73,6 @@ struct formatter basic_string_view(quoted.data(), quoted.size()), ctx); } }; -#else -// Workaround for MSVC 2017 and earlier. -template <> -struct formatter - : formatter> { - template - auto format(const std::filesystem::path& p, FormatContext& ctx) const -> - typename FormatContext::iterator { - basic_memory_buffer quoted; - detail::write_escaped_path(quoted, p); - return formatter>::format( - basic_string_view(quoted.data(), quoted.size()), ctx); - } -}; -template <> -struct formatter - : formatter> { - template - auto format(const std::filesystem::path& p, FormatContext& ctx) const -> - typename FormatContext::iterator { - basic_memory_buffer quoted; - detail::write_escaped_path(quoted, p); - return formatter>::format( - basic_string_view(quoted.data(), quoted.size()), ctx); - } -}; #endif FMT_END_NAMESPACE #endif