Insert into collection (TArray), while preserving sort, just use std::list?

With C# and .Net, we have List. With C++ and stdlib, we have to std::list. With UE4, we have TArray.

I’d really like to just use std::list, but from what I’ve been reading, this is bad practice. And using a wrapper class could be very inefficient.

TArray::FindLastByPredicate could work, but does it expect the TArray to be sorted? I’m guessing it just iterates through the entire thing.

Let’s say it does expect or can derive from itself that it’s sorted. Does it return an index (lower/upper bound) even when there’s not an exact match to the predicate?

This is how I use std::list::lower_bound/upper_bound or .Net’s List.BinarySearch.

I’m guessing that TArray is just a dynamic array under the hood, whereas std::list and List are doubly-linked lists.

FindLastByPredicate just iterative searches an index of element which matches the predicate, otherwise return INDEX_NONE.
TArray is a dynamically sized array, and suit for most of cases. TDoubleLinkedList is double-linked list in UE4.

Yeah, that’s too bad.
TDoubleLinkedList is just that with little added functionality. Anybody with less than a half-year of Comp Sci could write that.

Actually TArray is designed to be fast, memory efficient and safe. TDoubleLinkedList is considered to build links between pointers.
I would like to suggest using TArray as a container of data/memory, and using TDoubleLinkedList to build relationship of each data if need.