Originally I made a stack that took type of GameState*
. So that'll be...
std::stack<GameState*> gameStates
However, someone informed me that if I wanted to retain ownership that I should use C++11's smart pointer unique_ptr
. So that'll be...
std::stack<std::unique_ptr<GameState>> gameStates
Now whenever I push my GameState
onto the stack, my compiler complains. I'm doing something wrong apparently, but its hard to decipher this error.
It says..
ReigalaSplash splashScreen1(game); //gameState object declaration
gameStates.push(std::move(&splashScreen1)); //move to stack without copying
The red line where the error appears is right over the .
in gameStates.push(std::move(&splashScreen1))
How do I fix this ?
Aucun commentaire:
Enregistrer un commentaire