Vector iterators stink. If you have two, and you erase at one of them, the other one gets invalidated! -_- I was trying to make a sort for my deck - using my own home-made algorithm - but I kept getting mysterious "iterator out of range" runetime exceptions. Debugging brought me to my deck.erase statement - or at least the area around there. Meh. At least I learned a bit about
That leads me into the next update-rant. For some freakish reason, std::sort won't accept list begin() and end() iterators. I honestly don't know why, but when I tried to switch to a list - you know.. to see if I could solve my original invalid iterators problem - it threw THAT at me. UGH!
But, all is well. I'm still using a vector, and I'm sticking with std::sort... pity about my algorithm. I've got card types and suits set up, a constructor that lets you specify whether to have jokers or not, a DeckSize() function for the current size of the deck (excluding drawn cards), a TotalSize() function (it gives you the entire decksize, including drawn cards, which aren't actually removed from the vector), and Sort() and Shuffle() functions (which automatically return the deck to its fully un-drawn state, where TotalSize() and DeckSize() would be the same).
I was originally planning on having CardDeck be able to act as a hand too, but it seems a bit too complex for one class, so I'll likely remove Sort() and use it for CardHand. After I finish that, I'll be making a basic War card game. :D
So, summary: War going well, Harbinger on hold.
P.S. Did I mention I got Apache, MediaWiki, mySQL, and PHP5 on my iPod?