| 471 | // map, its value is changed to the given "value" and false is returned. |
| 472 | template <class Collection> |
| 473 | bool EmplaceOrUpdate(Collection* const collection, |
| 474 | const typename Collection::key_type& key, |
| 475 | typename Collection::mapped_type&& value) { |
| 476 | return collection->insert_or_assign( |
| 477 | key, std::forward<typename Collection::mapped_type>(value)).second; |
| 478 | } |
| 479 | |
| 480 | // Given the key and parameters to construct the mapped object in-place, |
| 481 | // EmplaceOrDie() returns reference to the mapped object for dictionary-like |