Suppose we have a function foo that does something for all elements between *firsta and *lastb :
foo(RandomAccessIterator1 firsta,RandomAccessIterator1 lasta){ for (RandomAccessIterator1 it=firsta;it!=lasta+1;it++){
question a): is there a way to skip the index firsta<i<lastb only changing the inputs to foo --eg random iterators, in other words, without changing the foo itself, only its input?
- Unfortunately, the index that I want to skip is not in the edges (they often are deep between firsta and lasta ) and foo is a complex division and rest algorithm that cannot be called up to call subsets of the original array, iterators point to.
Question b): if you do a) is it possible what is this cost? constant or dependent on (lasta-firsta) ?
source share