Well, I was going through a rabbit hole here… I tried to transform my c++ structs into USTRUCTs and failed (haven’t understood how to declare them in my header… sigh), then I tried to override the operator in the classic structs, and failed too.
In the end I solved by just implementing a bubble sort in my function like this:
// where testStructList is a TArray<testStruct *>
int32 iterations = testStructList .Num() - 1;
while (iterations > 0)
{
for (int32 x = 0; x < testStructList .Num() - 1; x++)
{
if (testStructList [x]->a > testStructList [x + 1]->a)
{
testStructList .Swap(x, x + 1);
}
}
iterations--;
}