-
ajstsubasaLikes 0Problem Description
Q1: Why do we use Shared_ptr in the following Code?What does make shared do?
typedef std::shared_ptr<GameData> GameDataRef;
class Game {
public :
Game(int width, int height, std::string title);
private:
const float dt = 1.0f / 60.0f;
sf::Clock clock;
GameDataRef _data = std::make_shared < GameData>();
void Run();Q2: I have never used std::move ? can you explain why we use move in the follwing code?
this->_newState =std ::move(newState);//newstate is a pointer .
-
Sonar Systems adminLikes 0
So it can be shared and persist throughout the app.
This will help explain this https://stackoverflow.com/questions/3413470/what-is-stdmove-and-when-should-it-be-used
Login to reply