Does it set number[2] equal to 0 without changing the vector size,
or does it remove the int held in number[2] and decrement the vector's size by one?
Ultimately what I want to do is have a vector in which I would erase its content one by one,
and I want to check if it's empty with if (numbers.empty()) so if its size is 0.
The erase function takes an iterator as a parameter. Iterators are a topic in their own right, but you can think of it as an object which behaves like a pointer.
Thank you Chervil for the detailed explanation and the sources. I was aware of the .size and .erase functions however I didn't know how .erase interacted with the vector size.
So to triple check if you do this:
numbers.erase(number.begin(), number.end());
numbers.size() should be equal to zero
and the content of numbers should be {}.
It's easy enough to check using the online compiler. If you look at my post above, to the top right of the code there is a gear icon. Click that and it takes you to a page where you can edit, compile and run the code: