小编Jon*_*han的帖子

这种"常见习语"究竟如何运作?

查看golang的2D切片的文档,无法理解上一个示例中使用的语法:

func main() {
    XSize := 5
    YSize := 5

    // Allocate the top-level slice, the same as before.
    picture := make([][]uint8, YSize) // One row per unit of y.

    // Allocate one large slice to hold all the pixels.
    pixels := make([]uint8, XSize*YSize) // Has type []uint8 even though picture is [][]uint8.

    // Loop over the rows, slicing each row from the front of the remaining pixe ls slice.
    for i := range picture {
        picture[i], pixels …
Run Code Online (Sandbox Code Playgroud)

variable-assignment go slice scanline

1
推荐指数
1
解决办法
65
查看次数

标签 统计

go ×1

scanline ×1

slice ×1

variable-assignment ×1