Skip to content
/ cpptqdm Public

(unofficial) tqdm-like single header c++ pretty progress bar

License

Notifications You must be signed in to change notification settings

aminnj/cpptqdm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cpptqdm

Python tqdm is nice. Need something similar for C++. That's this.

Simple usage

#include "tqdm.h"

tqdm bar;
for(int i = 0; i < N; i++) {
    bar.progress(i, N);
    // stuff
}
bar.finish();

Looks like

 █████████████████▍                  | 46.2%  [4200000 | 103.66 kHz | 35s<47s]

See it live

g++ test.cpp -std=c++11 && ./a.out

example

FAQ

Won't this slow down my loops?

If your loops are faster than ~200MHz, then maybe!

Themes?

You bet. set_theme_basic(), set_theme_line(), set_theme_circles().

For fun, what if I wanted to use this in python?

If you have ROOT, you can do the following. Note that due to the fact it uses ROOT to call C++ code in Python, loops faster than 1kHz start to get slowed down by the overhead.

import time
import ROOT as r

r.gROOT.ProcessLine(".L tqdm.h")

bar = r.tqdm()

N = 10000
for i in range(N):
    bar.progress(i,N)
    time.sleep(0.001)

About

(unofficial) tqdm-like single header c++ pretty progress bar

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages