Copyright (c) 2015, Emir Pasic. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

package utils

import 
Sort sorts values (in-place) with respect to the given comparator. Uses Go's sort (hybrid of quicksort for large and then insertion sort for smaller slices).
func ( []interface{},  Comparator) {
	sort.Sort(sortable{, })
}

type sortable struct {
	values     []interface{}
	comparator Comparator
}

func ( sortable) () int {
	return len(.values)
}
func ( sortable) (,  int) {
	.values[], .values[] = .values[], .values[]
}
func ( sortable) (,  int) bool {
	return .comparator(.values[], .values[]) < 0