You have this code:
When you do a pop_front you invalidate the iterator i. Therefore, you have undefined behaviour.Code:void Player::PickupCards(const int NumberOfCards) // pickup a certain amount of cards from our global deck { //... for (list <Card>::iterator i = Deck.Contents.begin(); i != Deck.Contents.end(); ++i) // go backwards.... { Hand.push_front(i); // take the last value from the deck, and put it into that players hand Deck.Contents.pop_front(); // remove the last value of the deck, shortening it, so value was removed //... } }




Reply With Quote