← 返回卡片

原书出处

Go 语言高性能编程

11 Go 空结构体 struct{} 的使用

核验版本的摘录快照 · 导入于 2026-10-25T19:55:30.780Z

将 map 作为集合(Set)使用时,可以将值类型定义为空结构体,仅作为占位符使用即可。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 type Set map[string]struct{} func (s S

此预览只包含定位所需的摘录和上下文。

原书定位详情

来源:a19c7933-4eda-4176-aebd-30fe7e1ad292

正文位置:extracted/Go 语言高性能编程/_epub-src/OEBPS/Text/11.html

EPUB SHA-256:865057eb3da7c4612e68f146cf9ea0072d2926325dc9d30c623e51f6b2398f12