For each loop on TArray

I’m not going to comment on the “optimal” way to iterate through TArrays, but the following is how they are iterated in the engine code, so I assume this method is at least safe.

TArray<ExampleClass> MyArray;

// Some code which assigns value to the array...

// Iterate through the array
MyArray.Reserve(MyArray.Num());
for (int i = 0; i < MyArray.Num(); ++i)
{
   // Extract item from the array
    ExampleClass MyItem = MyArray[i];
}

Source: UE 4.20.1 - Engine/Source/Runtime/Engine/Private/Actor.cpp Line 2699