error: no matching function for call to ‘std::vector::erase(int)’
Solution 1:
The problem lies in that std::vector::erase
does not take an integer argument, but rather an iterator to an element in the vector. To erase the first element of a vector, use
vector.erase(vector.begin());
And since begin()
returns a random access iterator, you can remove an element at index i by calling:
vector.erase(vector.begin() + i);