arrays - 当 slice 的最大长度小于底层数组的长度时, slice 的术语 “dynamically sized” 如何合理?

标签 arrays go slice

来自 A Tour of Go :

An array has a fixed size. A slice, on the other hand, is a dynamically-sized, flexible view into the elements of an array.



当 slice 不能超出底层数组的大小时,如何将 slice 称为动态大小。

最佳答案

Go 数组的大小在编译时是固定的。 Go slice 的大小在运行时动态设置。

引用:

The Go Blog: Go Slices: usage and internals

The Go Blog: Arrays, slices (and strings): The mechanics of 'append'

关于arrays - 当 slice 的最大长度小于底层数组的长度时, slice 的术语 “dynamically sized” 如何合理?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59235575/

相关文章:

go - 运行时没有任何反应 go get github.com/astaxie/beego

python - 如何使用 `slice` 对象读取 pytables.CArray?

arrays - 如何编写内部数组长度不同的嵌套数组?

arrays - ISBLANK(...) = FALSE 即使单元格在谷歌表格中为空白

arrays - 我应该如何获取作为 Int 通过测试的对象的最后一个索引?

go - 如何在 Go 中获得 "virtualhost"功能?

java - JSONArray 类型的 add(String) 方法未定义

go - golang中 `iota`的全称是什么?

python - 如何在 Tensorflow 中对无维度的张量进行切片

python - 分配给python中的不连续切片