Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// General version
// Works with multi threaded environment and imposes no constraints
// to the for() loop. This means that can be used inside a #pragma
// without problems.
pr = progress(range(0,10), io, ASCII)
for (int i=0; i<10; i++)
{
/* Do stuff */
pr.print_progress()
}
pr.complete();
// Compact version
// The current one, exploits the range-based loop
for (auto it : progress(range(0, 10), io, ASCII))
{
/* Do stuff */
}
// Compact version + condition
for (auto it : progress(range(0, 10), io, ASCII, [&]() {condition}))
{
/* Do stuff */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.