card_id/common/util/mapcopy.go

10 lines
149 B
Go
Raw Normal View History

2022-04-13 23:09:58 +00:00
package util
func CopyMap[T comparable, V any](m map[T]V) map[T]V {
cp := make(map[T]V, len(m))
for k, v := range m {
cp[k] = v
}
return cp
}