source: NonGTP/Boost/boost/type_traits/intrinsics.hpp @ 857

Revision 857, 5.4 KB checked in by igarcia, 18 years ago (diff)
Line 
1
2//  (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
3//  Use, modification and distribution are subject to the Boost Software License,
4//  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5//  http://www.boost.org/LICENSE_1_0.txt).
6//
7//  See http://www.boost.org/libs/type_traits for most recent version including documentation.
8
9#ifndef BOOST_TT_INTRINSICS_HPP_INCLUDED
10#define BOOST_TT_INTRINSICS_HPP_INCLUDED
11
12#ifndef BOOST_TT_CONFIG_HPP_INCLUDED
13#include "boost/type_traits/config.hpp"
14#endif
15
16//
17// Helper macros for builtin compiler support.
18// If your compiler has builtin support for any of the following
19// traits concepts, then redefine the appropriate macros to pick
20// up on the compiler support:
21//
22// (these should largely ignore cv-qualifiers)
23// BOOST_IS_UNION(T) should evaluate to true if T is a union type
24// BOOST_IS_POD(T) should evaluate to true if T is a POD type
25// BOOST_IS_EMPTY(T) should evaluate to true if T is an empty struct or union
26// BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) should evaluate to true if "T x;" has no effect
27// BOOST_HAS_TRIVIAL_COPY(T) should evaluate to true if T(t) <==> memcpy
28// BOOST_HAS_TRIVIAL_ASSIGN(T) should evaluate to true if t = u <==> memcpy
29// BOOST_HAS_TRIVIAL_DESTRUCTOR(T) should evaluate to true if ~T() has no effect
30// BOOST_HAS_NOTHROW_CONSTRUCTOR(T) should evaluate to true if "T x;" can not throw
31// BOOST_HAS_NOTHROW_COPY(T) should evaluate to true if T(t) can not throw
32// BOOST_HAS_NOTHROW_ASSIGN(T) should evaluate to true if t = u can not throw
33// BOOST_HAS_VIRTUAL_DESTRUCTOR(T) should evaluate to true T has a virtual destructor
34
35#ifdef BOOST_HAS_SGI_TYPE_TRAITS
36    // Hook into SGI's __type_traits class, this will pick up user supplied
37    // specializations as well as SGI - compiler supplied specializations.
38#   include "boost/type_traits/is_same.hpp"
39#   include <type_traits.h>
40#   define BOOST_IS_POD(T) ::boost::is_same< typename ::__type_traits<T>::is_POD_type, ::__true_type>::value
41#   define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_default_constructor, ::__true_type>::value
42#   define BOOST_HAS_TRIVIAL_COPY(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_copy_constructor, ::__true_type>::value
43#   define BOOST_HAS_TRIVIAL_ASSIGN(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_assignment_operator, ::__true_type>::value
44#   define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_destructor, ::__true_type>::value
45
46#   ifdef __sgi
47#      define BOOST_HAS_TYPE_TRAITS_INTRINSICS
48#   endif
49#endif
50
51#if defined(__MSL_CPP__) && (__MSL_CPP__ >= 0x8000)
52    // Metrowerks compiler is acquiring intrinsic type traits support
53    // post version 8.  We hook into the published interface to pick up
54    // user defined specializations as well as compiler intrinsics as
55    // and when they become available:
56#   include <msl_utility>
57#   define BOOST_IS_UNION(T) BOOST_STD_EXTENSION_NAMESPACE::is_union<T>::value
58#   define BOOST_IS_POD(T) BOOST_STD_EXTENSION_NAMESPACE::is_POD<T>::value
59#   define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_default_ctor<T>::value
60#   define BOOST_HAS_TRIVIAL_COPY(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_copy_ctor<T>::value
61#   define BOOST_HAS_TRIVIAL_ASSIGN(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_assignment<T>::value
62#   define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_dtor<T>::value
63#   define BOOST_HAS_TYPE_TRAITS_INTRINSICS
64#endif
65
66#if defined(BOOST_MSVC) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >=140050215)
67#   define BOOST_IS_UNION(T) __is_union(T)
68#   define BOOST_IS_POD(T) __is_pod(T)
69#   define BOOST_IS_EMPTY(T) __is_empty(T)
70#   define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
71#   define BOOST_HAS_TRIVIAL_COPY(T) __has_trivial_copy(T)
72#   define BOOST_HAS_TRIVIAL_ASSIGN(T) __has_trivial_assign(T)
73#   define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
74#   define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T)
75#   define BOOST_HAS_NOTHROW_COPY(T) __has_nothrow_copy(T)
76#   define BOOST_HAS_NOTHROW_ASSIGN(T) __has_nothrow_assign(T)
77#   define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
78#   define BOOST_HAS_TYPE_TRAITS_INTRINSICS
79#endif
80
81
82#ifndef BOOST_IS_UNION
83#   define BOOST_IS_UNION(T) false
84#endif
85
86#ifndef BOOST_IS_POD
87#   define BOOST_IS_POD(T) false
88#endif
89
90#ifndef BOOST_IS_EMPTY
91#   define BOOST_IS_EMPTY(T) false
92#endif
93
94#ifndef BOOST_HAS_TRIVIAL_CONSTRUCTOR
95#   define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) false
96#endif
97
98#ifndef BOOST_HAS_TRIVIAL_COPY
99#   define BOOST_HAS_TRIVIAL_COPY(T) false
100#endif
101
102#ifndef BOOST_HAS_TRIVIAL_ASSIGN
103#   define BOOST_HAS_TRIVIAL_ASSIGN(T) false
104#endif
105
106#ifndef BOOST_HAS_TRIVIAL_DESTRUCTOR
107#   define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) false
108#endif
109
110#ifndef BOOST_HAS_NOTHROW_CONSTRUCTOR
111#   define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) false
112#endif
113
114#ifndef BOOST_HAS_NOTHROW_COPY
115#   define BOOST_HAS_NOTHROW_COPY(T) false
116#endif
117
118#ifndef BOOST_HAS_NOTHROW_ASSIGN
119#   define BOOST_HAS_NOTHROW_ASSIGN(T) false
120#endif
121
122#ifndef BOOST_HAS_VIRTUAL_DESTRUCTOR
123#   define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) false
124#endif
125
126#endif // BOOST_TT_INTRINSICS_HPP_INCLUDED
127
128
129
130
Note: See TracBrowser for help on using the repository browser.