func SortAndDeduplicate[T comparable](a *[]T, less func(i, j int) bool) {
	// TODO: maybe another verson of this function for non-comparable types (e.g: passing an equals() function or using
	// an interface) would be useful.
	sort.SliceStable(*a, less)

	j := 0
	for i := 1; i < len(*a); i++ {
		if (*a)[j] == (*a)[i] {
			continue
		}
		j++
		(*a)[j] = (*a)[i]
	}
	*a = (*a)[:j+1]
}
// SortAndDeduplicate sorts the given slice and removes duplicate elements.
SortAndDeduplicate sorts the given slice and removes duplicate elements.
// SortAndDeduplicate sorts the given slice and removes duplicate elements .
func SortAndDeduplicate[T comparable](a *[]T, less func(i, j int) bool) {
	sort.SliceStable(*a, less)
	j := 0
	for i := 1; i < len(*a); i++ {
		if (*a)[j] == (*a)[i] {
			continue
		}
		j++
		(*a)[j] = (*a)[i]
	}
	*a = (*a)[:j+1]
}
func SortAndDeduplicate [ T comparable ] ( a * [ ] T , less func ( i , j int ) bool ) { sort . SliceStable ( * a , less ) j := 0 for i := 1 ; i < len ( * a ) ; i ++ { if ( * a ) [ j ] == ( * a ) [ i ] { continue } j ++ ( * a ) [ j ] = ( * a ) [ i ] } * a = ( * a ) [ : j + 1 ] }
SortAndDeduplicate sorts the given slice and removes duplicate elements.
SortAndDeduplicate sorts the given slice and removes duplicate elements .
// TODO: maybe another verson of this function for non-comparable types (e.g: passing an equals() function or using // an interface) would be useful.