在学习切片时,我有一个疑问:append() 是否总是扩展所需的最小容量?
a := make([]byte, 0)
a = append(a, 1, 2, 3)
cap(a) == 3 // will this be always true?
// or the assumption may not hold since the underlying implementation of append()
// is not specified.
呼啦一阵风
摇曳的蔷薇
相关分类