Best way to erase vector of ranges from std::vector
问题 In one of my projects it is necessary to remove certain elements from a std::vector<double> values . The indices I have to remove are given as a vector of intervals. For example {1,3} means, that I have to remove indices from 1 to 3 inclusive from values . I can assume that the intervals given are mutually exclusive. The code shown below illustrates, what the desired behavior should look like. #include <iostream> #include <vector> int main(int argc, char** args) { // Intervals of indices I