aboutsummaryrefslogtreecommitdiff
path: root/include/cru/base
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-09-07 19:51:27 +0800
committerYuqian Yang <crupest@crupest.life>2025-09-07 19:51:27 +0800
commitd36ed6c52f679ad0f9a0e89a4e1d09b763f063b8 (patch)
tree6f19180c95de0dc627848835b2497e93ce34b886 /include/cru/base
parent6e04e90a803e9f0fad296d993f26eab076753449 (diff)
downloadcru-d36ed6c52f679ad0f9a0e89a4e1d09b763f063b8.tar.gz
cru-d36ed6c52f679ad0f9a0e89a4e1d09b763f063b8.tar.bz2
cru-d36ed6c52f679ad0f9a0e89a4e1d09b763f063b8.zip
Move ImplementFormatterByToUtf8String.
Diffstat (limited to 'include/cru/base')
-rw-r--r--include/cru/base/Format.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/cru/base/Format.h b/include/cru/base/Format.h
index d5c5ed99..83fda3f1 100644
--- a/include/cru/base/Format.h
+++ b/include/cru/base/Format.h
@@ -151,4 +151,17 @@ template <typename... T>
String String::Format(T&&... args) const {
return cru::Format(*this, std::forward<T>(args)...);
}
+
+template <typename T>
+struct ImplementFormatterByToUtf8String {
+ template <class ParseContext>
+ constexpr ParseContext::iterator parse(ParseContext& ctx) const {
+ return ctx.end();
+ }
+
+ template <class FmtContext>
+ FmtContext::iterator format(const T& object, FmtContext& ctx) const {
+ return std::ranges::copy(ToUtf8String(object), ctx.out()).out;
+ }
+};
} // namespace cru