您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

24 行
671 B

  1. // Copyright 2018, The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE.md file.
  4. // +build purego
  5. package value
  6. import "reflect"
  7. // Pointer is an opaque typed pointer and is guaranteed to be comparable.
  8. type Pointer struct {
  9. p uintptr
  10. t reflect.Type
  11. }
  12. // PointerOf returns a Pointer from v, which must be a
  13. // reflect.Ptr, reflect.Slice, or reflect.Map.
  14. func PointerOf(v reflect.Value) Pointer {
  15. // NOTE: Storing a pointer as an uintptr is technically incorrect as it
  16. // assumes that the GC implementation does not use a moving collector.
  17. return Pointer{v.Pointer(), v.Type()}
  18. }