From f47d5dd8f3bef0332d572fe496f993dc503712d7 Mon Sep 17 00:00:00 2001 From: keqingmoe Date: Fri, 14 Mar 2025 12:33:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=20kqm::string=20=E5=92=8C=20kqm::stri?= =?UTF-8?q?ng=5Fview=20=E6=B7=BB=E5=8A=A0=E6=A0=BC=E5=BC=8F=E5=8C=96?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/string.cppm | 9 +++++++++ module/view.cppm | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/module/string.cppm b/module/string.cppm index 923f3e4..f2fd147 100644 --- a/module/string.cppm +++ b/module/string.cppm @@ -700,3 +700,12 @@ using string = basic_string>; } } + +export template +struct std::formatter, char> : std::formatter +{ + auto format(const kqm::basic_string& s, auto&& ctx) const + { + return std::formatter::format(s.all(), ctx); + } +}; diff --git a/module/view.cppm b/module/view.cppm index 45e55de..59a2eeb 100644 --- a/module/view.cppm +++ b/module/view.cppm @@ -213,3 +213,12 @@ public: }; } + +export template <> +struct std::formatter : std::formatter +{ + auto format(kqm::string_view s, auto&& ctx) const + { + return std::formatter::format(s.to_std_string_view(), ctx); + } +};