Copying all elements of a map into another

后端 未结 3 1491
长发绾君心
长发绾君心 2020-12-15 02:15

Given

var dst, src map[K]V

I can copy all entries from src into dst by doing

for k, v := range sr         


        
3条回答
  •  春和景丽
    2020-12-15 02:54

    That looks like a perfectly fine way to do this to me. I don't think copying one map into another is common enough to have a one-liner solution.

提交回复
热议问题