Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6549710

Browse files
Update graph.hpp
1 parent 0b87c6b commit 6549710

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

taskflow/graph/graph.hpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,20 @@ inline Node::Node(C&& c) : _work {std::forward<C>(c)} {
7575
// Destructor
7676
inline Node::~Node() {
7777
if(_subgraph.has_value()) {
78-
std::vector<std::forward_list<Node>> gs;
79-
gs.emplace_back();
80-
std::swap(gs[0], _subgraph.value());
78+
std::list<Graph> gs;
79+
gs.push_back(std::move(*_subgraph));
8180
_subgraph.reset();
8281
size_t i=0;
8382
while(i<gs.size()) {
8483
auto n = gs[i].begin();
8584
while(n != gs[i].end()) {
8685
if(n->_subgraph.has_value()) {
87-
gs.emplace_back();
88-
std::swap(gs.back(), n->_subgraph.value());
86+
gs.push_back(*(n->_subgraph));
8987
n->_subgraph.reset();
9088
}
91-
n ++;
89+
n++;
9290
}
93-
i ++;
91+
i++;
9492
}
9593
}
9694
}

0 commit comments

Comments
 (0)