Code Monkey home page Code Monkey logo

tqdm.cpp's Introduction

tqdm

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

Installation

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".

Contributions

All source code is hosted on GitHub. Contributions are welcome.

See the CONTRIBUTE.md file for more information.

Licence

Open Source (OSI approved):

(Since 9 August 2016)

tqdm.cpp's People

Contributors

adrian17 avatar amallia avatar casperdcl avatar crazypython avatar o11c avatar tdegeus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.