p-ranav / indicators

Activity Indicators for Modern C++
MIT License
3.04k stars 237 forks source link

How to construct multiprogress with variable? #106

Closed nickhuangxinyu closed 2 years ago

nickhuangxinyu commented 2 years ago

I see the multiprogress construct method as:

indicators::MultiProgress<indicators::ProgressBar, 3> bars; but I want to init it using a variable, like this:

int a = 3;
indicators::MultiProgress<indicators::ProgressBar, a> bars;

Can I achieve this? i think dynamic_process has good method like push_back?

p-ranav commented 2 years ago
int a = 3;
indicators::MultiProgress<indicators::ProgressBar, a> bars;

The above is not possible in C++. MultiProgress is designed for the case where you know the number of progress bars at compile time.

For all other cases, I recommend you use DynamicProgress

couldbejake commented 2 years ago

This is exactly what I was trying to do, I considered using processor directives, I would appreciate this feature.