return MakeMapWithSize(typ, 0)
}
-// MakeMapWithSize creates a new map with the specified type and initial capacity.
-func MakeMapWithSize(typ Type, cap int) Value {
+// MakeMapWithSize creates a new map with the specified type
+// and initial space for approximately n elements.
+func MakeMapWithSize(typ Type, n int) Value {
if typ.Kind() != Map {
panic("reflect.MakeMapWithSize of non-map type")
}
- m := makemap(typ.(*rtype), cap)
+ m := makemap(typ.(*rtype), n)
return Value{typ.common(), m, flag(Map)}
}