Loading…
|
Translation uploaded |
|
|
String added in the repository |
|
Flags
safe-html, strict-same
Loading…
|
Translation uploaded |
|
|
String added in the repository |
|
In a similar manner to using `reserve` for ``vector``s, it can be a good idea to call `reserve` before inserting a large number of elements. This will get the expensive rehashing out of the way and let you store iterators, safe in the knowledge that they won't be invalidated. If you are inserting `n` elements into container `x`, you could first call:与为 `vector` 使用 `reserve` 类似,在插入大量元素之前调用 `reserve` 是一个好主意。这样可以避免代价高昂的重哈希操作,并且让你能够存储迭代器,确信它们不会被失效。如果你要向容器 `x` 插入 `n` 个元素,可以先调用: