Исходники и презентации
This commit is contained in:
12
lessons/maps/mapaccess/main.go
Normal file
12
lessons/maps/mapaccess/main.go
Normal file
@ -0,0 +1,12 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
data := map[int]int{100: 10000}
|
||||
value := data[100]
|
||||
_ = value
|
||||
|
||||
// under hood
|
||||
// pk := unsafe.Pointer(&key)
|
||||
// pv := runtime.mapaccess1(typeOf(data), data, pk)
|
||||
// value := *(*int)(pv)
|
||||
}
|
||||
Reference in New Issue
Block a user