RED4ext.SDK
RED4ext.SDK copied to clipboard
Adds iterator to HashMap
Looking at HashMap::ForEach I don't really understand how it works, don't we need a custom iterator?
I'm not sure, but it complained about this for loop until I added these, which mirror DynArray's.
DynArray is a contiguously memory, but this one has buckets / nodes. So I am a bit confused.
If I am right the following:
auto rttiSystem = RED4ext::CRTTISystem::Get();
for (auto node : rttiSystem ->types)
{
// ...
}
will be translated to after compilation:
auto rttiSystem = RED4ext::CRTTISystem::Get();
auto begin = rttiSystem->begin();
auto end= rttiSystem->end();
while (begin != end)
{
// ...
being += sizeof(HashMap::Node);
}
Which is wrong.
I think we are running in an undefined behavior in a long run.