I'm trying to push_back multiple items to a vector. But it's not letting me and it gives me an error.
I've checked online and saw that people have used the push_back function like me and had it work. I assumed it would be the fact that I just can't push_back multiple items, so I removed the extra passing value and I still got the same error.
Function that is getting the error (the red line is under the dot before the push_back function):
originalCardDeck.push_back(card::suitType::CLUBS, card::rankType::TWO);
The class containing the vectors.
class deck
{
public:
deck()
{
originalCardDeck.push_back(card::suitType::CLUBS, card::rankType::TWO);
}
~deck();
void printDeck(int deck[]);
private:
vector<card>originalCardDeck;
vector<card>shuffledCardDeck;
};
The card class containing the enumerated types.
class card
{
public:
card();
~card();
enum class rankType
{
TWO = 2,
THREE,
FOUR,
FIVE,
SIX,
SEVEN,
EIGHT,
NINE,
TEN,
JACK,
QUEEN,
KING,
ACE
};
enum class suitType
{
CLUBS,
DIAMONDS,
HEARTS,
SPADES
private:
rankType rank;
suitType suit;
};
I'm getting an error saying:
C++ no instance of overloaded function matches the argument list
argument types are: (card::suitType, card::rankType)
object type is: std::vector<card, std::allocator<card>>
My intention for this line is to have the ability to push_back an element containing multiple data types into a vector, so I can reference it as one later. I would have put it in a for loop if there was no error message.