https://github.com/s-barannikov approved this pull request. FWIW There is also `llvm::set_intersect` that could modify `ContainingSet` in-place. It does not accept a '<' comparator though, so migh not be suitable. https://github.com/llvm/llvm-project/pull/81606