From d5d28bcbd2e9cba870f9b00021eb8ea2d80271bb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 13 Jun 2020 02:11:21 -0400 Subject: [PATCH] use fmt::format() for error_stats output. --- unittest/force-styles/error_stats.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/unittest/force-styles/error_stats.cpp b/unittest/force-styles/error_stats.cpp index c58ff4c0ee..a22f299f55 100644 --- a/unittest/force-styles/error_stats.cpp +++ b/unittest/force-styles/error_stats.cpp @@ -47,16 +47,7 @@ double ErrorStats::dev() const std::ostream &operator<<(std::ostream &out, const ErrorStats &stats) { - const std::ios_base::fmtflags flags = out.flags(); - const std::streamsize width = out.width(10); - const std::streamsize prec = out.precision(3); - - out << std::scientific << "Average: " << stats.avg() << " StdDev: " << stats.dev() - << " MaxErr: " << stats.max(); - - out.precision(prec); - out.width(width); - out.flags(flags); - - return out << " @ item: " << stats.idx(); + out << fmt::format("Average: {:10.3e} StdDev: {:10.3e} MaxErr: {:10.3e} @ item: {}", + stats.avg(), stats.dev(), stats.max(), stats.idx()); + return out; }