Re: vector::iterator usage help needed

From: Val (valmont_programming_at_hotmail.com)
Date: 05/14/04


Date: Fri, 14 May 2004 11:34:11 +0200

Thank you sir.
Good you mentioned getDeck() returns a temporary, because I have another question, most likely related to your remark:
I may want to swap "cards" in my "deck" but doing it with the getDeck method doesn't work. Nevertheless I would like to swap various
indexes with eachother sooner or later.
How would I do that?
I don't want to add a public interface in class Deck so I can access it from another class. Seems bad design to me, but I might be
wrong since I am wrong easely when it comes to OO.
So how can I do that? Surely I can't return a vector (vector<Card>) by reference in the Deck class can I? Would that be clever to
start with?

Thanks you again,
Val



Relevant Pages

  • Re: vector::iterator usage help needed
    ... > Good you mentioned getDeck() returns a temporary, ... swapping cards in a copy that soon after ceases to exist is futile. ... When I first read your code, I wondered why you created a class Deck at ... My first approach would have been 'typedef vectorDeck;'. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Shuffle
    ... > A deck of cards is shuffled by removing the top card and replacing it ... > at random into one of the 52 places in the deck. ... pick a random position>= 1 and swap the first and the ...
    (rec.puzzles)
  • Re: Madness Network + Rotschreck is too good!
    ... I assist a novice in building a combat-heavy deck using cards from ... to play DotB, and there can be Protean-based cards. ... Valerius player or with another player to kill Valerius". ...
    (rec.games.trading-cards.jyhad)
  • ORIGINS 2006 Tournament Reports and Winning Decks [LONG]
    ... Rank Name PrelimGWs PrelimVPs FinalVPs TPs ... Deck Name: Lasombra Creation Boon ... This deck was directly inspired by Jeff "The Lasombra" ... Library: (90 cards) ...
    (rec.games.trading-cards.jyhad)
  • Gangrel Newsletter - October 2005
    ... Cards of the Newsletter ... Minions of the Newsletter ... Supertool - Commit Actions to tool up your small cap Gangrel while ... but this deck is fun to play. ...
    (rec.games.trading-cards.jyhad)