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

◆ find() [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; })
const_iterator MayaFlux::Memory::FlatMap< K, V, Compare >::find ( const Q & key) const
inlinenodiscard

The entry for a key of another type, or end() when absent.

Available when the comparator is transparent, such as std::less<>, so a std::string_view or a literal finds a std::string key without making one.

Definition at line 63 of file FlatMap.hpp.

64 {
65 const size_t index = lower_index(key);
66 return index < m_items.size() && !m_less(key, m_items[index].first)
67 ? m_items.begin() + static_cast<std::ptrdiff_t>(index)
68 : m_items.end();
69 }
size_t lower_index(const Q &key) const
Definition FlatMap.hpp:129
const_iterator end() const noexcept
Definition FlatMap.hpp:27
std::vector< value_type > m_items
Definition FlatMap.hpp:135
Map kept as one sorted vector, cheap to copy.
Definition FlatMap.hpp:21