From Jason Turner

[unord.map.elem]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpkvc791sp/{from.md → to.md} +6 -13
tmp/tmpkvc791sp/{from.md → to.md} RENAMED
@@ -1,25 +1,18 @@
1
  #### `unordered_map` element access <a id="unord.map.elem">[[unord.map.elem]]</a>
2
 
3
  ``` cpp
4
  mapped_type& operator[](const key_type& k);
 
 
 
 
 
5
  mapped_type& operator[](key_type&& k);
6
  ```
7
 
8
- *Requires:* `mapped_type` shall be `DefaultInsertable` into `*this`. For
9
- the first operator, `key_type` shall be `CopyInsertable` into `*this`.
10
- For the second operator, `key_type` shall be `MoveConstructible`.
11
-
12
- *Effects:* If the `unordered_map` does not already contain an element
13
- whose key is equivalent to *`k`*, the first operator inserts the value
14
- `value_type(k, mapped_type())` and the second operator inserts the value
15
- `value_type(std::move(k), mapped_type())`.
16
-
17
- *Returns:* A reference to `x.second`, where `x` is the (unique) element
18
- whose key is equivalent to *`k`*.
19
-
20
- *Complexity:* Average case 𝑂(1), worst case 𝑂(`size()`).
21
 
22
  ``` cpp
23
  mapped_type& at(const key_type& k);
24
  const mapped_type& at(const key_type& k) const;
25
  ```
 
1
  #### `unordered_map` element access <a id="unord.map.elem">[[unord.map.elem]]</a>
2
 
3
  ``` cpp
4
  mapped_type& operator[](const key_type& k);
5
+ ```
6
+
7
+ *Effects:* Equivalent to: `return try_emplace(k).first->second;`
8
+
9
+ ``` cpp
10
  mapped_type& operator[](key_type&& k);
11
  ```
12
 
13
+ *Effects:* Equivalent to: `return try_emplace(move(k)).first->second;`
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  ``` cpp
16
  mapped_type& at(const key_type& k);
17
  const mapped_type& at(const key_type& k) const;
18
  ```