- xbt_dynar_t next = nullptr, current = xbt_dynar_new(sizeof(SD_task_t),nullptr);
-
- xbt_dynar_foreach(dag,count,task){
- if(task->kind == SD_TASK_COMM_E2E)
- continue;
- task->marked = 0;
- if(task->successors->empty() && task->outputs->empty())
- xbt_dynar_push(current, &task);
- }
- //test if something has to be done for the next iteration
- while(!xbt_dynar_is_empty(current)){
- next = xbt_dynar_new(sizeof(SD_task_t),nullptr);
- //test if the current iteration is done
- xbt_dynar_foreach(current,count_current,task){
- if (task == nullptr)
- continue;
- //push task in next
- task->marked = 1;
- for (SD_task_t it : *task->inputs){
- it->marked = 1;
+ std::vector<SD_task_t> current;
+ xbt_dynar_foreach (dag, count, task)
+ if (task->kind != SD_TASK_COMM_E2E && task->successors->empty() && task->outputs->empty())
+ current.push_back(task);
+
+ while (not current.empty()) {
+ std::vector<SD_task_t> next;
+ for (auto const& t : current) {
+ //Mark task
+ t->marked = true;
+ for (SD_task_t const& input : *t->inputs) {
+ input->marked = true;