From 9d5ad7e0cd599cb4bf6386a831f0f4918c7f2c8f Mon Sep 17 00:00:00 2001 From: Alexey Ochapov Date: Tue, 18 Aug 2020 19:57:31 +0300 Subject: [PATCH] add support for fallback_formatter in detail::write --- include/fmt/format.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 7dbe90c2..a862309a 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1841,7 +1841,9 @@ OutputIt write(OutputIt out, const void* value) { return write_ptr(out, to_uintptr(value), nullptr); } -template +template >::value)> auto write(OutputIt out, const T& value) -> typename std::enable_if< mapped_type_constant>::value == type::custom_type, @@ -1850,6 +1852,17 @@ auto write(OutputIt out, const T& value) -> typename std::enable_if< return formatter().format(value, ctx); } +template >::value)> +auto write(OutputIt out, const T& value) -> typename std::enable_if< + mapped_type_constant>::value == + type::custom_type, + OutputIt>::type { + basic_format_context ctx(out, {}, {}); + return fallback_formatter().format(value, ctx); +} + // An argument visitor that formats the argument and writes it via the output // iterator. It's a class and not a generic lambda for compatibility with C++11. template struct default_arg_formatter {