Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 1 | // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. |
| 2 | // Use, modification and distribution are subject to the Boost Software License, |
| 3 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
| 4 | // http://www.boost.org/LICENSE_1_0.txt). |
| 5 | // |
| 6 | // See http://www.boost.org/libs/type_traits for most recent version including documentation. |
| 7 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 8 | #ifndef NDNBOOST_TT_INTRINSICS_HPP_INCLUDED |
| 9 | #define NDNBOOST_TT_INTRINSICS_HPP_INCLUDED |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 10 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 11 | #ifndef NDNBOOST_TT_CONFIG_HPP_INCLUDED |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 12 | #include <ndnboost/type_traits/config.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 13 | #endif |
| 14 | |
| 15 | // |
| 16 | // Helper macros for builtin compiler support. |
| 17 | // If your compiler has builtin support for any of the following |
| 18 | // traits concepts, then redefine the appropriate macros to pick |
| 19 | // up on the compiler support: |
| 20 | // |
| 21 | // (these should largely ignore cv-qualifiers) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 22 | // NDNBOOST_IS_UNION(T) should evaluate to true if T is a union type |
| 23 | // NDNBOOST_IS_POD(T) should evaluate to true if T is a POD type |
| 24 | // NDNBOOST_IS_EMPTY(T) should evaluate to true if T is an empty class type (and not a union) |
| 25 | // NDNBOOST_HAS_TRIVIAL_CONSTRUCTOR(T) should evaluate to true if "T x;" has no effect |
| 26 | // NDNBOOST_HAS_TRIVIAL_COPY(T) should evaluate to true if T(t) <==> memcpy |
| 27 | // NDNBOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) should evaluate to true if T(ndnboost::move(t)) <==> memcpy |
| 28 | // NDNBOOST_HAS_TRIVIAL_ASSIGN(T) should evaluate to true if t = u <==> memcpy |
| 29 | // NDNBOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) should evaluate to true if t = ndnboost::move(u) <==> memcpy |
| 30 | // NDNBOOST_HAS_TRIVIAL_DESTRUCTOR(T) should evaluate to true if ~T() has no effect |
| 31 | // NDNBOOST_HAS_NOTHROW_CONSTRUCTOR(T) should evaluate to true if "T x;" can not throw |
| 32 | // NDNBOOST_HAS_NOTHROW_COPY(T) should evaluate to true if T(t) can not throw |
| 33 | // NDNBOOST_HAS_NOTHROW_ASSIGN(T) should evaluate to true if t = u can not throw |
| 34 | // NDNBOOST_HAS_VIRTUAL_DESTRUCTOR(T) should evaluate to true T has a virtual destructor |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 35 | // |
| 36 | // The following can also be defined: when detected our implementation is greatly simplified. |
| 37 | // |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 38 | // NDNBOOST_IS_ABSTRACT(T) true if T is an abstract type |
| 39 | // NDNBOOST_IS_BASE_OF(T,U) true if T is a base class of U |
| 40 | // NDNBOOST_IS_CLASS(T) true if T is a class type (and not a union) |
| 41 | // NDNBOOST_IS_CONVERTIBLE(T,U) true if T is convertible to U |
| 42 | // NDNBOOST_IS_ENUM(T) true is T is an enum |
| 43 | // NDNBOOST_IS_POLYMORPHIC(T) true if T is a polymorphic type |
| 44 | // NDNBOOST_ALIGNMENT_OF(T) should evaluate to the alignment requirements of type T. |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 45 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 46 | #ifdef NDNBOOST_HAS_SGI_TYPE_TRAITS |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 47 | // Hook into SGI's __type_traits class, this will pick up user supplied |
| 48 | // specializations as well as SGI - compiler supplied specializations. |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 49 | # include <ndnboost/type_traits/is_same.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 50 | # ifdef __NetBSD__ |
| 51 | // There are two different versions of type_traits.h on NetBSD on Spark |
| 52 | // use an implicit include via algorithm instead, to make sure we get |
| 53 | // the same version as the std lib: |
| 54 | # include <algorithm> |
| 55 | # else |
| 56 | # include <type_traits.h> |
| 57 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 58 | # define NDNBOOST_IS_POD(T) ::ndnboost::is_same< typename ::__type_traits<T>::is_POD_type, ::__true_type>::value |
| 59 | # define NDNBOOST_HAS_TRIVIAL_CONSTRUCTOR(T) ::ndnboost::is_same< typename ::__type_traits<T>::has_trivial_default_constructor, ::__true_type>::value |
| 60 | # define NDNBOOST_HAS_TRIVIAL_COPY(T) ::ndnboost::is_same< typename ::__type_traits<T>::has_trivial_copy_constructor, ::__true_type>::value |
| 61 | # define NDNBOOST_HAS_TRIVIAL_ASSIGN(T) ::ndnboost::is_same< typename ::__type_traits<T>::has_trivial_assignment_operator, ::__true_type>::value |
| 62 | # define NDNBOOST_HAS_TRIVIAL_DESTRUCTOR(T) ::ndnboost::is_same< typename ::__type_traits<T>::has_trivial_destructor, ::__true_type>::value |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 63 | |
| 64 | # ifdef __sgi |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 65 | # define NDNBOOST_HAS_TYPE_TRAITS_INTRINSICS |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 66 | # endif |
| 67 | #endif |
| 68 | |
| 69 | #if defined(__MSL_CPP__) && (__MSL_CPP__ >= 0x8000) |
| 70 | // Metrowerks compiler is acquiring intrinsic type traits support |
| 71 | // post version 8. We hook into the published interface to pick up |
| 72 | // user defined specializations as well as compiler intrinsics as |
| 73 | // and when they become available: |
| 74 | # include <msl_utility> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 75 | # define NDNBOOST_IS_UNION(T) NDNBOOST_STD_EXTENSION_NAMESPACE::is_union<T>::value |
| 76 | # define NDNBOOST_IS_POD(T) NDNBOOST_STD_EXTENSION_NAMESPACE::is_POD<T>::value |
| 77 | # define NDNBOOST_HAS_TRIVIAL_CONSTRUCTOR(T) NDNBOOST_STD_EXTENSION_NAMESPACE::has_trivial_default_ctor<T>::value |
| 78 | # define NDNBOOST_HAS_TRIVIAL_COPY(T) NDNBOOST_STD_EXTENSION_NAMESPACE::has_trivial_copy_ctor<T>::value |
| 79 | # define NDNBOOST_HAS_TRIVIAL_ASSIGN(T) NDNBOOST_STD_EXTENSION_NAMESPACE::has_trivial_assignment<T>::value |
| 80 | # define NDNBOOST_HAS_TRIVIAL_DESTRUCTOR(T) NDNBOOST_STD_EXTENSION_NAMESPACE::has_trivial_dtor<T>::value |
| 81 | # define NDNBOOST_HAS_TYPE_TRAITS_INTRINSICS |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 82 | #endif |
| 83 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 84 | #if (defined(NDNBOOST_MSVC) && defined(NDNBOOST_MSVC_FULL_VER) && (NDNBOOST_MSVC_FULL_VER >=140050215))\ |
| 85 | || (defined(NDNBOOST_INTEL) && defined(_MSC_VER) && (_MSC_VER >= 1500)) |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 86 | # include <ndnboost/type_traits/is_same.hpp> |
| 87 | # include <ndnboost/type_traits/is_function.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 88 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 89 | # define NDNBOOST_IS_UNION(T) __is_union(T) |
| 90 | # define NDNBOOST_IS_POD(T) (__is_pod(T) && __has_trivial_constructor(T)) |
| 91 | # define NDNBOOST_IS_EMPTY(T) __is_empty(T) |
| 92 | # define NDNBOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) |
| 93 | # define NDNBOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T)|| ( ::ndnboost::is_pod<T>::value && !::ndnboost::is_volatile<T>::value)) |
| 94 | # define NDNBOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) || ( ::ndnboost::is_pod<T>::value && ! ::ndnboost::is_const<T>::value && !::ndnboost::is_volatile<T>::value)) |
| 95 | # define NDNBOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) || ::ndnboost::is_pod<T>::value) |
| 96 | # define NDNBOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) || ::ndnboost::has_trivial_constructor<T>::value) |
| 97 | # define NDNBOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) || ::ndnboost::has_trivial_copy<T>::value) |
| 98 | # define NDNBOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) || ::ndnboost::has_trivial_assign<T>::value) |
| 99 | # define NDNBOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 100 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 101 | # define NDNBOOST_IS_ABSTRACT(T) __is_abstract(T) |
| 102 | # define NDNBOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same<T,U>::value) |
| 103 | # define NDNBOOST_IS_CLASS(T) __is_class(T) |
| 104 | # define NDNBOOST_IS_CONVERTIBLE(T,U) ((__is_convertible_to(T,U) || (is_same<T,U>::value && !is_function<U>::value)) && !__is_abstract(U)) |
| 105 | # define NDNBOOST_IS_ENUM(T) __is_enum(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 106 | // This one doesn't quite always do the right thing: |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 107 | // # define NDNBOOST_IS_POLYMORPHIC(T) __is_polymorphic(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 108 | // This one fails if the default alignment has been changed with /Zp: |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 109 | // # define NDNBOOST_ALIGNMENT_OF(T) __alignof(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 110 | |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 111 | # if defined(_MSC_VER) && (_MSC_VER >= 1700) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 112 | # define NDNBOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) ((__has_trivial_move_constructor(T) || ::ndnboost::is_pod<T>::value) && !::ndnboost::is_volatile<T>::value) |
| 113 | # define NDNBOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) ((__has_trivial_move_assign(T) || ::ndnboost::is_pod<T>::value) && ! ::ndnboost::is_const<T>::value && !::ndnboost::is_volatile<T>::value) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 114 | # endif |
| 115 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 116 | # define NDNBOOST_HAS_TYPE_TRAITS_INTRINSICS |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 117 | #endif |
| 118 | |
| 119 | #if defined(__DMC__) && (__DMC__ >= 0x848) |
| 120 | // For Digital Mars C++, www.digitalmars.com |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 121 | # define NDNBOOST_IS_UNION(T) (__typeinfo(T) & 0x400) |
| 122 | # define NDNBOOST_IS_POD(T) (__typeinfo(T) & 0x800) |
| 123 | # define NDNBOOST_IS_EMPTY(T) (__typeinfo(T) & 0x1000) |
| 124 | # define NDNBOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__typeinfo(T) & 0x10) |
| 125 | # define NDNBOOST_HAS_TRIVIAL_COPY(T) (__typeinfo(T) & 0x20) |
| 126 | # define NDNBOOST_HAS_TRIVIAL_ASSIGN(T) (__typeinfo(T) & 0x40) |
| 127 | # define NDNBOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__typeinfo(T) & 0x8) |
| 128 | # define NDNBOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__typeinfo(T) & 0x80) |
| 129 | # define NDNBOOST_HAS_NOTHROW_COPY(T) (__typeinfo(T) & 0x100) |
| 130 | # define NDNBOOST_HAS_NOTHROW_ASSIGN(T) (__typeinfo(T) & 0x200) |
| 131 | # define NDNBOOST_HAS_VIRTUAL_DESTRUCTOR(T) (__typeinfo(T) & 0x4) |
| 132 | # define NDNBOOST_HAS_TYPE_TRAITS_INTRINSICS |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 133 | #endif |
| 134 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 135 | #if defined(NDNBOOST_CLANG) && defined(__has_feature) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 136 | # include <cstddef> |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 137 | # include <ndnboost/type_traits/is_same.hpp> |
| 138 | # include <ndnboost/type_traits/is_reference.hpp> |
| 139 | # include <ndnboost/type_traits/is_volatile.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 140 | |
| 141 | # if __has_feature(is_union) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 142 | # define NDNBOOST_IS_UNION(T) __is_union(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 143 | # endif |
| 144 | # if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && __has_feature(is_pod) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 145 | # define NDNBOOST_IS_POD(T) __is_pod(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 146 | # endif |
| 147 | # if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && __has_feature(is_empty) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 148 | # define NDNBOOST_IS_EMPTY(T) __is_empty(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 149 | # endif |
| 150 | # if __has_feature(has_trivial_constructor) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 151 | # define NDNBOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 152 | # endif |
| 153 | # if __has_feature(has_trivial_copy) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 154 | # define NDNBOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value && !is_volatile<T>::value) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 155 | # endif |
| 156 | # if __has_feature(has_trivial_assign) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 157 | # define NDNBOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 158 | # endif |
| 159 | # if __has_feature(has_trivial_destructor) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 160 | # define NDNBOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 161 | # endif |
| 162 | # if __has_feature(has_nothrow_constructor) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 163 | # define NDNBOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 164 | # endif |
| 165 | # if __has_feature(has_nothrow_copy) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 166 | # define NDNBOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile<T>::value && !is_reference<T>::value) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 167 | # endif |
| 168 | # if __has_feature(has_nothrow_assign) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 169 | # define NDNBOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 170 | # endif |
| 171 | # if __has_feature(has_virtual_destructor) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 172 | # define NDNBOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 173 | # endif |
| 174 | # if __has_feature(is_abstract) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 175 | # define NDNBOOST_IS_ABSTRACT(T) __is_abstract(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 176 | # endif |
| 177 | # if __has_feature(is_base_of) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 178 | # define NDNBOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same<T,U>::value) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 179 | # endif |
| 180 | # if __has_feature(is_class) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 181 | # define NDNBOOST_IS_CLASS(T) __is_class(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 182 | # endif |
| 183 | # if __has_feature(is_convertible_to) |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 184 | # include <ndnboost/type_traits/is_abstract.hpp> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 185 | # define NDNBOOST_IS_CONVERTIBLE(T,U) (__is_convertible_to(T,U) && !::ndnboost::is_abstract<U>::value) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 186 | # endif |
| 187 | # if __has_feature(is_enum) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 188 | # define NDNBOOST_IS_ENUM(T) __is_enum(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 189 | # endif |
| 190 | # if __has_feature(is_polymorphic) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 191 | # define NDNBOOST_IS_POLYMORPHIC(T) __is_polymorphic(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 192 | # endif |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 193 | # if __has_feature(has_trivial_move_constructor) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 194 | # define NDNBOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) __has_trivial_move_constructor(T) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 195 | # endif |
| 196 | # if __has_feature(has_trivial_move_assign) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 197 | # define NDNBOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) __has_trivial_move_assign(T) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 198 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 199 | # define NDNBOOST_ALIGNMENT_OF(T) __alignof(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 200 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 201 | # define NDNBOOST_HAS_TYPE_TRAITS_INTRINSICS |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 202 | #endif |
| 203 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 204 | #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) && !defined(__GCCXML__))) && !defined(NDNBOOST_CLANG) |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 205 | # include <ndnboost/type_traits/is_same.hpp> |
| 206 | # include <ndnboost/type_traits/is_reference.hpp> |
| 207 | # include <ndnboost/type_traits/is_volatile.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 208 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 209 | #ifdef NDNBOOST_INTEL |
| 210 | # define NDNBOOST_INTEL_TT_OPTS || is_pod<T>::value |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 211 | #else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 212 | # define NDNBOOST_INTEL_TT_OPTS |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 213 | #endif |
| 214 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 215 | # define NDNBOOST_IS_UNION(T) __is_union(T) |
| 216 | # define NDNBOOST_IS_POD(T) __is_pod(T) |
| 217 | # define NDNBOOST_IS_EMPTY(T) __is_empty(T) |
| 218 | # define NDNBOOST_HAS_TRIVIAL_CONSTRUCTOR(T) ((__has_trivial_constructor(T) NDNBOOST_INTEL_TT_OPTS) && ! ::ndnboost::is_volatile<T>::value) |
| 219 | # define NDNBOOST_HAS_TRIVIAL_COPY(T) ((__has_trivial_copy(T) NDNBOOST_INTEL_TT_OPTS) && !is_reference<T>::value && ! ::ndnboost::is_volatile<T>::value) |
| 220 | # define NDNBOOST_HAS_TRIVIAL_ASSIGN(T) ((__has_trivial_assign(T) NDNBOOST_INTEL_TT_OPTS) && ! ::ndnboost::is_volatile<T>::value && ! ::ndnboost::is_const<T>::value) |
| 221 | # define NDNBOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) NDNBOOST_INTEL_TT_OPTS) |
| 222 | # define NDNBOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) NDNBOOST_INTEL_TT_OPTS) |
| 223 | # define NDNBOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) NDNBOOST_INTEL_TT_OPTS) && !is_volatile<T>::value && !is_reference<T>::value) |
| 224 | # define NDNBOOST_HAS_NOTHROW_ASSIGN(T) ((__has_nothrow_assign(T) NDNBOOST_INTEL_TT_OPTS) && !is_volatile<T>::value && !is_const<T>::value) |
| 225 | # define NDNBOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 226 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 227 | # define NDNBOOST_IS_ABSTRACT(T) __is_abstract(T) |
| 228 | # define NDNBOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same<T,U>::value) |
| 229 | # define NDNBOOST_IS_CLASS(T) __is_class(T) |
| 230 | # define NDNBOOST_IS_ENUM(T) __is_enum(T) |
| 231 | # define NDNBOOST_IS_POLYMORPHIC(T) __is_polymorphic(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 232 | # if (!defined(unix) && !defined(__unix__)) || defined(__LP64__) |
| 233 | // GCC sometimes lies about alignment requirements |
| 234 | // of type double on 32-bit unix platforms, use the |
| 235 | // old implementation instead in that case: |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 236 | # define NDNBOOST_ALIGNMENT_OF(T) __alignof__(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 237 | # endif |
| 238 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 239 | # define NDNBOOST_HAS_TYPE_TRAITS_INTRINSICS |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 240 | #endif |
| 241 | |
| 242 | #if defined(__ghs__) && (__GHS_VERSION_NUMBER >= 600) |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 243 | # include <ndnboost/type_traits/is_same.hpp> |
| 244 | # include <ndnboost/type_traits/is_reference.hpp> |
| 245 | # include <ndnboost/type_traits/is_volatile.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 246 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 247 | # define NDNBOOST_IS_UNION(T) __is_union(T) |
| 248 | # define NDNBOOST_IS_POD(T) __is_pod(T) |
| 249 | # define NDNBOOST_IS_EMPTY(T) __is_empty(T) |
| 250 | # define NDNBOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) |
| 251 | # define NDNBOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value && !is_volatile<T>::value) |
| 252 | # define NDNBOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value) |
| 253 | # define NDNBOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) |
| 254 | # define NDNBOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T) |
| 255 | # define NDNBOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile<T>::value && !is_reference<T>::value) |
| 256 | # define NDNBOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value) |
| 257 | # define NDNBOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 258 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 259 | # define NDNBOOST_IS_ABSTRACT(T) __is_abstract(T) |
| 260 | # define NDNBOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same<T,U>::value) |
| 261 | # define NDNBOOST_IS_CLASS(T) __is_class(T) |
| 262 | # define NDNBOOST_IS_ENUM(T) __is_enum(T) |
| 263 | # define NDNBOOST_IS_POLYMORPHIC(T) __is_polymorphic(T) |
| 264 | # define NDNBOOST_ALIGNMENT_OF(T) __alignof__(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 265 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 266 | # define NDNBOOST_HAS_TYPE_TRAITS_INTRINSICS |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 267 | #endif |
| 268 | |
| 269 | # if defined(__CODEGEARC__) |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 270 | # include <ndnboost/type_traits/is_same.hpp> |
| 271 | # include <ndnboost/type_traits/is_reference.hpp> |
| 272 | # include <ndnboost/type_traits/is_volatile.hpp> |
| 273 | # include <ndnboost/type_traits/is_void.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 274 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 275 | # define NDNBOOST_IS_UNION(T) __is_union(T) |
| 276 | # define NDNBOOST_IS_POD(T) __is_pod(T) |
| 277 | # define NDNBOOST_IS_EMPTY(T) __is_empty(T) |
| 278 | # define NDNBOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__has_trivial_default_constructor(T)) |
| 279 | # define NDNBOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy_constructor(T) && !is_volatile<T>::value && !is_reference<T>::value) |
| 280 | # define NDNBOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value) |
| 281 | # define NDNBOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T)) |
| 282 | # define NDNBOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_default_constructor(T)) |
| 283 | # define NDNBOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy_constructor(T) && !is_volatile<T>::value && !is_reference<T>::value) |
| 284 | # define NDNBOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value) |
| 285 | # define NDNBOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 286 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 287 | # define NDNBOOST_IS_ABSTRACT(T) __is_abstract(T) |
| 288 | # define NDNBOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_void<T>::value && !is_void<U>::value) |
| 289 | # define NDNBOOST_IS_CLASS(T) __is_class(T) |
| 290 | # define NDNBOOST_IS_CONVERTIBLE(T,U) (__is_convertible(T,U) || is_void<U>::value) |
| 291 | # define NDNBOOST_IS_ENUM(T) __is_enum(T) |
| 292 | # define NDNBOOST_IS_POLYMORPHIC(T) __is_polymorphic(T) |
| 293 | # define NDNBOOST_ALIGNMENT_OF(T) alignof(T) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 294 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 295 | # define NDNBOOST_HAS_TYPE_TRAITS_INTRINSICS |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 296 | #endif |
| 297 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 298 | #endif // NDNBOOST_TT_INTRINSICS_HPP_INCLUDED |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 299 | |
| 300 | |
| 301 | |
| 302 | |
| 303 | |
| 304 | |
| 305 | |