Hi!
My vector: vector<Appointment> appointments;
If I wish to delete an element in this vector, how can I do that. I know that it is possible to use:
appointments.erase (appointments.begin()+appointmentIndex);
but I have been told that this method isn't safe.
That method is just fine.
It's safe only insofar as the vector contains at least appointmentIndex+1 elements.
You should verify this precondition before trying to erase an element that might not exist.