0

Is there any reason to choose

int pInt = std::unique_ptr<int>(new int);

vs

int pInt = std::make_unique<int>()

other than avoiding specifying the type twice?

ROBERT RICHARDSON
  • 1,790
  • 4
  • 18
  • 50
  • Multiple reasons have been mentioned in [Differences between std::make_unique and std::unique_ptr with new](https://stackoverflow.com/q/22571202/555045) and [Advantages of using std::make_unique over new operator](https://stackoverflow.com/q/37514509/555045) – harold Dec 27 '21 at 18:43

0 Answers0