| 87 | } |
| 88 | |
| 89 | size_type erase(const Key& key) |
| 90 | { |
| 91 | for (auto it = this->begin(); it != this->end(); ++it) |
| 92 | { |
| 93 | if (it->first == key) |
| 94 | { |
| 95 | // Since we cannot move const Keys, re-construct them in place |
| 96 | for (auto next = it; ++next != this->end(); ++it) |
| 97 | { |
| 98 | it->~value_type(); // Destroy but keep allocation |
| 99 | new (&*it) value_type{std::move(*next)}; |
| 100 | } |
| 101 | Container::pop_back(); |
| 102 | return 1; |
| 103 | } |
| 104 | } |
| 105 | return 0; |
| 106 | } |
| 107 | |
| 108 | iterator erase(iterator pos) |
| 109 | { |