| 19164 | } |
| 19165 | |
| 19166 | size_type erase(const key_type& key) |
| 19167 | { |
| 19168 | for (auto it = this->begin(); it != this->end(); ++it) |
| 19169 | { |
| 19170 | if (m_compare(it->first, key)) |
| 19171 | { |
| 19172 | // Since we cannot move const Keys, re-construct them in place |
| 19173 | for (auto next = it; ++next != this->end(); ++it) |
| 19174 | { |
| 19175 | it->~value_type(); // Destroy but keep allocation |
| 19176 | new (&*it) value_type{std::move(*next)}; |
| 19177 | } |
| 19178 | Container::pop_back(); |
| 19179 | return 1; |
| 19180 | } |
| 19181 | } |
| 19182 | return 0; |
| 19183 | } |
| 19184 | |
| 19185 | template<class KeyType, detail::enable_if_t< |
| 19186 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> |
no test coverage detected