
On Feb 5, 2013, at 5:24 PM, "Jeffrey Lee Hellrung, Jr."
On Tue, Feb 5, 2013 at 4:56 PM, Robert Ramey
wrote: 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
No, the original usage was just "-1". -- Marshall Marshall Clow Idio Software mailto:mclow.lists@gmail.com A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait). -- Yu Suzuki