Is there any way to create a generic type T that works both of primitive types and custom structs ?
func f[T constraints.Ordered]() will work for any primitive type that supports <,> and ==. Now, I want a type that accepts both primitive types, and custom structs that implement a
Less() method for comparisons.
Do I need to write two methods, one for the primitive type, one for customs structs ? Is there any trick that allows me to write the code only once ?