I want to have a slice of structs with a generic. The generic is an interface with a type constraint.
type constraint interface {
int32 | uint32
}
type a[T constraint] struct {
something T
}
type b struct {
as []a[constraint] // doesn't work
}
How do I make it so i can use both a[int32] and a[uint32] as elements in b.as?
What I am trying to do is not possible in the way I am proposing. This is because
a[int32]anda[uint32]are different types. I need to create an internal interface that onlyaimplements and create an array of that.