diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-04-02 13:22:28 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-04-02 13:22:28 +0200 |
| commit | e7af7ceea2324dcf7d2222986c09d1c478ee4c7e (patch) | |
| tree | 9316248d94d385587520706085a551d772a98837 | |
| parent | a2ff4ace21699fe2be2e0401af78790c01f78d85 (diff) | |
| download | teachos-e7af7ceea2324dcf7d2222986c09d1c478ee4c7e.tar.xz teachos-e7af7ceea2324dcf7d2222986c09d1c478ee4c7e.zip | |
kstd: make string formattable
| -rw-r--r-- | libs/kstd/include/kstd/string | 13 |
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 |
