MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / erase

Function erase

src/include/nlohmann/ordered_map.hpp:162–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160 }
161
162 size_type erase(const key_type& key)
163 {
164 for (auto it = this->begin(); it != this->end(); ++it)
165 {
166 if (m_compare(it->first, key))
167 {
168 // Since we cannot move const Keys, re-construct them in place
169 for (auto next = it; ++next != this->end(); ++it)
170 {
171 it->~value_type(); // Destroy but keep allocation
172 new (&*it) value_type{std::move(*next)};
173 }
174 Container::pop_back();
175 return 1;
176 }
177 }
178 return 0;
179 }
180
181 template<class KeyType, detail::enable_if_t<
182 detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>

Callers

nothing calls this directly

Calls 6

pop_backFunction · 0.85
beginFunction · 0.85
endFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected