1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-22 08:51:08 +01:00

Cleanup: Use C++23 "explicit this" for recursive lambdas

Try to pass by reference where possible.

Co-authored-by: Sergei Zimmerman <sergei@zimmerman.foo>
This commit is contained in:
Eelco Dolstra 2025-10-29 15:17:37 +01:00 committed by John Ericson
parent 3b2186e1c8
commit 1507843f6c
15 changed files with 60 additions and 112 deletions

View file

@ -14,9 +14,7 @@ std::vector<T> topoSort(
std::vector<T> sorted;
decltype(items) visited, parents;
std::function<void(const T & path, const T * parent)> dfsVisit;
dfsVisit = [&](const T & path, const T * parent) {
auto dfsVisit = [&](this auto & dfsVisit, const T & path, const T * parent) {
if (parents.count(path))
throw makeCycleError(path, *parent);