[FIX] correctly handle iterators in templated classes

- store the mapping of the template arguments and use that to resolve
  their actual type at time of iterator construction