How do I use FText as a key in a TMap?

So it seems like there’s no hashing function defined for FText.
How would I go about creating one?

I get a There is no GetTypeHash in FText error when I try to declare it.

Context: I’d like to use FText as a key type in a TMap variable like the following: TMap<FText, FMyCustomStruct>.

If hash can not be made for key, this type can not be a key. Looking your previues why don’t you use your struct as key instead? Ofcorse oyu will need to make your own GetTypeHash

My data structure wouldn’t make any sense if I switched keys and values.

FText does not make either, it’s kind of wierd to use it, remember that FText contains auto generated string ID which may change but also can contain only default string without ID if oyu gonna make it using FromString function, you can also disable localization of FText n property editor, might be reason why it has no hash funciton.

What is the function of the struct? If you could place ID in there it might be good. Other option is use of arrays each for FText and struct and try to sync them, remove and add things at the same time so index is always the same on both. Array don’t contain any ID, it’s just memory storage offset (index*size) so it actually more optimal if you don’t need strict keys

Thanks for your suggestion, but…

I’m not really trying to restructure my code here. My data structure makes perfect sense using FStrings as of now. I was just wondering how I could implement my own hashing functions or re-use existing ones for FText type.

There’s limited documentation around KeyFuncs argument that can be passed when declaring a variable of TMap type, but from what I understand, I could use that to implement FText as a key type.
One could dive in and try to find out how to utilize it by inspecting the engine source code, but if there are people who have already done that, I’d like to hear their input.

In other words, I’m not looking for a solution to a game logic problem, I’m looking for a solution to an architecture problem.

TL;DR: I feel like your comment suggests another approach instead of helping me figure out implementing the approach I have in mind, there’s nothing wrong with that, but I’d still like to know the answer to my original question.