We could use "make_shared" to create an object faster and safer compared to use "new". For example,
shared_ptr<Dog> p = make_shared<Dog>("Luther").
If I need to create an array of objects (e.g. Dog[3]), is it possible to use "make_shared" instead "new"? Besides, is it possible to use a customized delete function with make_shared method?
Aucun commentaire:
Enregistrer un commentaire