Backported the oa_hashmap lookup_ptr function

This commit is contained in:
AndreaCatania 2022-04-22 08:48:17 +02:00
parent 6f24727916
commit 62e9044837

View file

@ -237,6 +237,26 @@ public:
return false; return false;
} }
const TValue *lookup_ptr(const TKey &p_key) const {
uint32_t pos = 0;
bool exists = _lookup_pos(p_key, pos);
if (exists) {
return &values[pos];
}
return nullptr;
}
TValue *lookup_ptr(const TKey &p_key) {
uint32_t pos = 0;
bool exists = _lookup_pos(p_key, pos);
if (exists) {
return &values[pos];
}
return nullptr;
}
_FORCE_INLINE_ bool has(const TKey &p_key) const { _FORCE_INLINE_ bool has(const TKey &p_key) const {
uint32_t _pos = 0; uint32_t _pos = 0;
return _lookup_pos(p_key, _pos); return _lookup_pos(p_key, _pos);