...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Access or insert the specified element.
value
& operator[](string_view
key);
Returns a reference to the value that is mapped to a key equivalent to key, performing an insertion of a null value if such key does not already exist.
If an insertion occurs and results in a rehashing of the container, all
iterators are invalidated. Otherwise iterators are not affected. References
are not invalidated. Rehashing occurs only if the new number of elements
is greater than capacity()
.
Constant on average, worst case linear in size()
.
Strong guarantee. Calls to memory_resource::allocate
may throw.
A reference to the mapped value.
Name |
Description |
---|---|
|
The key of the element to find. |