Hi…
Hi… i´m trying to insert my Actors inside a TSet<> container… I imagine i need to overload ‘<’ operator on my Actor classes…
but what is the correct way to do it ?
this is what i have:
//h
UCLASS()
class PROJECTAPI AMyActor : public AActor
GENERATED_BODY()
public:
FString id = "Alpha";
friend bool operator<(const AMyActor &_leftHandActor, const AMyActor &_rightHandActor);
}
//cpp
bool operator<(const AMyActor &_leftHandActor, const AMyActor &_rightHandActor){
for (int x = 0; x < 32; x++){
if (_leftHandActor.id[x] < _rightHandActor.id[x])
return true;
else{
if (_leftHandActor.id[x] == _rightHandActor.id[x])
continue;
else
return false;
}
}
}
But this is not working… i´m pretty sure i´m badly overloading operator…