MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ erase() [2/2]

template<typename K, typename V, typename Compare = std::less<K>>
template<typename Q>
requires (!std::same_as<Q, K> && requires { typename Compare::is_transparent; })
bool MayaFlux::Memory::FlatMap< K, V, Compare >::erase ( const Q & key)
inline

Removes the entry for a key of another type, as find does for lookup.

Definition at line 85 of file FlatMap.hpp.

86 {
87 const size_t index = lower_index(key);
88 if (index >= m_items.size() || m_less(key, m_items[index].first)) {
89 return false;
90 }
91 m_items.erase(m_items.begin() + static_cast<std::ptrdiff_t>(index));
92 return true;
93 }
size_t lower_index(const Q &key) const
Definition FlatMap.hpp:129
std::vector< value_type > m_items
Definition FlatMap.hpp:135
Map kept as one sorted vector, cheap to copy.
Definition FlatMap.hpp:21