vendredi 2 juin 2017

Performance of STL vector vs dynamic arrays

I would like to know how big of a difference there is between the performance of c++ dynamic arrays and STL vectors. I know it could totally depend on your code and how you construct your vector, for example not taking advantage of std::vector::reserve and constructing vectors using std::vector::push_back could lead to poor performance. However, I cannot see why someone would choose dynamic arrays (with operator new[]) instead of using vectors with care. Is there a significant performance gap between correctly implemented STL vectors and dynamic arrays in general?

Thanks

Aucun commentaire:

Enregistrer un commentaire