From 3353896f3d16e6fee23de0027cfae585595b9db4 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sat, 2 Nov 2002 02:43:10 +0000 Subject: [PATCH] Fix some of JM's "fixes". He can come back and "fix" them again later if he doesn't like these ;-) [SVN r16048] --- include/boost/type_traits/config.hpp | 63 ++++++++++++++++++++ include/boost/type_traits/is_convertible.hpp | 1 - 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/include/boost/type_traits/config.hpp b/include/boost/type_traits/config.hpp index b54af77..f8b372d 100644 --- a/include/boost/type_traits/config.hpp +++ b/include/boost/type_traits/config.hpp @@ -14,6 +14,69 @@ #include "boost/config.hpp" #endif +// +// Helper macros for builtin compiler support. +// If your compiler has builtin support for any of the following +// traits concepts, then redefine the appropriate macros to pick +// up on the compiler support: +// +// (these should largely ignore cv-qualifiers) +// BOOST_IS_CLASS(T) should evaluate to true if T is a class or struct type +// BOOST_IS_ENUM(T) should evaluate to true if T is an enumerator type +// BOOST_IS_UNION(T) should evaluate to true if T is a union type +// BOOST_IS_POD(T) should evaluate to true if T is a POD type +// BOOST_IS_EMPTY(T) should evaluate to true if T is an empty struct or union +// BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) should evaluate to true if "T x;" has no effect +// BOOST_HAS_TRIVIAL_COPY(T) should evaluate to true if T(t) <==> memcpy +// BOOST_HAS_TRIVIAL_ASSIGN(T) should evaluate to true if t = u <==> memcpy +// BOOST_HAS_TRIVIAL_DESTRUCTOR(T) should evaluate to true if ~T() has no effect + +#ifdef BOOST_HAS_SGI_TYPE_TRAITS +# include "boost/type_traits/is_same.hpp" +# include +# define BOOST_IS_POD(T) ::boost::is_same< typename ::__type_traits::is_POD_type, ::__true_type>::value +# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) ::boost::is_same< typename ::__type_traits::has_trivial_default_constructor, ::__true_type>::value +# define BOOST_HAS_TRIVIAL_COPY(T) ::boost::is_same< typename ::__type_traits::has_trivial_copy_constructor, ::__true_type>::value +# define BOOST_HAS_TRIVIAL_ASSIGN(T) ::boost::is_same< typename ::__type_traits::has_trivial_assignment_operator, ::__true_type>::value +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) ::boost::is_same< typename ::__type_traits::has_trivial_destructor, ::__true_type>::value +#endif + +#ifndef BOOST_IS_CLASS +# define BOOST_IS_CLASS(T) false +#endif + +#ifndef BOOST_IS_ENUM +# define BOOST_IS_ENUM(T) false +#endif + +#ifndef BOOST_IS_UNION +# define BOOST_IS_UNION(T) false +#endif + +#ifndef BOOST_IS_POD +# define BOOST_IS_POD(T) false +#endif + +#ifndef BOOST_IS_EMPTY +# define BOOST_IS_EMPTY(T) false +#endif + +#ifndef BOOST_HAS_TRIVIAL_CONSTRUCTOR +# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) false +#endif + +#ifndef BOOST_HAS_TRIVIAL_COPY +# define BOOST_HAS_TRIVIAL_COPY(T) false +#endif + +#ifndef BOOST_HAS_TRIVIAL_ASSIGN +# define BOOST_HAS_TRIVIAL_ASSIGN(T) false +#endif + +#ifndef BOOST_HAS_TRIVIAL_DESTRUCTOR +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) false +#endif + // // whenever we have a conversion function with elipses // it needs to be declared __cdecl to suppress compiler diff --git a/include/boost/type_traits/is_convertible.hpp b/include/boost/type_traits/is_convertible.hpp index 68f07d9..5796ab4 100644 --- a/include/boost/type_traits/is_convertible.hpp +++ b/include/boost/type_traits/is_convertible.hpp @@ -55,7 +55,6 @@ struct does_conversion_exist { template< typename To > struct result_ { - template static no_type BOOST_TT_DECL _m_check(...); static yes_type BOOST_TT_DECL _m_check(To); static From _m_from;