You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

24 lines
339 B

package gentools
func IndexOf[T comparable](arr []T, value T) int {
for i, v := range arr {
if v == value {
return i
}
}
return -1
}
func AddUniques[T comparable](arr *[]T, values ...T) {
Outer:
for _, v := range values {
for _, v2 := range *arr {
if v2 == v {
continue Outer
}
}
*arr = append(*arr, v)
}
}