make_unique/make_shared can throw, so I'm not sure is it ok to call them in member initializer lists? And if it's ok is it any difference with using them with () or {}?
A::A() : ptr1(std::make_unique<type>()), ptr2{std::make_unique<type>()} {}
Is it ok and will be any difference in creating and initialization of ptr1 and ptr2?
UPD: also is it a good idea to use make_unique/make_shared in in-class-initialization?
Aucun commentaire:
Enregistrer un commentaire