\brief Removes \a key from the map. If \a key is not found, this is a no-op. \param[in] key The key of the entry to remove. This must not be `nullptr`, nor an empty string. It must not contain embedded `NUL`s.
| 220 | //! \param[in] key The key of the entry to remove. This must not be `nullptr`, |
| 221 | //! nor an empty string. It must not contain embedded `NUL`s. |
| 222 | void RemoveKey(std::string_view key) { |
| 223 | DCHECK(key.data()); |
| 224 | DCHECK(key.size()); |
| 225 | DCHECK_EQ(key.find('\0', 0), std::string_view::npos); |
| 226 | if (!key.data() || !key.size()) { |
| 227 | return; |
| 228 | } |
| 229 | |
| 230 | Entry* entry = GetEntryForKey(key); |
| 231 | if (entry) { |
| 232 | entry->key[0] = '\0'; |
| 233 | entry->value[0] = '\0'; |
| 234 | } |
| 235 | |
| 236 | DCHECK_EQ(GetEntryForKey(key), implicit_cast<Entry*>(nullptr)); |
| 237 | } |
| 238 | |
| 239 | private: |
| 240 | static void SetFromStringView(std::string_view src, |