blob: 98e4e38f4aa3c0276e11e441fefe503068302456 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
package fmtsort
import "reflect"
const brokenNaNs = false
func mapElems(mapValue reflect.Value) ([]reflect.Value, []reflect.Value) {
// Note: this code is arranged to not panic even in the presence
// of a concurrent map update. The runtime is responsible for
// yelling loudly if that happens. See issue 33275.
n := mapValue.Len()
key := make([]reflect.Value, 0, n)
value := make([]reflect.Value, 0, n)
iter := mapValue.MapRange()
for iter.Next() {
key = append(key, iter.Key())
value = append(value, iter.Value())
}
return key, value
}
|