I am implementing a class that will handle the error messages for my application. The primary requirement for this class will be
Store the error id to string mapping( during compile time)
0, "No Error"
147, "Invalid Input"
. . .
2500, "Unknown error"
A method
const std::string& getErrorString(int errorId)
that will retrieve the string from the mapping
The errorIds are not contiguous, because I am going to assign ranges for modules. I was considering using a map to store the mapping, but this would mean that I would have to insert the error strings into the map at run-time - I am not sure if this is efficient, as all errors are available during compilation itself.
What is the best way to implement the error id to string mapping to allow for efficient retrieval and optimal run time? I do not have boost.