I found myself wanting a container that is always sorted today, TArray as a heap works if I am okay only accessing the top element at a time, but that would be inherently destructive if I wanted to iterate through the container, so I was hoping that there might be a container that I could use, I looked through the list of UE4 containers and found that there was nothing from what I could see that fit my desire. I did however find a reference to an internal request within Epic for a container like what I’m asking for, however, that was made a bit less than a year ago and it seems like the request has yet to be fulfilled, so I wanted to bring this matter up on the feedback board to hopefully catch someone’s attention and show that there is interest in features as mundane as containers being added to UE4.
Note: I do understand that I could manually insert elements and ensure that the container is sorted myself or even sort after every addition, or before every if the container is dirty, (would mark it when when an addition is made), but this isn’t a particularly odd container to want, and I’m pretty sure Epic engineers could provide a much nicer container implementation with better performance than I could manage.
The thread in particular: Always sorted map-like collection? - C++ - Epic Developer Community Forums
Note the staff response at the bottom by Steve Robb.