Hi, I want to use TMultiMap with FText or FStrings arrays, something like this: TMultiMap<TArray<FText> keys, TArray<FText> values> map = { {"key", "key2"}, {"val"} };
I would like to be able to search for a value based on some keys. Is this how it works? Also, how should I write such a map ? Any help is appreciated. Thankyou !
TMap is an associative container where the key must be unique. TMultiMap is a TMap variant where the uniqueness condition is absent.
For example, if you want to create a city resident register:
you can create TMap, where the key is the address and the value is a collection of people living in (because the address SHOULD be unique within the city)
you can create TMultiMap where the key will be a resident and the value will be the address where he lives (because you can have many people in the city with the same name and surname)
But a map where the key is an array… looks very strange.
That’s only true if it is a UPROPERTY. If it’s just a naked member variable, nested containers work fine. Though I agree with Emaer that an array as the key is particularly strange and someone non-sensical.