Closed shoenig closed 1 year ago
This doesn't really work as of Go 1.19 at least, because Go does not support generic methods using types not declared on the struct, e.g.
func(s *Set[T]) InsertAllFunc(items []E, f func(element E) T )
- no way to declare type E.
Closed by #56
Sometimes I have a []T, but want to create (e.g.) a set from a particular field of T, type S.
Currently have to manually loop and Insert(S), would be nice if we could
InsertFunc(f(T)S)
instead.