Gipert Progressbar Save

An embarassingly simple progress bar for C++ loops

Project README

progressbar

A very simple, header-only, fully customizable, progress bar (with percentage) for c++ loops.

Very simple to set up:

#include "progressbar.hpp"

int main() {
    progressbar bar(100);
    for (int i = 0; i < 100; ++i) {
        bar.update();
        // ... the program
    }
    return 0;
}

animated gif

Allows customization:

#include "progressbar.hpp"

int main() {
    progressbar bar(100);
    bar.set_todo_char(" ");
    bar.set_done_char("█");
    bar.set_opening_bracket_char("{");
    bar.set_closing_bracket_char("}");
    for (int i = 0; i < 100; ++i) {
        bar.update();
        // ... the program
    }
    return 0;
}

animated gif

Notes

To use the bar in parallelized loops call progressbar::update in a critical section. With OpenMP this can be achieved with the following structure:

#pragma omp parallel for
for ( ... ) {
    #pragma omp critical
        bar.update();
}
Open Source Agenda is not affiliated with "Gipert Progressbar" Project. README Source: gipert/progressbar
Stars
182
Open Issues
2
Last Commit
1 year ago
Repository
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating