tusertypeclasses2.nim 358 B

12345678910111213141516171819202122232425
  1. type
  2. hasFieldX = concept z
  3. z.x is int
  4. obj_x = object
  5. x: int
  6. ref_obj_x = ref object
  7. x: int
  8. ref_to_obj_x = ref obj_x
  9. p_o_x = ptr obj_x
  10. v_o_x = var obj_x
  11. template check(x) =
  12. static: assert(x)
  13. check obj_x is hasFieldX
  14. check ref_obj_x is hasFieldX
  15. check ref_to_obj_x is hasFieldX
  16. check p_o_x is hasFieldX
  17. check v_o_x is hasFieldX