我查看了文档,但找不到具体的答案.它是否依赖于实现?
I looked through documentation but could not find a specific answer. Is it implementation dependent?
所有你保证的是:
因此,一个实现想要投入多少额外或多少取决于实现.我认为大多数会在复制时使容量匹配大小,但不能降低容量.(因为上面的数字 2;不允许在有足够空间的情况下重新分配.)
So how much extra or little an implementation wants to put is up to the implementation. I think most will make capacity match size, when copying, but it cannot lower capacity. (Because of number 2 above; reallocating while there's enough room is not allowed.)
* 主要是.请参阅下面的查尔斯评论.
这篇关于复制后的 std::vector 容量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!