This declaration means that s
is a slice of any type T
that fulfills the built-in constraint comparable
. x
is also a value of the same type.
func Index[T comparable](s []T, x T) int
Nov 05, 20231 min read
This declaration means that s
is a slice of any type T
that fulfills the built-in constraint comparable
. x
is also a value of the same type.
func Index[T comparable](s []T, x T) int