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
Boost.Integer already has facilities for Integer Type Selection:
boost::int_max_value_t::least
The smallest, built-in, signed integral type that can hold all the values in the inclusive range 0 - V. The parameter should be a positive number.
boost::uint_value_t::least
The smallest, built-in, unsigned integral type that can hold all positive values up to and including V. The parameter should be a positive number.