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

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

    There might be some edge case where you have a vector access inside an inline function inside an inline function, where you've gone beyond what the compiler will inline and it will force a function call. That would be so rare as to not be worth worrying about - in general I would agree with litb.

    I'm surprised nobody has mentioned this yet - don't worry about performance until it has been proven to be a problem, then benchmark.

    0 讨论(0)
提交回复
热议问题