元々、抽象タイプGameState*
をとったスタックを作った。だから...コピーを作成せずにunqiue_ptrでスタックするにはどうすればよいですか?
std::stack<GameState*> gameStates
はしかし、誰かが私はC++ 11のスマートポインタunique_ptr
を使用する必要があります所有権を保持したい場合と私に知らされます。私はスタックに私のGameState
を押すたびだから...
std::stack<std::unique_ptr<GameState>> gameStates
だろうさて、私のコンパイラは文句を言います。私は右にはどうすればよい.
gameStates.push(std::move(&splashScreen1))
で
下
no instance of overloaded function matches the argument list
SplashScreen splashScreen1(game); //gameState object declaration
gameStates.push(std::move(&splashScreen1)); //move to stack without copying
エラーが表示される赤い線がある
それは言う... ...どうやら何か間違ったことをやっています私はこれを解決する?
テキストではなく、テキストの画像を投稿してください。 –