This code does not do anything.
package main
import (
"fmt"
"sort"
)
type coll struct{
arr [4]int
}
func (c coll) Len() int{
return len(c.arr)
}
func (c coll) Less(i,j int) bool{
return c.arr[i]<c.arr[j]
}
func (c coll) Swap(i,j int){
c.arr[i],c.arr[j]=c.arr[j],c.arr[i]
}
func main() {
var cc coll
cc.arr[0]=50
cc.arr[1]=34
cc.arr[2]=120
cc.arr[3]=10
sort.Sort(cc)
fmt.Println(cc)
}
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.