Since everybody is chiming in without knowing the question.
Here is my attempt at futility:
#include
template int getDigit(int val) {return getDigit(val/10);}
template<> int getDigit<1>(int val) {return val % 10;}
int main()
{
std::cout << getDigit<5>(1234567) << "\n";
}