Official C port of the popular python module, tqdm. Work in progress (pre-alpha)
tqdm
(read taqadum, تقدّم) means "progress" in arabic.
Instantly make your loops show a smart progress meter - just wrap any
iterable with tqdm(iterable)
, and you're done!
#include "tqdm/tqdm.h"
for (int i : tqdm::range(5)) // for(int i = 0; i < 5; i)
...
// even more pythonic
// for(float i = 2.3f; i < 9.1f; i = 0.1f)
for (auto i : tqdm::range(2.3f, 9.1f, 0.1f))
...
// container and iterator wrappers
std::vector<unsigned int> a = {0, 1, 2, 3, 4, 5};
for (auto &i : tqdm::tqdm(a))
for (auto &j : tqdm::tqdm(a.begin(), a.end()))
i = j;
Here's what the output will look like:
76%|████████████████████████████ | 7568/10000 [00:33<00:10, 229.00it/s]
tqdm::range(N)
can be also used as a convenient shortcut for
tqdm::tqdm(std::vector<int>({0, ..., N - 1}))
.
It can also be executed stand-alone with pipes:
$ seq 9999999 | tqdm --unit_scale | wc -l
10.0Mit [00:02, 3.58Mit/s]
9999999
No installation or dependencies are required. tqdm
is header-only.
Simply copy or add the include
directory to your project.
Best-practice recommendation is to add this repo as a submodule to projects.
Once added, simply #include "tqdm/tqdm.h"
.
All source code is hosted on GitHub. Contributions are welcome.
See the CONTRIBUTE.md file for more information.