'+=' is not working on my vector

closed account (SETp4iN6)
Hi guys,

Hoping someone can help I am writing a poker game and at the moment im just simply try to add the amount of pairs, two pairs, three of a kind etc.

I created a function to count the number of each type of card into a vector...
example:
std::vector<int> _cardCount[13]{};
_cardCount[0] = the amount of twos in the holeCards and TableCards
_cardCount[1] = the amount of threes in the holeCards and TableCards
etc......

This all work fine until the point that I try to increment the value of said _cardCount.
example:
//none of these work
cardCount[0] += 1;
cardCount[0]++;
cardCount[0] = cardCount[0] + 1;

error code c2676
I have put the code below:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

void Deck::setCountByFace(char holeCards1, char holeCards2, std::vector<char> tableCards)
{

	//sort and combine cards
	combinedCards(holeCards1, holeCards2, tableCards);
	//Loop through deck values and check to see how many of each card there are
	for (char checkFaceValues = 0; checkFaceValues < 52; checkFaceValues++)
	{

		if (std::find(_combinedCards.begin(), _combinedCards.end(), checkFaceValues) != _combinedCards.end())
		{
			if (checkFaceValues == TWO_DIAMONDS) { _countByValue[TWOS] += 1; }
			if (checkFaceValues == TWO_HEARTS)   { _countByValue[TWOS] += 1; }
			if (checkFaceValues == TWO_SPADES)   { _countByValue[TWOS] += 1; }
			if (checkFaceValues == TWO_CLUBS)    { _countByValue[TWOS] += 1; }
		}


	}

}
]
Last edited on
std::vector<int> _cardCount[13]{};
This is not a vector of 13 ints. It's an array of 13 empty vectors.

 
std::vector<int> _cardCount(13);
closed account (SETp4iN6)
DO YOU HAVE ANY IDEA HOW LONG IVE BEEN SCRATCHIN MY HEAD LOL..

.Thanks for helping the ignorant...changed it to std::vector<int>_cardCount; and it loves it :)

Thank you helios!!
Topic archived. No new replies allowed.