With help in the question Fast and flexible iterator for abstract class I created an abstract GridIterator for an abstract class GridData. Now I am able to use any concrete subclass of GridIterator to iterate through any concrete subclass of GridData.
However, during testing I found out that the virtual operator++ and virtual operator* operators become real bottlenecks of my algorithms. I am wondering if there is anything I can do to speed it up. Because of the abstraction, inlining probably won't work for me?
I'd like to provide a const Iterator as well. I am not sure how to make this work with the current class design. Referring to my original question ( Fast and flexible iterator for abstract class ), can I just create a ConstGridIterator as subclass from a STL forward iterator with const T instead of T? Or do I have to implement a const version of every single iterator class (the GridIterator and baseImpl)?