Fixes for various compilers from John Maddock

[SVN r7629]
This commit is contained in:
Beman Dawes
2000-07-24 17:59:52 +00:00
parent 749953f36b
commit fd1ec96f68
2 changed files with 30 additions and 3 deletions

View File

@ -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 <typename T>
struct is_volatile{ enum{ value = false }; };
template <typename T, typename U> struct is_same { enum{ value = false }; };
template <typename T> struct is_void{ enum{ value = false }; };
template <> struct is_void<void>{ enum{ value = false }; };
template <> struct is_void<void>{ enum{ value = true }; };
//* is a type T an unsigned integral type described in the standard (3.9.1p3)
template <typename T> struct is_standard_unsigned_integral
@ -230,7 +235,7 @@ template <typename T> struct is_member_pointer
//* is type T an object type (allows cv-qual)
template <typename T> struct is_object
{ enum{ value = !is_reference<T>::type && !is_void<T>::value }; };
{ enum{ value = !is_reference<T>::value && !is_void<T>::value }; };
//* is type T a standard scalar type (allows cv-qual)
template <typename T> struct is_standard_scalar

View File

@ -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 <typename T> struct remove_cv<T&>{ typedef T& type; };
// * convert a type T to a non-reference if it is one - remove_reference<T>
template <typename T> struct remove_reference{ typedef T type; };
template <typename T> struct remove_reference<T&>{ 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 <typename T> struct remove_reference<T&const>{ typedef T type; };
template <typename T> struct remove_reference<T&volatile>{ typedef T type; };
template <typename T> struct remove_reference<T&const volatile>{ typedef T type; };
#endif
// * convert a type T to a reference unless it is one - add_reference<T>
template <typename T> struct add_reference{ typedef T& type; };
template <typename T> struct add_reference<T&>{ typedef T& type; };
@ -300,6 +313,15 @@ template <typename T> struct is_pointer<T*> { static const bool value = true; };
//* is a type T a reference type - is_reference<T>
template <typename T> struct is_reference { static const bool value = false; };
template <typename T> struct is_reference<T&> { 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 <typename T> struct is_reference<T&const> { static const bool value = true; };
template <typename T> struct is_reference<T&volatile> { static const bool value = true; };
template <typename T> struct is_reference<T&const volatile> { static const bool value = true; };
#endif
//*? is a type T a union type - is_union<T>
template <typename T> struct is_union