I have string tags in my code that are converted to numbers and used to search values in a tag-value structure.
I have something like this:
void foo(
If the string literal is known at compile time, then there is probably no reason to use it as a string literal. You may use enumeration or named integral constants.
If the string is passed to the search function by a variable and it is not known at compile time, then there is no way to do the toNumber() resulution at compile time. Then a good solution is to use some kind of a dictionary (e.g. std::map)