std::vector<Piece*> player1, player2;
/* Filling player 1 and 2 vith piece
player1.push_back(new Piece()) */
std::vector<Piece*> *currentPlayer, *opponent;
currentPlayer = &player1;
opponent = &player2
for(int i = 0; i < currentPlayer.size(); ++i)
{
// This is where i get the error
// error: base operand of '->' has non-pointer type 'std::vector<Piece*>'
currentPlayer[i]->memberFunctionOfPiece()
}
As you can see I am trying to use a pointer pointing to a vector of pointers. but getting non-pointer type when trying to access the vector Why can't i access the member function?