Just had a quick question that is probable really easy to solve but I must be too blind to see the obvious.
Im simply said trying to sort a TArray of TSharedPtr< FString >.
But it doesnt work.
Options.Sort() just crashes telling me:
binary ‘<’: no operator found which takes a left-hand operand of type ‘const T’ (or there is no acceptable conversion)
And with a predicate it also crashes:
Options.Sort([](const TSharedPtr<FString>& A, const TSharedPtr<FString>& B)
{
return A < B;
})
binary ‘<’: no operator found which takes a left-hand operand of type ‘const TSharedPtr<FString,ESPMode::NotThreadSafe>’ (or there is no acceptable conversion)
Not exactly sure what to do about that, would be great if someone could help me out!
I think you need to dereference the pointer before using FString operators on it, is there any reason for you to use a TSharedPtr on a FString? If you use Slate and need to manage memory manually I would recommend to wrap a TArray< FString> with TSharedPtr instead
Yes I am using it with Slate for a dropdown.
Which unfortunately requires me to use TArray<TSharedPtr< FString>> for the .OptionsSource(), as it doesn’t have any overloads that accept it otherwise to my knowledge.