| 19040 | } |
| 19041 | |
| 19042 | size_type erase(const key_type& key) |
| 19043 | { |
| 19044 | for (auto it = this->begin(); it != this->end(); ++it) |
| 19045 | { |
| 19046 | if (m_compare(it->first, key)) |
| 19047 | { |
| 19048 | // Since we cannot move const Keys, re-construct them in place |
| 19049 | for (auto next = it; ++next != this->end(); ++it) |
| 19050 | { |
| 19051 | it->~value_type(); // Destroy but keep allocation |
| 19052 | new (&*it) value_type{std::move(*next)}; |
| 19053 | } |
| 19054 | Container::pop_back(); |
| 19055 | return 1; |
| 19056 | } |
| 19057 | } |
| 19058 | return 0; |
| 19059 | } |
| 19060 | |
| 19061 | template<class KeyType, detail::enable_if_t< |
| 19062 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> |
no test coverage detected