From 8dfd173285df515fe9b41d970321da9d049460f8 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Wed, 9 Oct 2024 23:08:48 +0200 Subject: More work on format --- asl/format.hpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'asl/format.hpp') 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 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); } +// @Todo Use string_view +inline void format(writer* w, const char* fmt) +{ + format_internals::format(w, fmt, nullptr, 0); +} + +template +void AslFormat(formatter& f, const char (&str)[N]) +{ + f.write(str, N - 1); +} + } // namespace asl -- cgit