diff --git a/include/fmt/core.h b/include/fmt/core.h index 7a3829e8..fcc6a666 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -629,31 +629,20 @@ template class value { } value(const void* val) { pointer = val; } - template < - typename T, - typename std::enable_if< - !is_constructible::type, - internal::dummy_formatter_arg>::value, - int>::type = 0> - explicit value(const T& val) { + template explicit value(const T& val) { custom.value = &val; // Get the formatter type through the context to allow different contexts // have different extension points, e.g. `formatter` for `format` and // `printf_formatter` for `printf`. typedef typename Context::template formatter_type::type formatter; - custom.format = &format_custom_arg; - } - - template < - typename T, - typename std::enable_if< - is_constructible::type, - internal::dummy_formatter_arg>::value, - int>::type = 0> - explicit value(const T& val) { - custom.value = &val; - custom.format = - &format_custom_arg>; + enum { + formattable = + !is_constructible::value + }; + custom.format = &format_custom_arg< + T, typename std::conditional< + formattable, formatter, + internal::fallback_formatter>::type>; } const named_arg_base& as_named_arg() {