#pragma once ///@file #include #include namespace nix { template std::set computeClosure( std::set startElts, std::function(const T &)> getEdges ) { std::set res, queue = std::move(startElts); while (!queue.empty()) { std::set next; for (auto & e : queue) { if (res.insert(e).second) { next.merge(getEdges(e)); } } queue = std::move(next); } return res; } }