lundi 9 mars 2015

Performance of container of objects vs performance of container of pointers


class C { ... };
std::vector<C> vc;
std::vector<C*> pvc;
std::vector<std::unique_ptr<C>> upvc;


Depending on the size of C, either the approach storing by value or the approach storing by pointer will be more efficient.


Is it possible to approximately know what this size is (on both a 32 and 64 bit platform)?


Aucun commentaire:

Enregistrer un commentaire