Skip to content

Commit 68971e4

Browse files
Lift out lambda
1 parent ac58ee6 commit 68971e4

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/support/graph_traversal.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ template<typename T, typename SuccessorFunction>
3939
std::vector<T> stack(roots.begin(), roots.end());
4040
std::unordered_set<T> visited(roots.begin(), roots.end());
4141

42+
auto maybePush = [&](const T& t) {
43+
if (visited.contains(t)) {
44+
return;
45+
}
46+
47+
visited.insert(t);
48+
stack.push_back(t);
49+
};
50+
4251
while (!stack.empty()) {
4352
auto curr = std::move(stack.back());
4453
stack.pop_back();
4554

46-
auto maybePush = [&](const T& t) {
47-
if (visited.contains(t)) {
48-
return;
49-
}
50-
51-
visited.insert(t);
52-
stack.push_back(t);
53-
};
54-
5555
successors(maybePush, curr);
5656
}
5757

0 commit comments

Comments
 (0)