This topic created in 1689 days ago, the information mentioned may be changed or developed.
4 replies • 2022-04-01 01:56:35 +08:00
 |
|
顺便问个问题:泛型如何断言
|
 |
|
新特性吗? 我从来都是 map+interface 干到底
|
 |
|
类型断言的话,需要在参数前面用 any 或者 interface 转一下
if _, ok := (any)(key).(string); ok {
|
 |
|
增加泛型之后终于有了类型安全的集合操作库,体验比之前好多了。 不过不支持泛型方法还是差点意思。
|