diff --git a/include/fmt/format.h b/include/fmt/format.h index 750677d0..628d68d6 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3466,7 +3466,7 @@ template class udl_formatter { }; # else template struct udl_formatter { - const Char* str; + basic_string_view str; template auto operator()(Args&&... args) const @@ -3477,7 +3477,7 @@ template struct udl_formatter { # endif // FMT_USE_UDL_TEMPLATE template struct udl_arg { - const Char* str; + basic_string_view str; template named_arg operator=(T&& value) const { return {str, std::forward(value)}; @@ -3508,13 +3508,13 @@ FMT_CONSTEXPR internal::udl_formatter operator""_format() { std::string message = "The answer is {}"_format(42); \endrst */ -inline internal::udl_formatter operator"" _format(const char* s, - std::size_t) { - return {s}; +FMT_CONSTEXPR internal::udl_formatter operator"" _format(const char* s, + std::size_t n) { + return {{s, n}}; } -inline internal::udl_formatter operator"" _format(const wchar_t* s, - std::size_t) { - return {s}; +FMT_CONSTEXPR internal::udl_formatter operator"" _format( + const wchar_t* s, std::size_t n) { + return {{s, n}}; } # endif // FMT_USE_UDL_TEMPLATE