C++ Equivalent of Vector Iterator

Hello,
what is the equivalent of the vector iterator with UE4’s containers.
For example:

for(vector<ClassType>::iterator it = object.begin(); it != object.end(); it++){
//code
}

Thanks!

Thank you, exactly it!

Yes, this is what I was looking for :slight_smile:

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.

You might be looking for this:

for (auto ListIt = List.CreateIterator(); ListIt; ++ListIt) { }

-Spiris
edit: Whoops! missed it by a moment, hope these answers help.