Transitive closure virtual table.

This commit is contained in:
Nuno Cruces
2024-09-21 11:40:16 +01:00
parent d7376209ee
commit 2526fc8444
4 changed files with 430 additions and 3 deletions

12
internal/util/set.go Normal file
View File

@@ -0,0 +1,12 @@
package util
type Set[E comparable] map[E]struct{}
func (s Set[E]) Add(v E) {
s[v] = struct{}{}
}
func (s Set[E]) Contains(v E) bool {
_, ok := s[v]
return ok
}