Thanks a lot!
I've tried pass pointers, but i forgot to pass & in Sort method.
вторник, 20 декабря 2016 г., 0:24:14 UTC+5 пользователь Jan Mercl написал:
>
>
> On Mon, Dec 19, 2016 at 8:16 PM >
> wrote:
>
> > This code does not do anything.
>
> The code does sort the array. It's just the copy of
On Mon, Dec 19, 2016 at 8:16 PM wrote:
> This code does not do anything.
The code does sort the array. It's just the copy of the array passed to
sort.Sort that's get sorted. That's because array is a plain old value
type. A pointer receiver methods fix it:
https://play.golang.org/p/Kgpcm191fo
--
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]https://groups.google.com/d/optout.