Last active
June 2, 2017 21:51
-
-
Save geektoni/9f792c007a0c8dc801b2937337bea926 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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