【发布时间】:2013-03-09 06:34:55
【问题描述】:
如何获取接口内的值的地址?
我有一个存储在接口中的结构,在 list.List 元素中:
import "container/list"
type retry struct{}
p := &el.Value.(retry)
但我明白了:
cannot take the address of el.Value.(retry)
发生了什么事?既然结构体是存储在接口中的,为什么我得不到指向它的指针呢?
【问题讨论】:
标签: pointers interface go memory-address