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

后端 未结 19 1658
忘了有多久
忘了有多久 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 03:59

    I'd argue that the primary concern isn't performance, but safety. You can make a lot of mistakes with arrays (consider resizing, for example), where a vector would save you a lot of pain.

提交回复
热议问题