You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

16 lines
271 B

package gentools
func CopyMap[K comparable, V any](m map[K]V) map[K]V {
m2 := make(map[K]V, len(m)+1)
for k, v := range m {
m2[k] = v
}
return m2
}
func OneItemMap[K comparable, V any](key K, value V) map[K]V {
m := make(map[K]V, 1)
m[key] = value
return m
}