There's always a macro for that, isn't there.
    
    
    import macros,std/genasts
    macro cxxiter(x:ForLoopStmt):untyped =
      let
        it = x[0]
        iter = x[1][1]
        body = x[2]
      result = genAst(it,iter,body):
        var
          v{.nodecl.} = iter
          itr = v.cxbegin()
        while itr != v.cxend():
          let it = itr[]
          body
          inc itr
    
    
    Run

<https://play.nim-lang.org/#ix=3Sjj>

Reply via email to