Hi,

Unfortunately I am on vacation without access to my workstation with nim, so 
code will be schematic. This kind of approach works for me:
    
    
    type InlineIterator[T] = iterator: T {.inline.}
    
    let s = @[1, 2, 3, 4, 5]
    
    iterator values: type(s[0]) {.inline.} =
      # Make argumentless iterator
      for val in s:
        yield val
    
    
    iterator enumerate[T](it: InlineIterator[T]): (int,T) {.inline.} =
      var i = 0
      for val in it():
        yield (i, val)
        inc i
    
    for tup in enumerate(values):
      echo tup
    
    

Reply via email to