3 ms·
Unfortunately that is what I've experienced. I direct your attention to sort: https://code.google.com/p/go/source/browse/src/sort/sort.go#232 https://code.goog
by xai3luGi 12y ago
Unfortunately that is what I've experienced.
I direct your attention to sort: https://code.google.com/p/go/source/browse/src/sort/sort.go#232 https://code.google.com/p/go/source/browse/src/sort/sort.go#...
This defines sort on []int and []float64.
If you want to sort a []int32, you have to manually define Int32Slice and copy paste lines 232-237. Copy paste the same lines again for any other slice of built-ins you wish to sort, e.g. uint32, uint64, int64, float32, etc.
They removed the entire set of vector containers now, but for the canonical way to implement IntVector, see https://code.google.com/p/go/source/browse/src/pkg/container/vector/intvector.go?name=weekly.2010-01-27 https://code.google.com/p/go/source/browse/src/pkg/container... -- and compare that to stringvector.go in the same directory. It's almost entirely copy/paste with string substitution to replace int with string.