Added more getters to the new HshMap, for more backwards compatibility.

This commit is contained in:
Relintai 2023-01-15 23:46:53 +01:00
parent fd7c2153a6
commit 3c461a4660

View File

@ -63,6 +63,26 @@ public:
Element *next = nullptr;
Element *prev = nullptr;
KeyValue<TKey, TValue> data;
const TKey &key() const {
return data.key;
}
TValue &value() {
return data.value;
}
const TValue &value() const {
return data.value;
}
TValue &get() {
return data.value;
};
const TValue &get() const {
return data.value;
};
Element() {}
Element(const TKey &p_key, const TValue &p_value) :
data(p_key, p_value) {}
@ -154,6 +174,14 @@ public:
return NULL;
}
_FORCE_INLINE_ const Element *find(const TKey &p_key) const {
return get_element(p_key);
}
_FORCE_INLINE_ Element *find(const TKey &p_key) {
return get_element(p_key);
}
/**
* Same as get, except it can return NULL when item was not found.
* This version is custom, will take a hash and a custom key (that should support operator==()