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

后端 未结 19 1476
忘了有多久
忘了有多久 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:22

    The following simple test:

    C++ Array vs Vector performance test explanation

    contradicts the conclusions from "Comparison of assembly code generated for basic indexing, dereferencing, and increment operations on vectors and arrays/pointers."

    There must be a difference between the arrays and vectors. The test says so... just try it, the code is there...

提交回复
热议问题