---
# System prepended metadata

title: 泛型
tags: [Go]

---

# 泛型

https://www.youtube.com/watch?v=rsUwIsyO2e8
必看

https://www.readfog.com/a/1724224105368096768
![](https://i.imgur.com/Ztudd0o.png)


## Type parameters(类型参数)
## generic types(泛型类型)
![](https://i.imgur.com/HANrS82.png)

## type sets(类型集)
![](https://i.imgur.com/Lmr4D5Z.png)


## 符號
![](https://i.imgur.com/BiOIg4g.png)
![](https://i.imgur.com/bC1jKIo.png)
![](https://i.imgur.com/5cDlrLP.png)
![](https://i.imgur.com/ubw3KlR.png)
## constraint literals(类型限制字面值)
![](https://i.imgur.com/4rtVdMk.png)
## Type inference(类型推导)
![](https://i.imgur.com/cYM8nOe.png)
## 什么时候使用泛型？
![](https://i.imgur.com/8gtwOZx.png)

## 类型参数优先使用在函数而不是方法上
![](https://i.imgur.com/j941tb5.png)

###### tags: `Go`