Skip to content

Add mixin class for an indexed iterator

Simon Praetorius requested to merge feature/indexed-iterator into master

Summary

This MR adds a mixin class for iterators to provide an index() method enumerating the currently visited element during traversal, by incrementing an integer index.

Example

std::vector<int> vec{0,1,2,3,4,5};
auto indexedIt = IndexedIterator{vec.begin()};
auto indexedEnd = IndexedIterator{vec.end()};
for(; indexedIt != indexedEnd; ++indexedIt)
  std::cout << indexedIt.index() << std::endl;
Edited by Simon Praetorius

Merge request reports

Loading