From 2dcf1ebd5e46e5fc587dcf3b2feeac13f84c3a48 Mon Sep 17 00:00:00 2001 From: Daniel Scharrer Date: Thu, 1 Mar 2012 15:46:52 +0100 Subject: [PATCH] Add support for older boost versions that dont have boost::[u]int_t::exact. --- src/util/types.hpp | 66 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/src/util/types.hpp b/src/util/types.hpp index 89641a1..da1e23a 100644 --- a/src/util/types.hpp +++ b/src/util/types.hpp @@ -23,6 +23,7 @@ #include +#include #include #include @@ -34,16 +35,77 @@ struct compatible_integer { typedef void type; }; +#if BOOST_VERSION < 104200 + +namespace detail { + + template + struct uint_t { }; + + template <> + struct uint_t<8> : public boost::uint_t<8> { + typedef uint8_t exact; + }; + + template <> + struct uint_t<16> : public boost::uint_t<16> { + typedef uint16_t exact; + }; + + template <> + struct uint_t<32> : public boost::uint_t<32> { + typedef uint32_t exact; + }; + + template <> + struct uint_t<64> : public boost::uint_t<64> { + typedef uint64_t exact; + }; + + template + struct int_t { }; + + template <> + struct int_t<8> : public boost::int_t<8> { + typedef int8_t exact; + }; + + template <> + struct int_t<16> : public boost::int_t<16> { + typedef int16_t exact; + }; + + template <> + struct int_t<32> : public boost::int_t<32> { + typedef int32_t exact; + }; + + template <> + struct int_t<64> : public boost::int_t<64> { + typedef int64_t exact; + }; + +} + +#else + +namespace detail { + using boost::uint_t; + using boost::int_t; +} + +#endif + template struct compatible_integer { - typedef typename boost::uint_t< + typedef typename detail::uint_t< boost::static_unsigned_min::value >::exact type; }; template struct compatible_integer { - typedef typename boost::int_t< + typedef typename detail::int_t< boost::static_unsigned_min::value >::exact type; };