intrinsics.hpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  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. #ifndef BOOST_TT_INTRINSICS_HPP_INCLUDED
  8. #define BOOST_TT_INTRINSICS_HPP_INCLUDED
  9. #ifndef BOOST_TT_DISABLE_INTRINSICS
  10. #include <boost/config.hpp>
  11. #ifndef BOOST_TT_CONFIG_HPP_INCLUDED
  12. #include <boost/type_traits/detail/config.hpp>
  13. #endif
  14. //
  15. // Helper macros for builtin compiler support.
  16. // If your compiler has builtin support for any of the following
  17. // traits concepts, then redefine the appropriate macros to pick
  18. // up on the compiler support:
  19. //
  20. // (these should largely ignore cv-qualifiers)
  21. // BOOST_IS_UNION(T) should evaluate to true if T is a union type
  22. // BOOST_IS_POD(T) should evaluate to true if T is a POD type
  23. // BOOST_IS_EMPTY(T) should evaluate to true if T is an empty class type (and not a union)
  24. // BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) should evaluate to true if "T x;" has no effect
  25. // BOOST_HAS_TRIVIAL_COPY(T) should evaluate to true if T(t) <==> memcpy
  26. // BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) should evaluate to true if T(boost::move(t)) <==> memcpy
  27. // BOOST_HAS_TRIVIAL_ASSIGN(T) should evaluate to true if t = u <==> memcpy
  28. // BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) should evaluate to true if t = boost::move(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. // BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T) should evaluate to true if T has a non-throwing move constructor.
  35. // BOOST_IS_NOTHROW_MOVE_ASSIGN(T) should evaluate to true if T has a non-throwing move assignment operator.
  36. //
  37. // The following can also be defined: when detected our implementation is greatly simplified.
  38. //
  39. // BOOST_IS_ABSTRACT(T) true if T is an abstract type
  40. // BOOST_IS_BASE_OF(T,U) true if T is a base class of U
  41. // BOOST_IS_CLASS(T) true if T is a class type (and not a union)
  42. // BOOST_IS_CONVERTIBLE(T,U) true if T is convertible to U
  43. // BOOST_IS_ENUM(T) true is T is an enum
  44. // BOOST_IS_POLYMORPHIC(T) true if T is a polymorphic type
  45. // BOOST_ALIGNMENT_OF(T) should evaluate to the alignment requirements of type T.
  46. //
  47. // define BOOST_TT_DISABLE_INTRINSICS to prevent any intrinsics being used (mostly used when testing)
  48. //
  49. #ifdef BOOST_HAS_SGI_TYPE_TRAITS
  50. // Hook into SGI's __type_traits class, this will pick up user supplied
  51. // specializations as well as SGI - compiler supplied specializations.
  52. # include <boost/type_traits/is_same.hpp>
  53. # ifdef __NetBSD__
  54. // There are two different versions of type_traits.h on NetBSD on Spark
  55. // use an implicit include via algorithm instead, to make sure we get
  56. // the same version as the std lib:
  57. # include <algorithm>
  58. # else
  59. # include <type_traits.h>
  60. # endif
  61. # define BOOST_IS_POD(T) ::boost::is_same< typename ::__type_traits<T>::is_POD_type, ::__true_type>::value
  62. # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_default_constructor, ::__true_type>::value
  63. # define BOOST_HAS_TRIVIAL_COPY(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_copy_constructor, ::__true_type>::value
  64. # define BOOST_HAS_TRIVIAL_ASSIGN(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_assignment_operator, ::__true_type>::value
  65. # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_destructor, ::__true_type>::value
  66. # ifdef __sgi
  67. # define BOOST_HAS_TYPE_TRAITS_INTRINSICS
  68. # endif
  69. #endif
  70. #if defined(__MSL_CPP__) && (__MSL_CPP__ >= 0x8000)
  71. // Metrowerks compiler is acquiring intrinsic type traits support
  72. // post version 8. We hook into the published interface to pick up
  73. // user defined specializations as well as compiler intrinsics as
  74. // and when they become available:
  75. # include <msl_utility>
  76. # define BOOST_IS_UNION(T) BOOST_STD_EXTENSION_NAMESPACE::is_union<T>::value
  77. # define BOOST_IS_POD(T) BOOST_STD_EXTENSION_NAMESPACE::is_POD<T>::value
  78. # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_default_ctor<T>::value
  79. # define BOOST_HAS_TRIVIAL_COPY(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_copy_ctor<T>::value
  80. # define BOOST_HAS_TRIVIAL_ASSIGN(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_assignment<T>::value
  81. # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_dtor<T>::value
  82. # define BOOST_HAS_TYPE_TRAITS_INTRINSICS
  83. #endif
  84. #if (defined(BOOST_MSVC) && defined(BOOST_MSVC_FULL_VER) && (BOOST_MSVC_FULL_VER >=140050215))\
  85. || (defined(BOOST_INTEL) && defined(_MSC_VER) && (_MSC_VER >= 1500))
  86. //
  87. // Note that even though these intrinsics rely on other type traits classes
  88. // we do not #include those here as it produces cyclic dependencies and
  89. // can cause the intrinsics to not even be used at all!
  90. //
  91. # define BOOST_IS_UNION(T) __is_union(T)
  92. # define BOOST_IS_POD(T) (__is_pod(T) && __has_trivial_constructor(T))
  93. # define BOOST_IS_EMPTY(T) __is_empty(T)
  94. # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
  95. # define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) || ( ::boost::is_pod<T>::value && ! ::boost::is_const<T>::value && !::boost::is_volatile<T>::value))
  96. # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) || ::boost::is_pod<T>::value)
  97. # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) || ::boost::has_trivial_constructor<T>::value)
  98. #if !defined(BOOST_INTEL)
  99. # define BOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) || ::boost::has_trivial_copy<T>::value) && !is_array<T>::value)
  100. # define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) || ::boost::is_pod<T>::value)
  101. #elif (_MSC_VER >= 1900)
  102. # define BOOST_HAS_NOTHROW_COPY(T) ((__is_nothrow_constructible(T, typename add_lvalue_reference<typename add_const<T>::type>::type)) && !is_array<T>::value)
  103. # define BOOST_HAS_TRIVIAL_COPY(T) (__is_trivially_constructible(T, typename add_lvalue_reference<typename add_const<T>::type>::type))
  104. #endif
  105. # define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) || ::boost::has_trivial_assign<T>::value)
  106. # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
  107. # define BOOST_IS_ABSTRACT(T) __is_abstract(T)
  108. # define BOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same<T,U>::value)
  109. # define BOOST_IS_CLASS(T) __is_class(T)
  110. # define BOOST_IS_CONVERTIBLE(T,U) ((__is_convertible_to(T,U) || (is_same<T,U>::value && !is_function<U>::value)) && !__is_abstract(U))
  111. # define BOOST_IS_ENUM(T) __is_enum(T)
  112. // This one fails if the default alignment has been changed with /Zp:
  113. // # define BOOST_ALIGNMENT_OF(T) __alignof(T)
  114. # if defined(_MSC_VER) && (_MSC_VER >= 1800)
  115. # define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) ((__is_trivially_constructible(T, T&&) || boost::is_pod<T>::value) && ! ::boost::is_volatile<T>::value && ! ::boost::is_reference<T>::value)
  116. # define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) ((__is_trivially_assignable(T, T&&) || boost::is_pod<T>::value) && ! ::boost::is_const<T>::value && !::boost::is_volatile<T>::value && ! ::boost::is_reference<T>::value)
  117. # elif defined(_MSC_VER) && (_MSC_VER >= 1700)
  118. # define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) ((__has_trivial_move_constructor(T) || boost::is_pod<T>::value) && ! ::boost::is_volatile<T>::value && ! ::boost::is_reference<T>::value)
  119. # define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) ((__has_trivial_move_assign(T) || boost::is_pod<T>::value) && ! ::boost::is_const<T>::value && !::boost::is_volatile<T>::value && ! ::boost::is_reference<T>::value)
  120. # endif
  121. #ifndef BOOST_NO_CXX11_FINAL
  122. // This one doesn't quite always do the right thing on older VC++ versions
  123. // we really need it when the final keyword is supported though:
  124. # define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T)
  125. #endif
  126. #if _MSC_FULL_VER >= 180020827
  127. # define BOOST_IS_NOTHROW_MOVE_ASSIGN(T) (__is_nothrow_assignable(T&, T&&))
  128. # define BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T) (__is_nothrow_constructible(T, T&&))
  129. #endif
  130. #if _MSC_VER >= 1800
  131. # define BOOST_IS_FINAL(T) __is_final(T)
  132. #endif
  133. # define BOOST_HAS_TYPE_TRAITS_INTRINSICS
  134. #endif
  135. #if defined(__DMC__) && (__DMC__ >= 0x848)
  136. // For Digital Mars C++, www.digitalmars.com
  137. # define BOOST_IS_UNION(T) (__typeinfo(T) & 0x400)
  138. # define BOOST_IS_POD(T) (__typeinfo(T) & 0x800)
  139. # define BOOST_IS_EMPTY(T) (__typeinfo(T) & 0x1000)
  140. # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__typeinfo(T) & 0x10)
  141. # define BOOST_HAS_TRIVIAL_COPY(T) (__typeinfo(T) & 0x20)
  142. # define BOOST_HAS_TRIVIAL_ASSIGN(T) (__typeinfo(T) & 0x40)
  143. # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__typeinfo(T) & 0x8)
  144. # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__typeinfo(T) & 0x80)
  145. # define BOOST_HAS_NOTHROW_COPY(T) (__typeinfo(T) & 0x100)
  146. # define BOOST_HAS_NOTHROW_ASSIGN(T) (__typeinfo(T) & 0x200)
  147. # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) (__typeinfo(T) & 0x4)
  148. # define BOOST_HAS_TYPE_TRAITS_INTRINSICS
  149. #endif
  150. #if defined(BOOST_CLANG) && defined(__has_feature) && !defined(__CUDACC__)
  151. //
  152. // Note that these intrinsics are disabled for the CUDA meta-compiler as it appears
  153. // to not support them, even though the underlying clang compiler does so.
  154. // This is a rubbish fix as it basically stops type traits from working correctly,
  155. // but maybe the best we can do for now. See https://svn.boost.org/trac/boost/ticket/10694
  156. //
  157. //
  158. // Note that even though these intrinsics rely on other type traits classes
  159. // we do not #include those here as it produces cyclic dependencies and
  160. // can cause the intrinsics to not even be used at all!
  161. //
  162. # include <cstddef>
  163. # if __has_feature(is_union)
  164. # define BOOST_IS_UNION(T) __is_union(T)
  165. # endif
  166. # if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && __has_feature(is_pod)
  167. # define BOOST_IS_POD(T) __is_pod(T)
  168. # endif
  169. # if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && __has_feature(is_empty)
  170. # define BOOST_IS_EMPTY(T) __is_empty(T)
  171. # endif
  172. # if __has_feature(has_trivial_constructor)
  173. # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
  174. # endif
  175. # if __has_feature(has_trivial_copy)
  176. # define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value)
  177. # endif
  178. # if __has_feature(has_trivial_assign)
  179. # define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value && is_assignable<T&, const T&>::value)
  180. # endif
  181. # if __has_feature(has_trivial_destructor)
  182. # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) && is_destructible<T>::value)
  183. # endif
  184. # if __has_feature(has_nothrow_constructor)
  185. # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) && is_default_constructible<T>::value)
  186. # endif
  187. # if __has_feature(has_nothrow_copy)
  188. # define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile<T>::value && !is_reference<T>::value && is_copy_constructible<T>::value)
  189. # endif
  190. # if __has_feature(has_nothrow_assign)
  191. # define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value && is_assignable<T&, const T&>::value)
  192. # endif
  193. # if __has_feature(has_virtual_destructor)
  194. # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
  195. # endif
  196. # if __has_feature(is_abstract)
  197. # define BOOST_IS_ABSTRACT(T) __is_abstract(T)
  198. # endif
  199. # if __has_feature(is_base_of)
  200. # define BOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same<T,U>::value)
  201. # endif
  202. # if __has_feature(is_class)
  203. # define BOOST_IS_CLASS(T) __is_class(T)
  204. # endif
  205. # if __has_feature(is_convertible_to)
  206. # define BOOST_IS_CONVERTIBLE(T,U) __is_convertible_to(T,U)
  207. # endif
  208. # if __has_feature(is_enum)
  209. # define BOOST_IS_ENUM(T) __is_enum(T)
  210. # endif
  211. # if __has_feature(is_polymorphic)
  212. # define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T)
  213. # endif
  214. #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
  215. # if __has_extension(is_trivially_constructible)
  216. # define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__is_trivially_constructible(T, T&&) && is_constructible<T, T&&>::value && !::boost::is_volatile<T>::value)
  217. # endif
  218. # if __has_extension(is_trivially_assignable)
  219. # define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) (__is_trivially_assignable(T&, T&&) && is_assignable<T&, T&&>::value && !::boost::is_volatile<T>::value)
  220. # endif
  221. #endif
  222. # if (!defined(unix) && !defined(__unix__)) || defined(__LP64__) || !defined(__GNUC__)
  223. // GCC sometimes lies about alignment requirements
  224. // of type double on 32-bit unix platforms, use the
  225. // old implementation instead in that case:
  226. # define BOOST_ALIGNMENT_OF(T) __alignof(T)
  227. # endif
  228. # if __has_feature(is_final)
  229. # define BOOST_IS_FINAL(T) __is_final(T)
  230. # endif
  231. # define BOOST_HAS_TYPE_TRAITS_INTRINSICS
  232. #endif
  233. #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) && !defined(__GCCXML__))) && !defined(BOOST_CLANG)
  234. //
  235. // Note that even though these intrinsics rely on other type traits classes
  236. // we do not #include those here as it produces cyclic dependencies and
  237. // can cause the intrinsics to not even be used at all!
  238. //
  239. #ifdef BOOST_INTEL
  240. # define BOOST_INTEL_TT_OPTS || is_pod<T>::value
  241. #else
  242. # define BOOST_INTEL_TT_OPTS
  243. #endif
  244. # define BOOST_IS_UNION(T) __is_union(T)
  245. # define BOOST_IS_POD(T) __is_pod(T)
  246. # define BOOST_IS_EMPTY(T) __is_empty(T)
  247. # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) ((__has_trivial_constructor(T) BOOST_INTEL_TT_OPTS) && ! ::boost::is_volatile<T>::value)
  248. # define BOOST_HAS_TRIVIAL_COPY(T) ((__has_trivial_copy(T) BOOST_INTEL_TT_OPTS) && !is_reference<T>::value)
  249. #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409
  250. # define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__has_trivial_assign(T) BOOST_INTEL_TT_OPTS) && ! ::boost::is_volatile<T>::value && ! ::boost::is_const<T>::value && is_assignable<T&, const T&>::value)
  251. # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) BOOST_INTEL_TT_OPTS && is_destructible<T>::value)
  252. # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) && is_default_constructible<T>::value BOOST_INTEL_TT_OPTS)
  253. # define BOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) BOOST_INTEL_TT_OPTS) && !is_volatile<T>::value && !is_reference<T>::value && is_copy_constructible<T>::value)
  254. # define BOOST_HAS_NOTHROW_ASSIGN(T) ((__has_nothrow_assign(T) BOOST_INTEL_TT_OPTS) && !is_volatile<T>::value && !is_const<T>::value && is_assignable<T&, const T&>::value)
  255. #else
  256. # define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__has_trivial_assign(T) BOOST_INTEL_TT_OPTS) && ! ::boost::is_volatile<T>::value && ! ::boost::is_const<T>::value)
  257. # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) BOOST_INTEL_TT_OPTS)
  258. # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) BOOST_INTEL_TT_OPTS)
  259. #if ((__GNUC__ * 100 + __GNUC_MINOR__) != 407) && ((__GNUC__ * 100 + __GNUC_MINOR__) != 408)
  260. # define BOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) BOOST_INTEL_TT_OPTS) && !is_volatile<T>::value && !is_reference<T>::value && !is_array<T>::value)
  261. #endif
  262. # define BOOST_HAS_NOTHROW_ASSIGN(T) ((__has_nothrow_assign(T) BOOST_INTEL_TT_OPTS) && !is_volatile<T>::value && !is_const<T>::value && !is_array<T>::value)
  263. #endif
  264. # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
  265. # define BOOST_IS_ABSTRACT(T) __is_abstract(T)
  266. # define BOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same<T,U>::value)
  267. # define BOOST_IS_CLASS(T) __is_class(T)
  268. # define BOOST_IS_ENUM(T) __is_enum(T)
  269. # define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T)
  270. # if (!defined(unix) && !defined(__unix__) && \
  271. !(defined(__VXWORKS__) && defined(__i386__))) || defined(__LP64__)
  272. // GCC sometimes lies about alignment requirements
  273. // of type double on 32-bit unix platforms, use the
  274. // old implementation instead in that case:
  275. # define BOOST_ALIGNMENT_OF(T) __alignof__(T)
  276. # endif
  277. # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))
  278. # define BOOST_IS_FINAL(T) __is_final(T)
  279. # endif
  280. # if (__GNUC__ >= 5) && (__cplusplus >= 201103)
  281. # define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) (__is_trivially_assignable(T&, T&&) && is_assignable<T&, T&&>::value && !::boost::is_volatile<T>::value)
  282. # define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__is_trivially_constructible(T, T&&) && is_constructible<T, T&&>::value && !::boost::is_volatile<T>::value)
  283. # endif
  284. # define BOOST_HAS_TYPE_TRAITS_INTRINSICS
  285. #endif
  286. #if defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130)
  287. # define BOOST_IS_UNION(T) __oracle_is_union(T)
  288. # define BOOST_IS_POD(T) (__oracle_is_pod(T) && !is_function<T>::value)
  289. # define BOOST_IS_EMPTY(T) __oracle_is_empty(T)
  290. # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__oracle_has_trivial_constructor(T) && ! ::boost::is_volatile<T>::value)
  291. # define BOOST_HAS_TRIVIAL_COPY(T) (__oracle_has_trivial_copy(T) && !is_reference<T>::value)
  292. # define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && ! ::boost::is_volatile<T>::value && ! ::boost::is_const<T>::value && is_assignable<T&, const T&>::value)
  293. # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__oracle_has_trivial_destructor(T) && is_destructible<T>::value)
  294. # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) ((__oracle_has_nothrow_constructor(T) || __oracle_has_trivial_constructor(T) || __oracle_is_trivial(T)) && is_default_constructible<T>::value)
  295. // __oracle_has_nothrow_copy appears to behave the same as __oracle_has_nothrow_assign, disabled for now:
  296. //# define BOOST_HAS_NOTHROW_COPY(T) ((__oracle_has_nothrow_copy(T) || __oracle_has_trivial_copy(T) || __oracle_is_trivial(T)) && !is_volatile<T>::value && !is_reference<T>::value && is_copy_constructible<T>::value)
  297. # define BOOST_HAS_NOTHROW_ASSIGN(T) ((__oracle_has_nothrow_assign(T) || __oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && !is_volatile<T>::value && !is_const<T>::value && is_assignable<T&, const T&>::value)
  298. # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __oracle_has_virtual_destructor(T)
  299. # define BOOST_IS_ABSTRACT(T) __oracle_is_abstract(T)
  300. //# define BOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same<T,U>::value)
  301. # define BOOST_IS_CLASS(T) __oracle_is_class(T)
  302. # define BOOST_IS_ENUM(T) __oracle_is_enum(T)
  303. # define BOOST_IS_POLYMORPHIC(T) __oracle_is_polymorphic(T)
  304. # define BOOST_ALIGNMENT_OF(T) __alignof__(T)
  305. # define BOOST_IS_FINAL(T) __oracle_is_final(T)
  306. # define BOOST_HAS_TYPE_TRAITS_INTRINSICS
  307. #endif
  308. #if defined(__ghs__) && (__GHS_VERSION_NUMBER >= 600)
  309. # include <boost/type_traits/is_same.hpp>
  310. # include <boost/type_traits/is_reference.hpp>
  311. # include <boost/type_traits/is_volatile.hpp>
  312. # define BOOST_IS_UNION(T) __is_union(T)
  313. # define BOOST_IS_POD(T) __is_pod(T)
  314. # define BOOST_IS_EMPTY(T) __is_empty(T)
  315. # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
  316. # define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value)
  317. # define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value)
  318. # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
  319. # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T)
  320. # define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile<T>::value && !is_reference<T>::value)
  321. # define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value)
  322. # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
  323. # define BOOST_IS_ABSTRACT(T) __is_abstract(T)
  324. # define BOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same<T,U>::value)
  325. # define BOOST_IS_CLASS(T) __is_class(T)
  326. # define BOOST_IS_ENUM(T) __is_enum(T)
  327. # define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T)
  328. # define BOOST_ALIGNMENT_OF(T) __alignof__(T)
  329. # define BOOST_HAS_TYPE_TRAITS_INTRINSICS
  330. #endif
  331. # if defined(__CODEGEARC__)
  332. # include <boost/type_traits/is_same.hpp>
  333. # include <boost/type_traits/is_reference.hpp>
  334. # include <boost/type_traits/is_volatile.hpp>
  335. # include <boost/type_traits/is_void.hpp>
  336. # define BOOST_IS_UNION(T) __is_union(T)
  337. # define BOOST_IS_POD(T) __is_pod(T)
  338. # define BOOST_IS_EMPTY(T) __is_empty(T)
  339. # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__has_trivial_default_constructor(T))
  340. # define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy_constructor(T) && !is_reference<T>::value)
  341. # define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value)
  342. # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T))
  343. # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_default_constructor(T))
  344. # define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy_constructor(T) && !is_volatile<T>::value && !is_reference<T>::value)
  345. # define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value)
  346. # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
  347. # define BOOST_IS_ABSTRACT(T) __is_abstract(T)
  348. # define BOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_void<T>::value && !is_void<U>::value)
  349. # define BOOST_IS_CLASS(T) __is_class(T)
  350. # define BOOST_IS_CONVERTIBLE(T,U) (__is_convertible(T,U) || is_void<U>::value)
  351. # define BOOST_IS_ENUM(T) __is_enum(T)
  352. # define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T)
  353. # define BOOST_ALIGNMENT_OF(T) alignof(T)
  354. # define BOOST_HAS_TYPE_TRAITS_INTRINSICS
  355. #endif
  356. #endif // BOOST_TT_DISABLE_INTRINSICS
  357. #endif // BOOST_TT_INTRINSICS_HPP_INCLUDED