add support for fallback_formatter in detail::write
This commit is contained in:
parent
951e0d2333
commit
9d5ad7e0cd
@ -1841,7 +1841,9 @@ OutputIt write(OutputIt out, const void* value) {
|
||||
return write_ptr<Char>(out, to_uintptr(value), nullptr);
|
||||
}
|
||||
|
||||
template <typename Char, typename OutputIt, typename T>
|
||||
template <typename Char, typename OutputIt, typename T,
|
||||
FMT_ENABLE_IF(
|
||||
has_formatter<T, basic_format_context<OutputIt, Char>>::value)>
|
||||
auto write(OutputIt out, const T& value) -> typename std::enable_if<
|
||||
mapped_type_constant<T, basic_format_context<OutputIt, Char>>::value ==
|
||||
type::custom_type,
|
||||
@ -1850,6 +1852,17 @@ auto write(OutputIt out, const T& value) -> typename std::enable_if<
|
||||
return formatter<T>().format(value, ctx);
|
||||
}
|
||||
|
||||
template <typename Char, typename OutputIt, typename T,
|
||||
FMT_ENABLE_IF(has_fallback_formatter<
|
||||
T, basic_format_context<OutputIt, Char>>::value)>
|
||||
auto write(OutputIt out, const T& value) -> typename std::enable_if<
|
||||
mapped_type_constant<T, basic_format_context<OutputIt, Char>>::value ==
|
||||
type::custom_type,
|
||||
OutputIt>::type {
|
||||
basic_format_context<OutputIt, Char> ctx(out, {}, {});
|
||||
return fallback_formatter<T>().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 <typename OutputIt, typename Char> struct default_arg_formatter {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user