Having a generic interface
type G[T any] interface {
...
}
and reflect.Type
t
, how to instantiate another reflect.Type
which would represent actually G[t]
Eventually the t
it self should be matched against G[t]
func ImplementsG(t reflect.Type) bool {
var gType reflect.Type = ... // instantiate(G, t)
return t.Implements(gType)
}
Aucun commentaire:
Enregistrer un commentaire