vector<>::end() does mot point to the last object in the queue. It points to one object past the last one. If you want to get the last object use vector<>::back().
vector<>::end() does mot point to the last object in the queue. It points to one object past the last one. If you want to get the last object use vector<>::back().