diff --git a/include/boost/type_traits/is_signed.hpp b/include/boost/type_traits/is_signed.hpp index b283b21..b668313 100644 --- a/include/boost/type_traits/is_signed.hpp +++ b/include/boost/type_traits/is_signed.hpp @@ -13,6 +13,7 @@ #include #include #include +#include namespace boost { @@ -129,7 +130,8 @@ template <> struct is_signed : public false_type template <> struct is_signed : public false_type{}; template <> struct is_signed : public false_type{}; #endif -#if defined(CHAR_MIN) && (CHAR_MIN != 0) +#if defined(CHAR_MIN) +#if CHAR_MIN != 0 template <> struct is_signed : public true_type{}; template <> struct is_signed : public true_type{}; template <> struct is_signed : public true_type{}; @@ -140,8 +142,9 @@ template <> struct is_signed : public false_type{}; template <> struct is_signed : public false_type{}; template <> struct is_signed : 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 : public true_type{}; template <> struct is_signed : public true_type{}; template <> struct is_signed : public true_type{}; diff --git a/include/boost/type_traits/is_unsigned.hpp b/include/boost/type_traits/is_unsigned.hpp index 7243771..8e83a33 100644 --- a/include/boost/type_traits/is_unsigned.hpp +++ b/include/boost/type_traits/is_unsigned.hpp @@ -14,6 +14,8 @@ #include #include +#include + namespace boost { #if !defined( __CODEGEARC__ ) @@ -128,7 +130,8 @@ template <> struct is_unsigned : public false_typ template <> struct is_unsigned : public false_type{}; template <> struct is_unsigned : public false_type{}; #endif -#if defined(CHAR_MIN) && (CHAR_MIN == 0) +#if defined(CHAR_MIN) +#if CHAR_MIN == 0 template <> struct is_unsigned : public true_type{}; template <> struct is_unsigned : public true_type{}; template <> struct is_unsigned : public true_type{}; @@ -139,8 +142,9 @@ template <> struct is_unsigned : public false_type{}; template <> struct is_unsigned : public false_type{}; template <> struct is_unsigned : 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 : public true_type{}; template <> struct is_unsigned : public true_type{}; template <> struct is_unsigned : public true_type{}; diff --git a/test/is_signed_test.cpp b/test/is_signed_test.cpp index c76a97a..66b7e15 100644 --- a/test/is_signed_test.cpp +++ b/test/is_signed_test.cpp @@ -12,6 +12,8 @@ # include #endif +#include + TT_TEST_BEGIN(is_signed) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, true); @@ -35,6 +37,24 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, false); #endif + +#if defined(CHAR_MIN) +#if CHAR_MIN != 0 +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, true); +#else +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, false); +#endif +#endif + + +#if defined(WCHAR_MIN) +#if WCHAR_MIN != 0 +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, true); +#else +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, false); +#endif +#endif + TT_TEST_END diff --git a/test/is_unsigned_test.cpp b/test/is_unsigned_test.cpp index 484c11e..4323247 100644 --- a/test/is_unsigned_test.cpp +++ b/test/is_unsigned_test.cpp @@ -12,6 +12,8 @@ # include #endif +#include + TT_TEST_BEGIN(is_signed) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, false); @@ -36,6 +38,23 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, fals BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, true); #endif +#if defined(CHAR_MIN) +#if CHAR_MIN != 0 +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, false); +#else +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, true); +#endif +#endif + + +#if defined(WCHAR_MIN) +#if WCHAR_MIN != 0 +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, false); +#else +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, true); +#endif +#endif + TT_TEST_END