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