I have class Range
which holds a interval like <2,10>
or <-50,900>
and than I have RangeList
and I want to have vector<long long>
which represents multiple ranges. I don't need to have vector<Range>
for some purpose.
But i want to make iterator that will go through ranges
and it will retrun Range. Is it possible to define custom iterator that will work like that?
class Range {
long long lo;
long long hi;
}
class RangeList {
vector<long long> ranges;
}
example
ranges={1, 50, 200, 700, 900, 1000};
so iterator will go through and it would return
first iteration
Range <1,50>
secondi teration
Range <200,700>
third teration
Range <900,100>
Thanks for any advice