18 const size_t total_num_iterations,
19 const unsigned int num_intvls)
21 typedef unsigned int uint;
24 const auto& i = current_iteration;
25 const auto& I = num_intvls;
26 const auto& N = total_num_iterations;
32 std::stringstream output;
33 output << std::fixed << std::setprecision(2) << std::setw(7);
36 if ((i+1)==N) { output << 100.0;
return output.str(); }
38 const double dI = std::ceil(
double(N)/I);
42 double x1; std::modf(
double(i-1)/dI,&x1);
43 double x2; std::modf(
double(i )/dI,&x2);
45 if (
uint(x2) !=
uint(x1)) { output << x2*(100.0/I);
return output.str(); }
std::string PrintIterationProgress(size_t current_iteration, size_t total_num_iterations, unsigned int num_intvls=10)