| 300 | } |
| 301 | |
| 302 | Value set(const Key& key, const Value& value) requires (concepts::has_arrow_operator<Value> || std::is_pointer_v<Value>) { |
| 303 | // if the key is already in the table, just replace it and move on |
| 304 | if (Slot* slot = get_slot(key)) { |
| 305 | Value oldValue = slot->kv.value; |
| 306 | slot->kv.value = value; |
| 307 | return oldValue; |
| 308 | } |
| 309 | |
| 310 | // else we need to insert it. First, check if we need to expand. |
| 311 | if (should_rehash()) { |
| 312 | rehash(); |
| 313 | } |
| 314 | |
| 315 | // then we actually insert the key. |
| 316 | insert_nonexistent_norehash(key, std::move(value)); |
| 317 | return nullptr; |
| 318 | } |
| 319 | |
| 320 | bool set(const Key& key, const Value& value) requires (!concepts::has_arrow_operator<Value> && !std::is_pointer_v<Value>) { |
| 321 | // if the key is already in the table, just replace it and move on |
no outgoing calls
no test coverage detected