Can anyone tell me why they would nuke TArray::begin() and TArray::end() during the move to release?
I had code that worked perfectly in beta and now every loop that goes through a TArray will have to be rewritten
Can anyone tell me why they would nuke TArray::begin() and TArray::end() during the move to release?
I had code that worked perfectly in beta and now every loop that goes through a TArray will have to be rewritten
I believe these functions were never meant to actually be used. Unfortunately at this stage, you’ll need to convert them to use for loops or use the iterator methods.
I can’t tell you the exact reason why they were nuked though.
An example is …
for (auto Iter(TArray.CreateIterator()); Iter; Iter++)
{
// *Iter to access what this iterator is pointing to.
}
Thanks Solid,
I can definitely redo the iterations, it’s just a nuisance, really - was wondering why they’d nuke it, I really can’t see any viable reason to, but oh well
As far I know begin and end is still there.
See Array.h, but it’s private.
Try this.
TArray<int32> IntArray;
...
for( const auto& It : IntArray )
{
...
}
Thanks
The issue wasn’t getting the iterations to work, that’s not a real problem other than the hassle of redoing them.
I was more curious as to why they were removed/made private.
Guess it doesn’t matter much, other than the refactoring of the code.
They are private to reduce the likelihood of their being called other than by a ranged-for.
So, if you want to avoid refactoring the code, you may change it to public.
I updated my wiki page for Tarrays with your example
thanks Solid Snake!
https://wiki.unrealengine.com/Dynamic_Arrays_in_UE4_C%2B%2B#Using_Iterator