Loading…
|
Translation uploaded |
|
|
String added in the repository |
|
Things to check
Flags
safe-html, strict-same
Loading…
|
Translation uploaded |
|
|
String added in the repository |
|
Requires:;;要求:`value_type`is必须可以从 `args` 出发在 `X` 中进行 https://en.cppreference.com/w/cpp/named_req/EmplaceConstructible[EmplaceConstructible^] into `X` from `args`. Returns:;; The bool component of the return type is true if an insert took place. + + If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key. Throws:;; If an exception is thrown by an operation other than a call to `hasher` the function has no effect. Notes:;; Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. + + Pointers and references to elements are never invalidated. + + If `args...` is of the form `k,v`, it delays constructing the whole object until it is certain that an element should be inserted, using only the `k` argument to check. This optimization happens when the map's `key_type` is move constructible or when the `k` argument is a `key_type`.可原位构造^]。 返回:如果发生了插入,则返回类型的 bool 分量为 true。如果发生了插入,则迭代器指向新插入的元素;否则,指向具有等价键的元素。
抛出:如果除调用 `hasher` 之外的操作抛出异常,则该函数无效果。
注意:可能使迭代器失效,但仅当插入导致负载因子大于或等于最大负载因子时才会发生。 指向元素的指针和引用永远不会失效。
如果 `args...` 的形式为 `k,v`,则该函数会延迟构造整个对象,直到确定应该插入元素为止,仅使用 `k` 参数进行检查。当映射的 `key_type` 可移动构造或 `k` 参数本身就是 `key_type` 类型时,此优化生效。