I’d recommend using range-based-for since it’s more concise:
for (ClassType& classtype : object)
{
//code
}
But the iterator based way would probably look like this:
for (auto It = object.CreateIterator(); It; ++It)
{
//code
}
Our contains do also have STL style begin/end functions (needed for range-based-for, and other Algo stuff), so the code you posted above may work with our containers, but it’s not common to see it.
This information is also available in the documentation for TArray.