Help with deleting a string object in vector

Here's my code so far:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
case DELETE_TITLE:
	std::cout << "Game to remove from list: ";
	std::cin.ignore();
	getline(std::cin, gameTitle);

	for (iter = gameList.begin(); iter != gameList.end(); ++iter)
	{
		if (gameTitle == *iter)
		{
			std::cout << "Found in list\n";

			std::cout << gameTitle << " was removed from your list.\n";
		        //gameList[std::distance(gameList.begin(), std::find(gameList.begin(), gameList.end(), gameTitle))].erase();
			// Tryed but it doesn't work :o please help and explain a solution if you can would help greatly!
		}
	}
break;


It deletes the text from the string but not the index it self.
It deletes the text but when I print the list of game titles it has it there blank. I want it to completely remove the object from the vector from where it was deleted
why didn't you use

1
2
3
4
5
6
if (gameTitle == *iter)
		{
			std::cout << "Found in list\n";
                        gameList.erase(iter);
                        break;
		}
Topic archived. No new replies allowed.