t6060.nim 260 B

123456789101112
  1. import tables
  2. type MyTab[A,B] = distinct TableRef[A,B]
  3. proc `$`[A,B](t: MyTab[A,B]): string =
  4. "My special table " & $TableRef[A,B](t)
  5. proc create[A,B](): MyTab[A,B] = MyTab(newTable[A,B]())
  6. var a = create[int,int]()
  7. doAssert $a == "My special table {:}"