| 262 | // or null if it doesn't. |
| 263 | template <class Collection> |
| 264 | typename Collection::mapped_type::element_type* |
| 265 | FindPointeeOrNull(const Collection& collection, // NOLINT, |
| 266 | const typename Collection::key_type& key) { |
| 267 | auto it = collection.find(key); |
| 268 | if (it == collection.end()) { |
| 269 | return nullptr; |
| 270 | } |
| 271 | return it->second.get(); |
| 272 | } |
| 273 | |
| 274 | // Finds the value associated with the given key and copies it to *value (if not |
| 275 | // NULL). Returns false if the key was not found, true otherwise. |