TArraymyArray = {1, 2, 3, 4, 5}; for (auto it = myArray.CreateIterator(); it; ++it) { int& element = *it; // Do something with the element }
TArrayIn this example, a TArray of strings is created, and the CreateIterator() function is used to create an iterator object that can loop through the array. The elements in the array are accessed using the iterator, and a reference to the element is obtained using the '*' operator. The reference is then used to modify the string element by appending "123" to it. Package library: Unreal Engine.myArray = {"hello", "world", "!"}; for (auto it = myArray.CreateIterator(); it; ++it) { FString& element = *it; element += "123"; }