I have a member variable that is a vector iterator. I'm trying to save it so that I can access it later (variable name = mIt). However, in this method, for example, once the method ends, the value gets erased. How do I persist this value?
for(vector<Card>::iterator it = mCards.begin(); it != mCards.end(); ++it)
{
Card& currentCard = *it;
temp = it;
int compareResult = currentCard.GetLastName().compare(card.GetLastName());
if (compareResult <= 0)
{
mIt = it;
mCards.insert(temp, card); // instead of it?
return;
}
}