| 780 | // first value. |
| 781 | template <class Collection> |
| 782 | typename Collection::mapped_type EraseKeyReturnValuePtr( |
| 783 | Collection* const collection, |
| 784 | const typename Collection::key_type& key) { |
| 785 | auto it = collection->find(key); |
| 786 | if (it == collection->end()) { |
| 787 | return typename Collection::mapped_type(); |
| 788 | } |
| 789 | typename Collection::mapped_type v = std::move(it->second); |
| 790 | collection->erase(it); |
| 791 | return v; |
| 792 | } |
| 793 | |
| 794 | // Inserts all the keys from map_container into key_container, which must |
| 795 | // support insert(MapContainer::key_type). |