Is there a way to overload a function in a way to distinguish between the argument being evaluable at compile time or at runtime only?
Suppose I have the following function:
std::string lookup(int x) {
return table<x>::value;
}
which allows me to select a string value based on the parameter x in constant time (with space overhead). However, in some cases x
cannot be provided at compile time, and I need to run a version of foo which does the lookup with a higher time complexity.
I could use functions with a different name of course, but I would like to have an unified interface.
I accepted an answer, but I'm still interested if this distinction is possible with exactly the same function call.