use conditional_t inside detail::write instead of 2 overloads
This commit is contained in:
parent
b1a55bc099
commit
6ec1ba5515
@ -1842,25 +1842,17 @@ OutputIt write(OutputIt out, const void* value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename Char, typename OutputIt, typename T,
|
template <typename Char, typename OutputIt, typename T,
|
||||||
FMT_ENABLE_IF(
|
typename Context = basic_format_context<OutputIt, Char>>
|
||||||
has_formatter<T, basic_format_context<OutputIt, Char>>::value)>
|
auto write(OutputIt out, const T& value) ->
|
||||||
auto write(OutputIt out, const T& value) -> typename std::enable_if<
|
typename std::enable_if<mapped_type_constant<T, Context>::value ==
|
||||||
mapped_type_constant<T, basic_format_context<OutputIt, Char>>::value ==
|
type::custom_type,
|
||||||
type::custom_type,
|
OutputIt>::type {
|
||||||
OutputIt>::type {
|
using formatter_type =
|
||||||
basic_format_context<OutputIt, Char> ctx(out, {}, {});
|
conditional_t<has_formatter<T, Context>::value,
|
||||||
return formatter<T>().format(value, ctx);
|
typename Context::template formatter_type<T>,
|
||||||
}
|
fallback_formatter<T, Char>>;
|
||||||
|
Context ctx(out, {}, {});
|
||||||
template <typename Char, typename OutputIt, typename T,
|
return formatter_type().format(value, ctx);
|
||||||
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
|
// An argument visitor that formats the argument and writes it via the output
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user