各种笔记
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.

15 line
720 B

4 年之前
  1. # KeyValue限制
  2. Key一定要是是可比较类型(可以理解为支持 == 的操作)
  3. 非法类型的Key 如果是非法的key类型,会报错:invalid map key type xxx。
  4. 可比较类型 不可比较类型
  5. boolean slice
  6. numeric map
  7. string func
  8. pointer
  9. channel
  10. interface
  11. 包含前文类型的array和struct
  12. # 函数传递
  13. Golang中是没有引用传递的,均为值传递。这意味着传递的是数据的拷贝。
  14. 那么map本身是引用类型,作为形参或返回参数的时候,传递的是值的拷贝,而值是地址,扩容时也不会改变这个地址。