This question is in regards to my program. I was earlier using Manual Management using pointers, and now I'm trying to move to smart pointers (for all the good reasons).
In normal pointers, it was easy to call a constructor of a class by using the new keyword. Like in the program below:
Button * startButton;
startButton = new Button(int buttonID, std::string buttonName);
When using smart pointers, what's the alternate way of calling a constructor for a class. What I've done below gives an error:
std::unique_ptr<Button> startButton;
startButton = std::unique_ptr<Button>(1, "StartButton"); // Error
The error I get is as follows:
Error 2 error C2661: 'std::unique_ptr<Button,std::default_delete<_Ty>>::unique_ptr' : no overloaded function takes 2 arguments