Using arrays or std::vectors in C++, what's the performance gap?

后端 未结 19 1639
忘了有多久
忘了有多久 2020-11-22 03:23

In our C++ course they suggest not to use C++ arrays on new projects anymore. As far as I know Stroustroup himself suggests not to use arrays. But are there significant perf

19条回答
  •  無奈伤痛
    2020-11-22 04:01

    About duli's contribution with my own measurements.

    The conclusion is that arrays of integers are faster than vectors of integers (5 times in my example). However, arrays and vectors are arround the same speed for more complex / not aligned data.

提交回复
热议问题