moverload_asgn2.nim 235 B

123456789101112131415
  1. discard """
  2. matrix: "--mm:refc"
  3. """
  4. type
  5. Concrete* = object
  6. a*, b*: string
  7. rc*: int # refcount
  8. proc `=`(d: var Concrete; src: Concrete) =
  9. shallowCopy(d.a, src.a)
  10. shallowCopy(d.b, src.b)
  11. dec d.rc
  12. d.rc = src.rc + 1