mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Merge pull request #2033 from thePHTest/poly-proc
fix sort_by_indices_allocate
This commit is contained in:
@@ -43,7 +43,7 @@ sort_by_indices :: proc{ sort_by_indices_allocate, _sort_by_indices}
|
|||||||
|
|
||||||
sort_by_indices_allocate :: proc(data: $T/[]$E, indices: []int, allocator := context.allocator) -> (sorted: T) {
|
sort_by_indices_allocate :: proc(data: $T/[]$E, indices: []int, allocator := context.allocator) -> (sorted: T) {
|
||||||
assert(len(data) == len(indices))
|
assert(len(data) == len(indices))
|
||||||
sorted = make([]int, len(data), allocator)
|
sorted = make(T, len(data), allocator)
|
||||||
for v, i in indices {
|
for v, i in indices {
|
||||||
sorted[i] = data[v]
|
sorted[i] = data[v]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user