Reputation: 31
Here's my code:
std::list<User>::iterator it;
while (it != allUsers.end())
{
if (it->getId() == userId)
{
allUsers.remove(*it);
return *it;
}
else
{
it++;
}
}
The error I get : list iterators incompatible with erasing Why?
Upvotes: 0
Views: 128