
On Tue, Feb 5, 2013 at 4:56 PM, Robert Ramey
Christian Henning wrote:
boost::int_max_value_t<V>
http://www.boost.org/doc/libs/1_53_0/libs/integer/doc/html/boost_integer/int...
Robert, are you sure I can get the max value of a 15bit value using int_max_value_t?
whoops - I totally misread your question, I was thinking you wanted the TYPE which would hold a max value corresponding to 15 bits.
It turns out that I've been working in this area recently. I would suggest skipping the mpl layer and using BOOST_STATIC_CONSTANT directly. The reason is that mpl includes some operations like next which might not work for 2^64 etc.
template <int K> struct unsigned_integral_max_value struct { BOOST_STATIC_CONSTANT( boost::uintmax_t, value = ((boost::uintmax_t)1 << K)-1); };
Isn't this pretty much exactly what Christian was using before? If so, I'd guess it still has the same compile-time-overflow issues. But maybe I'm misremembering the original problem :/ - Jeff