I have a list of pairs of (0-based offset) indices into a vector, and I want to index into this vector but skip over the ranges defined by the index pairs. For example:
vector = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
ranges to skip = {[3, 6), [7, 8)}
print out all elements of vector via some indexer function
output = 1, 2, 3, 7, 9, 10
How would I implement this? i.e what should "ranges to skip" be (std::map
?) and what would the algorithm for the indexer function be?