I want to create a std::unordered_map < int, std::string >
or std::unordered_map< std::string, int >
.
In this map I will store strings and their integer representations.
I'll fill this map only in the code(hard coded pairs).
I'll need convert input strings to their int values - find in map. So I only need to search in the map at the run time. At this point I need the best performance while converting. In the best case - O(1).
My questions:
- Should I use string as key or int ?
- Should I define my own hash-function ?
- What is the best-performance find function for the both cases string/int and int/string as key-pairs?