On Thu, Jul 23, 2020 at 5:27 PM Robert Solomon wrote:
>
> Hi. I'm going thru the example code for container/heap. In the
> documentation is this example:
>
> func (h *IntHeap) Pop() interface{} {
> old := *h
> n := len(old)
> x := old[n-1]
> *h = old[0 : n-1] // my question is about this line
Hi. I'm going thru the example code for container/heap. In the
documentation is this example:
func (h *IntHeap) Pop() interface{} {
old := *h
n := len(old)
x := old[n-1]
*h = old[0 : n-1] // my question is about this line.
return x
}
Why does the last assignment have to assign to a dereferen