C++ enum in foreach
- by Spencer
I've have a card class for a blackjack game with the following enums:
enum Rank { Ace, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King };
enum Suit { Clubs, Diamonds, Hearts, Spades };
When I create the deck I want to write the code like this:
// foreach Suit in Card::Suit
// foreach Rank in Card::Rank
// add new…