Improve compile-time checks

This commit is contained in:
Victor Zverovich
2021-05-19 07:57:57 -07:00
parent 21d93bfd33
commit e9c1c415b8
8 changed files with 343 additions and 298 deletions
+3 -3
View File
@@ -149,9 +149,9 @@ template <class charT> struct formatter<std::complex<double>, charT> {
"{:" + specs + "}", c.imag());
auto fill_align_width = std::string();
if (specs_.width > 0) fill_align_width = fmt::format(">{}", specs_.width);
return format_to(
ctx.out(), "{:" + fill_align_width + "}",
fmt::format(c.real() != 0 ? "({0}+{1}i)" : "{1}i", real, imag));
return format_to(ctx.out(), runtime("{:" + fill_align_width + "}"),
c.real() != 0 ? fmt::format("({}+{}i)", real, imag)
: fmt::format("{}i", imag));
}
};
FMT_END_NAMESPACE