I have two arrays or vectors, say:
int first[] = {0,0,1,1,2,2,3,3,3};
int second[] = {1,3};
I would like to get rid of the 1s and 3s in the first set, set_difference can only get rid of the first occurrences of these values however this is not what I want to have.
Should I do this with remove_copy by iterating on the second range and each time remove one entry from the first set.
What would be the best way to do this in C++?
Write a specialised set_difference:
Then apply it to the problem:
This algorithm is linear (max.
last1-first1 + last2-first2comparisions)