Go语言实践技巧(6)——map key的选择

The map key can be a value from any built-in or struct type as long as the value can be used in an expression with the == operator. Slices, functions, and struct types that contain slices can’t be used as a map key.

 

map key可以使用任何内置类型或结构类型的值,只要这个值可以使用在==表达式中。slice,函数,和包含slice的结构体不能用作key

参考资料:
Go in Action

发表评论

邮箱地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.