From de1265e810168923efbb7e532c7d9da9fa7718cd Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Thu, 2 Nov 2000 01:12:23 +0000 Subject: [PATCH] Global replace of || with | and && with & in constant expressions to work around an MSVC bug. [SVN r8097] --- include/boost/detail/ob_type_traits.hpp | 104 ++++++++++++------------ 1 file changed, 51 insertions(+), 53 deletions(-) diff --git a/include/boost/detail/ob_type_traits.hpp b/include/boost/detail/ob_type_traits.hpp index 3dfdb2b..bd59a68 100644 --- a/include/boost/detail/ob_type_traits.hpp +++ b/include/boost/detail/ob_type_traits.hpp @@ -56,10 +56,10 @@ // traits concepts, then redefine the appropriate macros to pick // up on the compiler support: -#define BOOST_IS_CLASS(T) !is_union::value && \ - !is_scalar::value && \ - !is_array::value && \ - !is_reference::value && \ +#define BOOST_IS_CLASS(T) !is_union::value & \ + !is_scalar::value & \ + !is_array::value & \ + !is_reference::value & \ !is_void::value #define BOOST_IS_ENUM(T) false #define BOOST_IS_UNION(T) false @@ -134,8 +134,8 @@ private: static U u; public: enum{ value = (sizeof(detail::yes_result) == sizeof(detail::is_same_helper(&t,&u))) - && (is_reference::value == is_reference::value) - && (sizeof(T) == sizeof(U)) }; + & (is_reference::value == is_reference::value) + & (sizeof(T) == sizeof(U)) }; }; template struct is_void{ enum{ value = false }; }; @@ -167,7 +167,7 @@ template <> struct is_standard_signed_integral //* is a type T an integral type described in the standard (3.9.1p7) template struct is_standard_integral -{ enum{ value = is_standard_unsigned_integral::value || +{ enum{ value = is_standard_unsigned_integral::value | is_standard_signed_integral::value }; }; template <> struct is_standard_integral { enum{ value = true}; }; @@ -188,11 +188,11 @@ template <> struct is_standard_float //* is a type T an arithmetic type described in the standard (3.9.1p8) template struct is_standard_arithmetic -{ enum{ value = is_standard_integral::value || is_standard_float::value}; }; +{ enum{ value = is_standard_integral::value | is_standard_float::value}; }; //* is a type T a fundamental type described in the standard (3.9.1) template struct is_standard_fundamental -{ enum{ value = is_standard_arithmetic::value || is_void::value}; }; +{ enum{ value = is_standard_arithmetic::value | is_void::value}; }; //* is a type T an unsigned integral type provided by a compiler extension // specialise for compiler defined extentions: @@ -219,7 +219,7 @@ template <> struct is_extension_signed_integral<__int64> //* is a type T an integral type provided by a compiler extension template struct is_extension_integral -{ enum{ value = is_extension_signed_integral::value || +{ enum{ value = is_extension_signed_integral::value | is_extension_unsigned_integral::value }; }; //* is a type T a floating-point type provided by a compiler extension @@ -228,35 +228,35 @@ template struct is_extension_float //* is a type T an arithmetic type provided by a compiler extension template struct is_extension_arithmetic -{ enum{ value = is_extension_integral::value || is_extension_float::value}; }; +{ enum{ value = is_extension_integral::value | is_extension_float::value}; }; //* is a type T a fundamental type provided by a compiler extension template struct is_extension_fundamental -{ enum{ value = is_extension_arithmetic::value || is_void::value}; }; +{ enum{ value = is_extension_arithmetic::value | is_void::value}; }; //* is a type T an unsigned integral type provided by the compiler or standard template struct is_unsigned_integral -{ enum{ value = is_standard_unsigned_integral::value || is_extension_unsigned_integral::value}; }; +{ enum{ value = is_standard_unsigned_integral::value | is_extension_unsigned_integral::value}; }; //* is a type T a signed integral type provided by the compiler or standard template struct is_signed_integral -{ enum{ value = is_standard_signed_integral::value || is_extension_signed_integral::value}; }; +{ enum{ value = is_standard_signed_integral::value | is_extension_signed_integral::value}; }; //* is a type T an integral type provided by the compiler or standard template struct is_integral -{ enum{ value = is_standard_integral::value || is_extension_integral::value}; }; +{ enum{ value = is_standard_integral::value | is_extension_integral::value}; }; //* is a type T a floating-point type provided by the compiler or standard template struct is_float -{ enum{ value = is_standard_float::value || is_extension_float::value}; }; +{ enum{ value = is_standard_float::value | is_extension_float::value}; }; //* is a type T an arithmetic type provided by the compiler or standard template struct is_arithmetic -{ enum{ value = is_standard_arithmetic::value || is_extension_arithmetic::value}; }; +{ enum{ value = is_standard_arithmetic::value | is_extension_arithmetic::value}; }; //* is a type T a fundamental type provided by the compiler or standard template struct is_fundamental -{ enum{ value = is_standard_fundamental::value || is_extension_fundamental::value}; }; +{ enum{ value = is_standard_fundamental::value | is_extension_fundamental::value}; }; //* is a type T an array - is_array namespace detail{ @@ -287,9 +287,9 @@ private: static T t; public: enum{ value = (1 == sizeof(detail::is_pointer_helper(t))) - && (1 == sizeof(detail::is_array_helper(&t, t))) - && !is_reference::value - && !(1 == sizeof(detail::is_pointer_helper3(t))) }; + & (1 == sizeof(detail::is_array_helper(&t, t))) + & !is_reference::value + & !(1 == sizeof(detail::is_pointer_helper3(t))) }; }; //* is a type T a pointer type (including function pointers) - is_pointer @@ -299,11 +299,11 @@ private: static T t; public: enum{ value = (!is_const::value - && !is_volatile::value - && !is_reference::value - && !is_array::value) - && ((1 == sizeof(detail::is_pointer_helper(t))) - || (1 == sizeof(detail::is_pointer_helper3(t)))) }; + & !is_volatile::value + & !is_reference::value + & !is_array::value) + & ((1 == sizeof(detail::is_pointer_helper(t))) + | (1 == sizeof(detail::is_pointer_helper3(t)))) }; }; # ifdef BOOST_MSVC @@ -319,9 +319,7 @@ private: public: enum // dwa 10/27/00 - VC6.4 seems to choke on short-circuit (&&,||) { // evaluations in constant expressions - value = !is_const::value ? true - : !is_volatile::value ? true - : false + value = !is_const::value | !is_volatile::value }; }; template <> struct is_reference @@ -363,28 +361,28 @@ public: //* is type T an object type (allows cv-qual) template struct is_object -{ enum{ value = !is_reference::value && !is_void::value }; }; +{ enum{ value = !is_reference::value & !is_void::value }; }; //* is type T a standard scalar type (allows cv-qual) template struct is_standard_scalar { enum{ value = is_standard_arithmetic::value - || is_enum::value - || is_pointer::value - || is_member_pointer::value }; }; + | is_enum::value + | is_pointer::value + | is_member_pointer::value }; }; //* is type T an extension scalar type (allows cv-qual) template struct is_extension_scalar { enum{ value = is_extension_arithmetic::value - || is_enum::value - || is_pointer::value - || is_member_pointer::value }; }; + | is_enum::value + | is_pointer::value + | is_member_pointer::value }; }; //* is type T a builtin scalar type (allows cv-qual) template struct is_scalar { enum{ value = is_arithmetic::value - || is_enum::value - || is_pointer::value - || is_member_pointer::value }; }; + | is_enum::value + | is_pointer::value + | is_member_pointer::value }; }; //*? is a type T a class type (class/struct) - is_class template struct is_class @@ -392,14 +390,14 @@ template struct is_class //*? is a type T a compound type template struct is_compound -{ enum{ value = is_array::value || is_pointer::value - || is_reference::value || is_class::value || is_union::value - || is_enum::value || is_member_pointer::value }; }; +{ enum{ value = is_array::value | is_pointer::value + | is_reference::value | is_class::value | is_union::value + | is_enum::value | is_member_pointer::value }; }; //*? is type T a POD type (allows cv-qual) template struct is_POD { enum{ value = is_scalar::value //JM 7Jan2000 - || BOOST_IS_POD(T) }; }; + | BOOST_IS_POD(T) }; }; namespace detail{ @@ -519,15 +517,15 @@ struct is_empty private: typedef detail::empty_helper_chooser< !is_convertible::value - && !is_convertible::value - && !is_pointer::value - && !is_member_pointer::value - && !is_array::value - && !is_convertible::value> chooser; + & !is_convertible::value + & !is_pointer::value + & !is_member_pointer::value + & !is_array::value + & !is_convertible::value> chooser; typedef typename chooser::template rebind bound_type; typedef typename bound_type::type eh_type; public: - enum{ value = eh_type::value || BOOST_IS_EMPTY(T) }; + enum{ value = eh_type::value | BOOST_IS_EMPTY(T) }; }; #else @@ -538,27 +536,27 @@ template struct is_empty //*? T has trivial default constructor (allows cv-qual) template struct has_trivial_constructor { - enum{ value = is_POD::value || BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) }; + enum{ value = is_POD::value | BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) }; }; //*? T has trivial copy constructor (allows cv-qual) template struct has_trivial_copy { - enum{ value = is_POD::value || BOOST_HAS_TRIVIAL_COPY(T) }; + enum{ value = is_POD::value | BOOST_HAS_TRIVIAL_COPY(T) }; }; //*? T has trivial assignment operator (allows cv-qual) template struct has_trivial_assign { - enum{ value = is_POD::value || BOOST_HAS_TRIVIAL_ASSIGN(T) }; + enum{ value = is_POD::value | BOOST_HAS_TRIVIAL_ASSIGN(T) }; }; //*? T has trivial destructor (allows cv-qual) template struct has_trivial_destructor { - enum{ value = is_POD::value || BOOST_HAS_TRIVIAL_DESTRUCTOR(T) }; + enum{ value = is_POD::value | BOOST_HAS_TRIVIAL_DESTRUCTOR(T) }; }; } // namespace boost