diff options
Diffstat (limited to 'src/lib/container/array/array.go')
-rw-r--r-- | src/lib/container/array/array.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/container/array/array.go b/src/lib/container/array/array.go index 97f2c4397..95ed6c2ec 100644 --- a/src/lib/container/array/array.go +++ b/src/lib/container/array/array.go @@ -111,6 +111,17 @@ func (p *Array) Pop() Element { // Partial SortInterface support + +export type LessInterface interface { + Less(y Element) bool +} + + +func (p *Array) Less(i, j int) bool { + return p.a[i].(LessInterface).Less(p.a[j]) +} + + func (p *Array) Swap(i, j int) { a := p.a; a[i], a[j] = a[j], a[i] |