我正在尝试使用“Go 编程语言”来学习 Golang,并且我已经到达了切片部分。他们在数组和切片之间进行比较,因为两个数组可以比较,==而两个切片不能比较。正文如下:
"== operator for arrays of strings, it may be puzzling that slice
comparisons do not also work this way. There are two reasons why deep
equivalence is problematic. First, unlike array elements, the elements
of a slice are indirect, making it possible for a slice to contain
itself. Although there are ways to deal with such cases, none is
simple, efficient, and most importantly, obvious."
由于元素是间接的,切片可能包含自身是什么意思?
慕的地8271018
凤凰求蛊
慕神8447489
相关分类