From 79c478cd0c02bcdb4b2ce948d03be3ce775035f6 Mon Sep 17 00:00:00 2001 From: Artem Golubikhin Date: Mon, 4 Dec 2017 20:11:30 +0300 Subject: [PATCH] Added support for strings containing '\0' in udl (#619) --- include/fmt/format.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index db618a8e..5a410390 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -4093,7 +4093,7 @@ class udl_formatter { # else template struct udl_formatter { - const Char *str; + basic_string_view str; template auto operator()(Args && ... args) const @@ -4105,7 +4105,7 @@ struct udl_formatter { template struct udl_arg { - const Char *str; + basic_string_view str; template named_arg> operator=(T &&value) const { @@ -4134,9 +4134,9 @@ constexpr internal::udl_formatter operator""_format() { \endrst */ inline internal::udl_formatter -operator"" _format(const char *s, std::size_t) { return {s}; } +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}; } +operator"" _format(const wchar_t *s, std::size_t n) { return {s, n}; } # endif // FMT_UDL_TEMPLATE /** @@ -4150,9 +4150,9 @@ operator"" _format(const wchar_t *s, std::size_t) { return {s}; } \endrst */ inline internal::udl_arg -operator"" _a(const char *s, std::size_t) { return {s}; } +operator"" _a(const char *s, std::size_t n) { return {s, n}; } inline internal::udl_arg -operator"" _a(const wchar_t *s, std::size_t) { return {s}; } +operator"" _a(const wchar_t *s, std::size_t n) { return {s, n}; } } // inline namespace literals } // namespace fmt #endif // FMT_USE_USER_DEFINED_LITERALS