diff --git a/include/fmt/core.h b/include/fmt/core.h index 9e744cae..134934d9 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -795,17 +795,27 @@ FMT_MAKE_VALUE(cstring_type, typename C::char_type*, const typename C::char_type*) FMT_MAKE_VALUE(cstring_type, const typename C::char_type*, const typename C::char_type*) - FMT_MAKE_VALUE(cstring_type, signed char*, const signed char*) FMT_MAKE_VALUE_SAME(cstring_type, const signed char*) FMT_MAKE_VALUE(cstring_type, unsigned char*, const unsigned char*) FMT_MAKE_VALUE_SAME(cstring_type, const unsigned char*) -FMT_MAKE_VALUE_SAME(string_type, basic_string_view) -FMT_MAKE_VALUE(string_type, - typename basic_string_view::type, - basic_string_view) -FMT_MAKE_VALUE(string_type, const std::basic_string&, - basic_string_view) + +template ::value)> +FMT_CONSTEXPR11 init, string_type> +make_value(const S& val) { + static_assert(std::is_same>::value, + "mismatch between char-types of context and argument"); + return to_string_view(val); +} + +template < + typename C, typename T, typename Char = typename C::char_type, + FMT_ENABLE_IF(std::is_constructible, T>::value && + !internal::is_string::value)> +inline init, string_type> make_value(const T& val) { + return basic_string_view(val); +} + FMT_MAKE_VALUE(pointer_type, void*, const void*) FMT_MAKE_VALUE_SAME(pointer_type, const void*) FMT_MAKE_VALUE(pointer_type, std::nullptr_t, const void*) @@ -827,14 +837,6 @@ inline init make_value(const T& val) { return static_cast(val); } -template < - typename C, typename T, typename Char = typename C::char_type, - FMT_ENABLE_IF(std::is_constructible, T>::value && - !internal::is_string::value)> -inline init, string_type> make_value(const T& val) { - return basic_string_view(val); -} - // Implicit conversion to std::string is disallowed because it would be unsafe: // https://github.com/fmtlib/fmt/issues/729 template < @@ -857,15 +859,6 @@ init make_value( return static_cast(&val); } -template ::value)> -FMT_CONSTEXPR11 init, string_type> -make_value(const S& val) { - // Handle adapted strings. - static_assert(std::is_same>::value, - "mismatch between char-types of context and argument"); - return to_string_view(val); -} - // Maximum number of arguments with packed types. enum { max_packed_args = 15 }; enum : unsigned long long { is_unpacked_bit = 1ull << 63 }; @@ -1313,11 +1306,9 @@ template struct named_arg : named_arg_base { : named_arg_base(name), value(val) {} }; -template ::value)> +template ::value)> inline void check_format_string(const S&) {} -template ::value)> +template ::value)> void check_format_string(S); template >