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(
Not sure that you can. Is the list of possible tags small? Even if not, is it small most of the time. If so, you can use template specialization on a subset of the tags
template
int toNumber() {
return toNumber(tag);
}
template<>
int toNumber<"0">() {
return 0;
}
template<>
int toNumber<"1">() {
return 1;
}
(caveats: my specialization syntax might be wrong, and I have no idea if this works for char*)