Fix preprocessor logic, and add missing #include.

This commit is contained in:
jzmaddock
2015-02-26 19:11:18 +00:00
parent 90fca0f64b
commit 13c3530448
4 changed files with 52 additions and 6 deletions

View File

@@ -13,6 +13,7 @@
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/is_enum.hpp>
#include <climits>
namespace boost {
@@ -129,7 +130,8 @@ template <> struct is_signed<const ::boost::ulong_long_type> : public false_type
template <> struct is_signed<volatile ::boost::ulong_long_type> : public false_type{};
template <> struct is_signed<const volatile ::boost::ulong_long_type> : public false_type{};
#endif
#if defined(CHAR_MIN) && (CHAR_MIN != 0)
#if defined(CHAR_MIN)
#if CHAR_MIN != 0
template <> struct is_signed<char> : public true_type{};
template <> struct is_signed<const char> : public true_type{};
template <> struct is_signed<volatile char> : public true_type{};
@@ -140,8 +142,9 @@ template <> struct is_signed<const char> : public false_type{};
template <> struct is_signed<volatile char> : public false_type{};
template <> struct is_signed<const volatile char> : public false_type{};
#endif
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
#if defined(WCHAR_MIN) && (WCHAR_MIN != 0)
#endif
#if defined(WCHAR_MIN) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
#if WCHAR_MIN != 0
template <> struct is_signed<wchar_t> : public true_type{};
template <> struct is_signed<const wchar_t> : public true_type{};
template <> struct is_signed<volatile wchar_t> : public true_type{};

View File

@@ -14,6 +14,8 @@
#include <boost/type_traits/is_enum.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <climits>
namespace boost {
#if !defined( __CODEGEARC__ )
@@ -128,7 +130,8 @@ template <> struct is_unsigned<const ::boost::long_long_type> : public false_typ
template <> struct is_unsigned<volatile ::boost::long_long_type> : public false_type{};
template <> struct is_unsigned<const volatile ::boost::long_long_type> : public false_type{};
#endif
#if defined(CHAR_MIN) && (CHAR_MIN == 0)
#if defined(CHAR_MIN)
#if CHAR_MIN == 0
template <> struct is_unsigned<char> : public true_type{};
template <> struct is_unsigned<const char> : public true_type{};
template <> struct is_unsigned<volatile char> : public true_type{};
@@ -139,8 +142,9 @@ template <> struct is_unsigned<const char> : public false_type{};
template <> struct is_unsigned<volatile char> : public false_type{};
template <> struct is_unsigned<const volatile char> : public false_type{};
#endif
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
#if defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
#endif
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && defined(WCHAR_MIN)
#if WCHAR_MIN == 0
template <> struct is_unsigned<wchar_t> : public true_type{};
template <> struct is_unsigned<const wchar_t> : public true_type{};
template <> struct is_unsigned<volatile wchar_t> : public true_type{};

View File

@@ -12,6 +12,8 @@
# include <boost/type_traits/is_signed.hpp>
#endif
#include <climits>
TT_TEST_BEGIN(is_signed)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<int>::value, true);
@@ -35,6 +37,24 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<int[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<boost::int128_type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<boost::uint128_type>::value, false);
#endif
#if defined(CHAR_MIN)
#if CHAR_MIN != 0
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<char>::value, true);
#else
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<char>::value, false);
#endif
#endif
#if defined(WCHAR_MIN)
#if WCHAR_MIN != 0
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<wchar_t>::value, true);
#else
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<wchar_t>::value, false);
#endif
#endif
TT_TEST_END

View File

@@ -12,6 +12,8 @@
# include <boost/type_traits/is_unsigned.hpp>
#endif
#include <climits>
TT_TEST_BEGIN(is_signed)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<int>::value, false);
@@ -36,6 +38,23 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<boost::int128_type>::value, fals
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<boost::uint128_type>::value, true);
#endif
#if defined(CHAR_MIN)
#if CHAR_MIN != 0
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<char>::value, false);
#else
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<char>::value, true);
#endif
#endif
#if defined(WCHAR_MIN)
#if WCHAR_MIN != 0
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<wchar_t>::value, false);
#else
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<wchar_t>::value, true);
#endif
#endif
TT_TEST_END