From fd1ec96f6807fa5aa71bc2075fe940d4bae5b597 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Mon, 24 Jul 2000 17:59:52 +0000 Subject: [PATCH] Fixes for various compilers from John Maddock [SVN r7629] --- include/boost/detail/ob_type_traits.hpp | 9 +++++++-- include/boost/detail/type_traits.hpp | 24 +++++++++++++++++++++++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/include/boost/detail/ob_type_traits.hpp b/include/boost/detail/ob_type_traits.hpp index c5bab2e..c31901c 100644 --- a/include/boost/detail/ob_type_traits.hpp +++ b/include/boost/detail/ob_type_traits.hpp @@ -9,6 +9,11 @@ // Crippled version of type traits for compilers that don't // support partial specialisation. (C) John Maddock 2000 +/* Release notes: + 23rd July 2000: + Fixed is_void specialization. (JM) +*/ + #ifndef BOOST_OB_TYPE_TRAITS_HPP #define BOOST_OB_TYPE_TRAITS_HPP @@ -65,7 +70,7 @@ template struct is_volatile{ enum{ value = false }; }; template struct is_same { enum{ value = false }; }; template struct is_void{ enum{ value = false }; }; -template <> struct is_void{ enum{ value = false }; }; +template <> struct is_void{ enum{ value = true }; }; //* is a type T an unsigned integral type described in the standard (3.9.1p3) template struct is_standard_unsigned_integral @@ -230,7 +235,7 @@ template struct is_member_pointer //* is type T an object type (allows cv-qual) template struct is_object -{ enum{ value = !is_reference::type && !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 diff --git a/include/boost/detail/type_traits.hpp b/include/boost/detail/type_traits.hpp index e807705..4e69c05 100644 --- a/include/boost/detail/type_traits.hpp +++ b/include/boost/detail/type_traits.hpp @@ -6,6 +6,11 @@ // See http://www.boost.org for most recent version including documentation. +/* Release notes: + 23rd July 2000: + Added Borland specific fixes for reference types (Steve Cleary). +*/ + #ifndef BOOST_DETAIL_TYPE_TRAITS_HPP #define BOOST_DETAIL_TYPE_TRAITS_HPP @@ -135,7 +140,15 @@ template struct remove_cv{ typedef T& type; }; // * convert a type T to a non-reference if it is one - remove_reference template struct remove_reference{ typedef T type; }; template struct remove_reference{ typedef T type; }; - +#if (defined(__BORLANDC__) && (__BORLANDC__ <= 0x550)) +// these are illegal specialisations; cv-qualifies applied to +// references have no effect according to [8.3.2p1], +// C++ Builder requires them though as it treats cv-qualified +// references as distinct types... +template struct remove_reference{ typedef T type; }; +template struct remove_reference{ typedef T type; }; +template struct remove_reference{ typedef T type; }; +#endif // * convert a type T to a reference unless it is one - add_reference template struct add_reference{ typedef T& type; }; template struct add_reference{ typedef T& type; }; @@ -300,6 +313,15 @@ template struct is_pointer { static const bool value = true; }; //* is a type T a reference type - is_reference template struct is_reference { static const bool value = false; }; template struct is_reference { static const bool value = true; }; +#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x550) +// these are illegal specialisations; cv-qualifies applied to +// references have no effect according to [8.3.2p1], +// C++ Builder requires them though as it treats cv-qualified +// references as distinct types... +template struct is_reference { static const bool value = true; }; +template struct is_reference { static const bool value = true; }; +template struct is_reference { static const bool value = true; }; +#endif //*? is a type T a union type - is_union template struct is_union