I would assume that this is covered in the C++ Standard, but I've not been able to find it. I am writing some templates that are going to do arithmetic on their non-type integral parameters, and I find I need the equivalent of MAX_INT
for the parameter 'x' in a template like template <int x> Foo
.
Ideally someone could point me to the paragraph in the standard (if one exists) that gives the allowable ranges for the sizes of integral template parameters and any way of determining the actual number of bits on a particular implementation.
--
To clarify: its the templates that will be doing the math within the type system, as part of a metaprogramming library. The 'int' will never be instantiated, and will never take up runtime storage. In many ways its analogous to the math done by the preprocessor, and in that case I know that the integral types are not guaranteed to be the same size as an 'int'. What I am looking for is the part of the standard that says if the types ARE the same or not, and if not, how many bits are used by template integral parameters during compilation.