MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / erase

Function erase

include/behaviortree_cpp/contrib/json.hpp:19166–19183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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>

Callers 1

merge_patchFunction · 0.85

Calls 15

moveFunction · 0.85
pop_backFunction · 0.85
createFunction · 0.85
is_stringFunction · 0.85
destroyFunction · 0.85
is_binaryFunction · 0.85
concatFunction · 0.85
erase_internalFunction · 0.85
is_arrayFunction · 0.85
is_beginMethod · 0.80
is_endMethod · 0.80
beginFunction · 0.70

Tested by

no test coverage detected