NTH algorithm for TArray?????

hey! i found a way!, sort can be used as multipurpose by using predicates, i just need create a custom one!
check this out!



//this is my predicate
struct Greater
{
	inline bool operator()(const int32& pt1, const int32& pt2) const
	{
		return pt1> pt2;
	}
};

//and this is my test function 
TArray<int32> dontKnow;
for (int i = 0; i < 10; i++)
{
	dontKnow.Add(i);
}

dontKnow.Sort(Greater());
	
for (int i = 0; i < dontKnow.Num(); i++)
{
	GEngine->AddOnScreenDebugMessage(-1, 2, FColor::Green, FString::FromInt(dontKnow*));
}




Now my TArray<int32> can be sort from greater to less, run as magic!!!