Unreal Containers - nullstar/SecondBrain GitHub Wiki
Below is an example of how to safely remove from a container whilst iterating through it:
TMap<TWeakObjectPtr<AActor>, int32> myMap;
for (TMap<TWeakObjectPtr<AActor>, int32>::TIterator iter = myMap.CreateIterator(); iter; ++iter)
{
if (!iter->Key.IsValid())
{
iter.RemoveCurrent();
}
}
#Unreal #Container #TMap #TVector