This question already has an answer here:
I would like to know the difference between these two declarations:
std::unique_ptr<Foo> pFoo(new Foo());
std::unique_ptr<Foo> pFoo = std::make_unique<Foo>();
I heard that the second usage is for exception safety, therefore preferred one? Is that also correct?
Aucun commentaire:
Enregistrer un commentaire