29 const std::string& name,
30 std::ostream& os = std::cout)
43 size_t denom = max_ <= 100 ? max_ : 100;
44 if (step % (max_ / denom) == 0) {
45 int percent =
static_cast<double>(step * 100) /
46 static_cast<double>(max_);
47 os_ <<
'\r' << name_ <<
" ["
48 << std::string(percent,
'=')
49 << std::string(100 - percent,
' ')
50 <<
"] (" << std::setw(2)
52 <<
"%)" << std::flush;