-first draft of BinSearchArrayMap
This commit is contained in:
@@ -33,7 +33,7 @@ namespace OpenVulkano
|
||||
throw std::runtime_error("Key cannot be lesser than the last used key.");
|
||||
}
|
||||
|
||||
template<typename... Args> void Emplace(K key, Args... args)
|
||||
template<typename... Args> void Emplace(K key, Args... args)
|
||||
{
|
||||
// Check if the key is bigger than the last element
|
||||
if (m_data.empty() || key > m_data.back().first)
|
||||
@@ -45,7 +45,7 @@ namespace OpenVulkano
|
||||
throw std::runtime_error("Key cannot be lesser than the last used key.");
|
||||
}
|
||||
|
||||
void Remove(K key) noexcept
|
||||
void Remove(K key) noexcept
|
||||
{
|
||||
auto it = std::lower_bound(m_data.begin(), m_data.end(), key,
|
||||
[](const auto& pair, const K& key) { return pair.first < key; });
|
||||
@@ -70,7 +70,8 @@ namespace OpenVulkano
|
||||
return it->second;
|
||||
}
|
||||
|
||||
V& Get(K key) noexcept {
|
||||
V& Get(K key) noexcept
|
||||
{
|
||||
auto it = std::lower_bound(m_data.begin(), m_data.end(), key,
|
||||
[](const auto& pair, const K& key) { return pair.first < key; });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user