t17509.nim 527 B

12345678910111213141516171819202122232425
  1. type List[O] = object
  2. next: ptr List[O]
  3. proc initList[O](l: ptr List[O]) =
  4. l[].next = l
  5. type
  6. PolytopeVertex[R] = object
  7. list: List[PolytopeVertex[R]]
  8. PolytopeEdge[R] = object
  9. list: List[PolytopeEdge[R]]
  10. Polytope[R] = object
  11. vertices: List[PolytopeVertex[R]]
  12. edges: List[PolytopeEdge[R]]
  13. var pt: Polytope[float]
  14. static:
  15. doAssert pt.vertices.next is (ptr List[PolytopeVertex[float]])
  16. doAssert pt.edges.next is (ptr List[PolytopeEdge[float]])
  17. initList(addr pt.vertices)
  18. initList(addr pt.edges)