Download

Best way to initialize and use lookup table? (hash table, std::map, etc.)

For a project I’m working on I need a data structure to store country metadata (latitude, longitude, name, etc.) in. I need to be able to look up that metadata using the country’s ISO 3166 codes (“US”, “UK”, “NL”, etc.) and I need to be able to iterate through the data to spawn Country actors from C++.

In normal C++ I would use an std::map, but I’m not sure what approach I should take with UE4. I’ve made a C++ class BaseCountry and a Country blueprint from that base class. In other languages I would just put a hash table literal in the source code and be done with it. Does UE4 have support for that?