Thanks. I actually figured a lot of that out on my own (slowly, but surely...)
Rather than using splice, I'm using merge. Seems slightly simpler, particularly because I want to keep the original order for testing. However, it's not quite working, despite everything looking like it's set up correctly.
my function call is the same
discard_pile.collect_cards(p1.clear_hand());
my revised function the Deck class looks like this:
1 2 3 4 5 6
|
void Deck::collect_cards(list<Card> this_hand)
{
// list<Card>::iterator it;
// for (it=this_hand.begin(); it!=this_hand.end(); it++) cout << " \n" << *it;
my_deck.merge(this_hand);
}
|
When I uncomment the iterator stuff, it all outputs correctly, so I know that I have the player's hand coming back into collect_cards correctly. (I also know that I cleared the original hand out, too). But, this still won't compile. It fails on the merge(this_hand) call. (note: my_deck is a std::list<Card> as is this_hand).
Can you see why? I'm just not seeing it.
Thanks as always.