Is std::vector so much slower than plain arrays?

后端 未结 22 2746
南方客
南方客 2020-11-22 12:00

I\'ve always thought it\'s the general wisdom that std::vector is \"implemented as an array,\" blah blah blah. Today I went down and tested it, and it seems to

22条回答
  •  忘掉有多难
    2020-11-22 12:28

    With the right options, vectors and arrays can generate identical asm. In these cases, they are of course the same speed, because you get the same executable file either way.

提交回复
热议问题