I am having trouble erasing part of a vector. I have a vector (string) named master
. It is verified (through the size() function) to be 500 elements in size. I am trying to erase a range of elements, starting from zero to a variable named r.
From what I see online this should be very straightforward but after reading documentation I still cannot figure this out. This is my code :
int r = 100;
master.erase(0,r);
The compiler is giving me this error :
[Error] no matching function for call to 'std::vectorstd::__cxx11::basic_string<char >::erase(int, int&)'
... Which after searching this online seems to come up often when people try to add a variable with a different type to the vector. However I am not doing that. I just have a vector where all the elements are strings and I want to erase a range.
What am I doing wrong?