What is the overhead cost of an empty vector?

后端 未结 6 1499
野性不改
野性不改 2020-12-06 04:24

What is the memory overhead of having an empty vector vs having a pointer to a vector?

Option A:

std::vector v;

Option B

6条回答
  •  遥遥无期
    2020-12-06 05:05

    std::vector v; takes up sizeof(v) space. It might vary by implementation, so run it and find out how much it takes for you.

提交回复
热议问题