I read in many places including Effective C++ that it is better to store data on the stack and not as pointer to the data.
I can understand why doing this with small object.
Because it is also reduced the number of new and delete calls which also reduced the chance to memory leak and also the pointer can take more space then the object itself.
But with large object that copying them will be expensive is it not better to store them in a smart pointer?
Because with many operation with the large object there will be few object copying which is very expensive (I am not including the geters and seters).
mercredi 6 mai 2015
Pointer against not pointer
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire