How to order AActor by distance using TArray::Sort()?

Hello!!

Actually i’m looking for a clear example of the usage of TArray::Sort() with predicate class. In fact the predicate class is where i get lost. Basically i want to rearrange a TArray of actors from closer to far.

I’ve done this before using the bubble sort algorithm, but some people had told me is not the best way. So any help or example of how to use predicate class to TArray::Sort() will be great, even a simple example of how to arrange number from lower to higher will be awesome?

Thanks :slight_smile: