Hello,
I would like to write a type constraint which matches types like the following:
type v1 int
func (obj v1) Add(other v1) v1 {
return obj + other
}
type v2 string
func (obj v2) Add(other v2) v2 {
return obj + other
}
This should match anything with an Add() method which can add another item of the same type. I want to be able to write a function like the following:
func Double[Adder ...???...](x Adder) Adder {
return x.Add(x)
}
Many thanks,
Jochen