diff options
author | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2024-10-09 23:08:48 +0200 |
---|---|---|
committer | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2024-12-20 15:35:58 +0100 |
commit | 8dfd173285df515fe9b41d970321da9d049460f8 (patch) | |
tree | 570b3ffbbe53ffee6a2d7d08646bfa448b95a509 /asl/format.hpp | |
parent | 0e7999f2d147b026aaee6693bdd2be2cb4a2519e (diff) |
More work on format
Diffstat (limited to 'asl/format.hpp')
-rw-r--r-- | asl/format.hpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/asl/format.hpp b/asl/format.hpp index 6cffd3a..1b4088e 100644 --- a/asl/format.hpp +++ b/asl/format.hpp @@ -51,7 +51,7 @@ struct type_erased_arg // @Todo Use span
void format(writer*, const char* fmt, const type_erased_arg* args, int64_t arg_count);
-} // internals
+} // namespace internals
class formatter
{
@@ -73,7 +73,7 @@ public: template<typename... Args>
void format(writer* w, const char* fmt, const Args&... args)
{
- auto type_erased_args[] = {
+ format_internals::type_erased_arg type_erased_args[] = {
format_internals::type_erased_arg(args)...
};
@@ -81,4 +81,16 @@ void format(writer* w, const char* fmt, const Args&... args) format_internals::format(w, fmt, type_erased_args, types_count<Args...>);
}
+// @Todo Use string_view
+inline void format(writer* w, const char* fmt)
+{
+ format_internals::format(w, fmt, nullptr, 0);
+}
+
+template<int64_t N>
+void AslFormat(formatter& f, const char (&str)[N])
+{
+ f.write(str, N - 1);
+}
+
} // namespace asl
|