Jump to content
  • Advertisement
Sign in to follow this  
Assassin7257

Iterators & Vectors .erase() issues

This topic is 2510 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


void delete_game()
{
string deleteGame;
string& rDeleteGame = deleteGame;

cout << "Please enter a game to delete: " << endl;
cin >> deleteGame;

iter = find(gameList.begin(), gameList.end(), rDeleteGame);
if (iter != gameList.end())
gameList.erase(*iter);
}


I'm doing this just for fun, all it does it stores some game names the user inputs, and deletes one if the users chooses too. But I'm having problems with deleting the game. Here's the code, anywhere to improve.

Share this post


Link to post
Share on other sites
Advertisement
Fun fact: the actual compiler error contains useful information in determining what the problem is.

Share this post


Link to post
Share on other sites
Are you hooked into a machine that drains a year off your life for every character you type? Unless that's the case I don't understand your reluctance to share information that might help us diagnose your problem. Like the actual complete error message.

Share this post


Link to post
Share on other sites
C:\Users\owner\Desktop\Gametitles.cpp|41|error: no matching function for call to 'std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::erase(__gnu_cxx::__normal_iterator<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&)'|

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!