Since c++11 as established standard we have the Dynamic memory management facilities aka smart pointers.
Even from earlier standards we have the c++ standard Containers library as a good replacement for raw arrays (allocated with new T[]
).
Question(s) in bold:
Let aside the placement new
override, is there any valid use case that can't be achieved using smart pointers or standard containers but only using new
and delete
directly (besides implementation of such container classes of course)?
It's sometimes rumored that using new
and delete
handrolled can be "more efficient" for certain cases. Which are these actually? Don't these edge cases need to keep track of the allocations the same way as standard containers or smart pointers need to do?
Aucun commentaire:
Enregistrer un commentaire