card_id/common/util/mapcopy.go

10 lines
149 B
Go

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
}