#328·taskflow

How to create a dynamic subflow from within an for_each_index operation ie: nested for_each_index.

Author: bradphelanCreated Jun 23, 2021Updated Feb 6, 2025
Labelsenhancement

The example given in the docs is

taskflow.for_each_index(0, 100,  2, [](int i) { });  // 50 loops with a + step

which represents

for(size_t i = 0; i<100;i+=1){}

but how to do a nested loop given that the callback for for_each_index does not pass a subflow object in?

for(size_t i = 0; i<5;i+=1){
    for(size_t j = 0; i < 100; j+=1){
        someTask(i,j);
    }
}