Map (Container)

In C++, here is how to iterate through all entries in a TMap. TMap MyMapVariable; float PlayerScore = 0; for (TPair& IteratedPair : MyMapVariable) { PlayerScore += IteratedPair.Value; Destroy(I...

Updated over 4 years ago Edit Page Revisions

In C++, here is how to iterate through all entries in a TMap.

TMap MyMapVariable;
float PlayerScore = 0;
for (TPair& IteratedPair : MyMapVariable)
{
     PlayerScore += IteratedPair.Value;
     Destroy(IteratedPair.Key); 
}

If your map variable is const, make the pair

const TPair&