use fmt::format() for error_stats output.

This commit is contained in:
Axel Kohlmeyer 2020-06-13 02:11:21 -04:00
parent 9c3d108bbc
commit d5d28bcbd2
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
1 changed files with 3 additions and 12 deletions

View File

@ -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;
}