I am wondering if it is possible to get a pointer to a slice element.
Following code:
type Val struct{ key string }
vals := make([]Val, 2)
vals[0] = Val{"A"}
vals[1] = Val{"B"}
ptr := &vals[0]
println(ptr.key)
vals[0] = Val{"C"}
println(ptr.key)
prints A C
It makes sense because we got pointer to first slot of the slice. Is there any way to get pointer to first element of slice without copying?