aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-04-02 13:22:28 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-04-02 13:22:28 +0200
commite7af7ceea2324dcf7d2222986c09d1c478ee4c7e (patch)
tree9316248d94d385587520706085a551d772a98837
parenta2ff4ace21699fe2be2e0401af78790c01f78d85 (diff)
downloadteachos-e7af7ceea2324dcf7d2222986c09d1c478ee4c7e.tar.xz
teachos-e7af7ceea2324dcf7d2222986c09d1c478ee4c7e.zip
kstd: make string formattable
-rw-r--r--libs/kstd/include/kstd/string13
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/kstd/include/kstd/string b/libs/kstd/include/kstd/string
index 075422e..4ce19ce 100644
--- a/libs/kstd/include/kstd/string
+++ b/libs/kstd/include/kstd/string
@@ -1,6 +1,10 @@
#ifndef KSTD_STRING_HPP
#define KSTD_STRING_HPP
+#include "kstd/bits/format/context.hpp"
+#include "kstd/bits/format/formatter.hpp"
+#include "kstd/bits/format/formatter/string_view.hpp"
+
#include <kstd/cstring>
#include <kstd/os/error.hpp>
#include <kstd/vector>
@@ -343,6 +347,15 @@ namespace kstd
return !(lhs == rhs);
}
+ template<>
+ struct formatter<string> : formatter<std::string_view>
+ {
+ auto format(string const & str, format_context & context) const -> void
+ {
+ formatter<std::string_view>::format(str.view(), context);
+ }
+ };
+
} // namespace kstd
#endif \ No newline at end of file