I use a vector to hold connection information for each client in my piece of server sofware.
I'm having a problem when removing elements from my vector when clients disconnect.
When I only have one client connected and therefore one element in the vector, is when the problem is most obvious. Everything is fine until I use either vector.pop_back or vector.erase to remove the element (when the client disconnects). Then my program throws what I think is an execption.
This only happens for the last element in the vector. For example, if two clients connect, I can easily remove the element for the first client without a problem. Then, if I attempt to remove the second (which is now the only element), I get an exception.
If you need specific code snippets, please don't hesitate to ask. I just thought this might be a known issue with vectors.
Any help greatly appreciated. Many thanks,