refactor: got rid of FMT_RUNTIME() as it is not the part of C++20

This commit is contained in:
Mateusz Pusz committed 2021-11-08 18:37:37 +01:00
1 parent 212c9e05f2
commit 9f95799288
5 files changed
+9 -11

No files matched your search

@@ -42,7 +42,6 @@ UNITS_DIAGNOSTIC_IGNORE_SHADOW
UNITS_DIAGNOSTIC_POP
#define STD_FMT fmt
#define FMT_RUNTIME(arg) fmt::runtime(arg)
#define FMT_LOCALE(loc) (loc).template get<std::locale>()
#define FMT_TO_ARG_ID(arg) static_cast<int>(arg)
#define FMT_FROM_ARG_ID(arg) static_cast<size_t>(arg)
@@ -56,7 +55,6 @@ UNITS_DIAGNOSTIC_POP
#include <format>
#define STD_FMT std
#define FMT_RUNTIME(arg) arg
#define FMT_LOCALE(loc) loc
#define FMT_TO_ARG_ID(arg) arg
#define FMT_FROM_ARG_ID(arg) arg
+3 -3
View File
@@ -233,9 +233,9 @@ template<typename CharT, typename Rep, typename OutputIt, typename Locale>
STD_FMT::format_to(to_buffer, "}}");
if (rep_specs.localized) {
return STD_FMT::format_to(out, FMT_LOCALE(loc), FMT_RUNTIME(buffer), val);
return STD_FMT::vformat_to(out, FMT_LOCALE(loc), buffer, STD_FMT::make_format_args(val));
}
return STD_FMT::format_to(out, FMT_RUNTIME(buffer), val);
return STD_FMT::vformat_to(out, buffer, STD_FMT::make_format_args(val));
}
// Creates a global format string
@@ -457,7 +457,7 @@ public:
// Format the `quantity buffer` using specs from `global_format_buffer`
// In the example, equivalent to STD_FMT::format("{:*^10}", "1.2_m")
return STD_FMT::format_to(ctx.out(), FMT_RUNTIME(global_format_buffer), quantity_buffer);
return STD_FMT::vformat_to(ctx.out(), global_format_buffer, STD_FMT::make_format_args(quantity_buffer));
}
}
};