Guest User

Untitled

a guest
Jan 23rd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. template repeatStmt(N: int, code: stmt) : stmt =
  2. when N > 0:
  3. code
  4. repeatStmt(N-1, code)
  5.  
  6. template repeatTemplate(N: int, tmpl: expr) : stmt =
  7. when > 0:
  8. tmpl(N)
  9. repeatTemplate(N-1, tmpl)
  10.  
  11. template createOverload(N: int) =
  12. # magically create overload here for tuple with 3 fields
  13.  
  14. repeatTemplate(10, createOverload)
Add Comment
Please, Sign In to add comment