This works..(Note - `rightSize` has been around since Nim-0.10.2, but checking 
its actual declaration is cleanest): 
    
    
    import tables
    
    template iniTab(capacity=2): untyped {.dirty.} =
      when declared(tables.rightSize)and(NimMajor,NimMinor)<(1,4):
        initTable[int,int](rightSize(capacity))
      else:
        initTable[int,int](capacity)
    
    var j = iniTab(4)
    
    
    Run

..but you cannot put generic parameters on the `template` and pass them through 
on the `template iniTab`. So, it does not quite work for `lrucache`'s use case.

Reply via email to