Help With C++ Sort By Predicate
I am new to lambdas and predicates. I am trying to sort an array of sensed (via the UPerceptionComponent) actors by distance from the pawn.
This gives me a compiler error: note: see reference to function template instantiation 'void TArray::Sort>(const PREDICATE_CLASS &)' being compiled with [ PREDICATE_CLASS=AMythicAIController::FindClosestSensedEnemy:: ]
Thanks in advance!
asked May 31 '17 at 12:17 PM in C++ Programming
I'd actually use a simple Struct with the () operator overloaded to help you here (I do something very similar in my own projects).
Then to use it with your Sort, you just call:
answered May 31 '17 at 04:15 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here