Merge pull request #60420 from AndreaCatania/fix_looup_ptr_const

Add mutable OAHashMap::lookup_ptr function to fix mutability.
This commit is contained in:
Rémi Verschelde 2022-04-26 18:31:17 +02:00 committed by GitHub
commit 2116ecc46a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 7 deletions

View File

@ -246,13 +246,17 @@ public:
return false;
}
/**
* returns true if the value was found, false otherwise.
*
* if r_data is not nullptr then the value will be written to the object
* it points to.
*/
TValue *lookup_ptr(const TKey &p_key) const {
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);