size vs capacity of a vector?

后端 未结 6 1620
刺人心
刺人心 2020-11-27 03:10

I am a bit confused about this both of these look same to me. Although it may happen that capacity and size may differ on different compilers. how it may differ. Its also sa

6条回答
  •  有刺的猬
    2020-11-27 03:58

    The size is the number of elements in the vector. The capacity is the maximum number of elements the vector can currently hold.

提交回复
热议问题