From 4efce20c625a10726bee2dffe5c448de80acec08 Mon Sep 17 00:00:00 2001 From: Ezekiel Warren Date: Tue, 2 Jul 2024 12:27:41 -0700 Subject: [PATCH] fix: correctly wrap std::format --- ecsact/codegen/plugin.hh | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/ecsact/codegen/plugin.hh b/ecsact/codegen/plugin.hh index 4af76c2..1597794 100644 --- a/ecsact/codegen/plugin.hh +++ b/ecsact/codegen/plugin.hh @@ -6,9 +6,7 @@ #include #include #include -#ifdef __cpp_lib_format -# include -#endif +#include #include "ecsact/runtime/common.h" #include "ecsact/codegen/plugin.h" @@ -106,37 +104,35 @@ struct codegen_plugin_context { } } -#ifdef __cpp_lib_format template auto writef(std::format_string fmt, Args&&... args) { - auto str = std::format(fmt, std::make_format_args(args...)); + auto str = std::format(fmt, std::forward(args)...); write_(str.data(), static_cast(str.size())); } template auto info(std::format_string fmt, Args&&... args) { - auto str = std::format(fmt, std::make_format_args(args...)); + auto str = std::format(fmt, std::forward(args)...); report_(ECSACT_CODEGEN_REPORT_INFO, str.data(), str.size()); } template auto warn(std::format_string fmt, Args&&... args) { - auto str = std::format(fmt, std::make_format_args(args...)); + auto str = std::format(fmt, std::forward(args)...); report_(ECSACT_CODEGEN_REPORT_WARNING, str.data(), str.size()); } template auto error(std::format_string fmt, Args&&... args) { - auto str = std::format(fmt, std::make_format_args(args...)); + auto str = std::format(fmt, std::forward(args)...); report_(ECSACT_CODEGEN_REPORT_ERROR, str.data(), str.size()); } template auto fatal(std::format_string fmt, Args&&... args) { - auto str = std::format(fmt, std::make_format_args(args...)); + auto str = std::format(fmt, std::forward(args)...); report_(ECSACT_CODEGEN_REPORT_FATAL, str.data(), str.size()); } -#endif }; } // namespace ecsact