-first draft of BinSearchArrayMap

This commit is contained in:
Metehan Tuncbilek
2024-09-23 17:00:07 +03:00
parent f8326a5686
commit 02d84af907
3 changed files with 6 additions and 7 deletions

View File

@@ -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; });