Is there any way in C++ define a type that is big enough to hold at most a specific number, presumably using some clever template code. For example I want to be able to writ
Do you necessarily want the smallest, as opposed to using int for types smaller than int?
If not, and your compiler supports it, could you do:
int main()
{
typeof('A') i_65 = 0; // declare variable 'i_65' of type 'char'
typeof(10) i_10 = 0; // int
typeof(10000) i_10000 = 0; // int
typeof(1000000000000LL) i_1000000000000 = 0; // int 64
}