aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/map.go
diff options
context:
space:
mode:
authorAlan Donovan <adonovan@google.com>2016-11-23 15:34:08 -0500
committerAlan Donovan <adonovan@google.com>2018-08-22 20:16:01 +0000
commitede59583858bd64a09479f624e989e7c35df0c52 (patch)
treeade2286e0b5149e9dfab30b6125343ef0381862a /src/runtime/map.go
parent8c0425825ced4042eac0439161abe1f22a47d615 (diff)
downloadgo-ede59583858bd64a09479f624e989e7c35df0c52.tar.gz
go-ede59583858bd64a09479f624e989e7c35df0c52.zip
reflect: add Value.MapRange method and MapIter type
Example of use: iter := reflect.ValueOf(m).MapRange() for iter.Next() { k := iter.Key() v := iter.Value() ... } See issue golang/go#11104 Q. Are there any benchmarks that would exercise the new calls to copyval in existing code? Change-Id: Ic469fcab5f1d9d853e76225f89bde01ee1d36e7a Reviewed-on: https://go-review.googlesource.com/33572 Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/map.go')
-rw-r--r--src/runtime/map.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/runtime/map.go b/src/runtime/map.go
index 208c92cb0d..c03e745dc5 100644
--- a/src/runtime/map.go
+++ b/src/runtime/map.go
@@ -1282,6 +1282,11 @@ func reflect_mapiterkey(it *hiter) unsafe.Pointer {
return it.key
}
+//go:linkname reflect_mapitervalue reflect.mapitervalue
+func reflect_mapitervalue(it *hiter) unsafe.Pointer {
+ return it.value
+}
+
//go:linkname reflect_maplen reflect.maplen
func reflect_maplen(h *hmap) int {
if h == nil {