2 // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
3 // Permission to copy, use, modify, sell and distribute this software is
4 // granted provided this copyright notice appears in all copies. This software
5 // is provided "as is" without express or implied warranty, and with no claim
6 // as to its suitability for any purpose.
8 // See http://www.boost.org for most recent version including documentation.
10 #ifndef BOOST_TT_INTRINSICS_HPP_INCLUDED
11 #define BOOST_TT_INTRINSICS_HPP_INCLUDED
13 #ifndef BOOST_TT_CONFIG_HPP_INCLUDED
14 #include "boost/type_traits/config.hpp"
18 // Helper macros for builtin compiler support.
19 // If your compiler has builtin support for any of the following
20 // traits concepts, then redefine the appropriate macros to pick
21 // up on the compiler support:
23 // (these should largely ignore cv-qualifiers)
24 // BOOST_IS_UNION(T) should evaluate to true if T is a union type
25 // BOOST_IS_POD(T) should evaluate to true if T is a POD type
26 // BOOST_IS_EMPTY(T) should evaluate to true if T is an empty struct or union
27 // BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) should evaluate to true if "T x;" has no effect
28 // BOOST_HAS_TRIVIAL_COPY(T) should evaluate to true if T(t) <==> memcpy
29 // BOOST_HAS_TRIVIAL_ASSIGN(T) should evaluate to true if t = u <==> memcpy
30 // BOOST_HAS_TRIVIAL_DESTRUCTOR(T) should evaluate to true if ~T() has no effect
32 #ifdef BOOST_HAS_SGI_TYPE_TRAITS
33 // Hook into SGI's __type_traits class, this will pick up user supplied
34 // specializations as well as SGI - compiler supplied specializations.
35 # include "boost/type_traits/is_same.hpp"
36 # include <type_traits.h>
37 # define BOOST_IS_POD(T) ::boost::is_same< typename ::__type_traits<T>::is_POD_type, ::__true_type>::value
38 # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_default_constructor, ::__true_type>::value
39 # define BOOST_HAS_TRIVIAL_COPY(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_copy_constructor, ::__true_type>::value
40 # define BOOST_HAS_TRIVIAL_ASSIGN(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_assignment_operator, ::__true_type>::value
41 # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_destructor, ::__true_type>::value
44 #if defined(__MSL_CPP__) && (__MSL_CPP__ >= 0x8000)
45 // Metrowerks compiler is acquiring intrinsic type traits support
46 // post version 8. We hook into the published interface to pick up
47 // user defined specializations as well as compiler intrinsics as
48 // and when they become available:
49 # include <msl_utility>
50 # define BOOST_IS_UNION(T) BOOST_STD_EXTENSION_NAMESPACE::is_union<T>::value
51 # define BOOST_IS_POD(T) BOOST_STD_EXTENSION_NAMESPACE::is_POD<T>::value
52 # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_default_ctor<T>::value
53 # define BOOST_HAS_TRIVIAL_COPY(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_copy_ctor<T>::value
54 # define BOOST_HAS_TRIVIAL_ASSIGN(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_assignment<T>::value
55 # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_dtor<T>::value
58 #ifndef BOOST_IS_UNION
59 # define BOOST_IS_UNION(T) false
63 # define BOOST_IS_POD(T) false
66 #ifndef BOOST_IS_EMPTY
67 # define BOOST_IS_EMPTY(T) false
70 #ifndef BOOST_HAS_TRIVIAL_CONSTRUCTOR
71 # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) false
74 #ifndef BOOST_HAS_TRIVIAL_COPY
75 # define BOOST_HAS_TRIVIAL_COPY(T) false
78 #ifndef BOOST_HAS_TRIVIAL_ASSIGN
79 # define BOOST_HAS_TRIVIAL_ASSIGN(T) false
82 #ifndef BOOST_HAS_TRIVIAL_DESTRUCTOR
83 # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) false
86 #endif // BOOST_TT_INTRINSICS_HPP_INCLUDED