aboutsummaryrefslogtreecommitdiff
path: root/cutl/details/boost/type_traits/intrinsics.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'cutl/details/boost/type_traits/intrinsics.hpp')
-rw-r--r--cutl/details/boost/type_traits/intrinsics.hpp186
1 files changed, 112 insertions, 74 deletions
diff --git a/cutl/details/boost/type_traits/intrinsics.hpp b/cutl/details/boost/type_traits/intrinsics.hpp
index 950787f..7912320 100644
--- a/cutl/details/boost/type_traits/intrinsics.hpp
+++ b/cutl/details/boost/type_traits/intrinsics.hpp
@@ -1,4 +1,3 @@
-
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -22,10 +21,12 @@
// (these should largely ignore cv-qualifiers)
// 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_IS_EMPTY(T) should evaluate to true if T is an empty class type (and not a 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_MOVE_CONSTRUCTOR(T) should evaluate to true if T(cutl_details_boost::move(t)) <==> memcpy
// BOOST_HAS_TRIVIAL_ASSIGN(T) should evaluate to true if t = u <==> memcpy
+// BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) should evaluate to true if t = cutl_details_boost::move(u) <==> memcpy
// BOOST_HAS_TRIVIAL_DESTRUCTOR(T) should evaluate to true if ~T() has no effect
// BOOST_HAS_NOTHROW_CONSTRUCTOR(T) should evaluate to true if "T x;" can not throw
// BOOST_HAS_NOTHROW_COPY(T) should evaluate to true if T(t) can not throw
@@ -33,12 +34,10 @@
// BOOST_HAS_VIRTUAL_DESTRUCTOR(T) should evaluate to true T has a virtual destructor
//
// The following can also be defined: when detected our implementation is greatly simplified.
-// Note that unlike the macros above these do not have default definitions, so we can use
-// #ifdef MACRONAME to detect when these are available.
//
// BOOST_IS_ABSTRACT(T) true if T is an abstract type
// BOOST_IS_BASE_OF(T,U) true if T is a base class of U
-// BOOST_IS_CLASS(T) true if T is a class type
+// BOOST_IS_CLASS(T) true if T is a class type (and not a union)
// BOOST_IS_CONVERTIBLE(T,U) true if T is convertible to U
// BOOST_IS_ENUM(T) true is T is an enum
// BOOST_IS_POLYMORPHIC(T) true if T is a polymorphic type
@@ -82,32 +81,38 @@
# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
#endif
-#if defined(BOOST_MSVC) && defined(BOOST_MSVC_FULL_VER) && (BOOST_MSVC_FULL_VER >=140050215)
+#if (defined(BOOST_MSVC) && defined(BOOST_MSVC_FULL_VER) && (BOOST_MSVC_FULL_VER >=140050215))\
+ || (defined(BOOST_INTEL) && defined(_MSC_VER) && (_MSC_VER >= 1500))
# include <cutl/details/boost/type_traits/is_same.hpp>
+# include <cutl/details/boost/type_traits/is_function.hpp>
# define BOOST_IS_UNION(T) __is_union(T)
# define BOOST_IS_POD(T) (__is_pod(T) && __has_trivial_constructor(T))
# define BOOST_IS_EMPTY(T) __is_empty(T)
# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
-# define BOOST_HAS_TRIVIAL_COPY(T) __has_trivial_copy(T)
-# define BOOST_HAS_TRIVIAL_ASSIGN(T) __has_trivial_assign(T)
-# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
-# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T)
-# define BOOST_HAS_NOTHROW_COPY(T) __has_nothrow_copy(T)
-# define BOOST_HAS_NOTHROW_ASSIGN(T) __has_nothrow_assign(T)
+# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T)|| ( ::cutl_details_boost::is_pod<T>::value && !::cutl_details_boost::is_volatile<T>::value))
+# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) || ( ::cutl_details_boost::is_pod<T>::value && ! ::cutl_details_boost::is_const<T>::value && !::cutl_details_boost::is_volatile<T>::value))
+# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) || ::cutl_details_boost::is_pod<T>::value)
+# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) || ::cutl_details_boost::has_trivial_constructor<T>::value)
+# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) || ::cutl_details_boost::has_trivial_copy<T>::value)
+# define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) || ::cutl_details_boost::has_trivial_assign<T>::value)
# define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
# define BOOST_IS_ABSTRACT(T) __is_abstract(T)
# define BOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same<T,U>::value)
# define BOOST_IS_CLASS(T) __is_class(T)
-// This one doesn't quite always do the right thing:
-// # define BOOST_IS_CONVERTIBLE(T,U) __is_convertible_to(T,U)
+# define BOOST_IS_CONVERTIBLE(T,U) ((__is_convertible_to(T,U) || (is_same<T,U>::value && !is_function<U>::value)) && !__is_abstract(U))
# define BOOST_IS_ENUM(T) __is_enum(T)
// This one doesn't quite always do the right thing:
// # define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T)
// This one fails if the default alignment has been changed with /Zp:
// # define BOOST_ALIGNMENT_OF(T) __alignof(T)
+# if defined(_MSC_VER) && (_MSC_VER >= 1700)
+# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) ((__has_trivial_move_constructor(T) || ::cutl_details_boost::is_pod<T>::value) && !::cutl_details_boost::is_volatile<T>::value)
+# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) ((__has_trivial_move_assign(T) || ::cutl_details_boost::is_pod<T>::value) && ! ::cutl_details_boost::is_const<T>::value && !::cutl_details_boost::is_volatile<T>::value)
+# endif
+
# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
#endif
@@ -127,21 +132,96 @@
# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
#endif
-#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) && !defined(__GCCXML__)))
+#if defined(BOOST_CLANG) && defined(__has_feature)
+# include <cstddef>
# include <cutl/details/boost/type_traits/is_same.hpp>
# include <cutl/details/boost/type_traits/is_reference.hpp>
# include <cutl/details/boost/type_traits/is_volatile.hpp>
+# if __has_feature(is_union)
+# define BOOST_IS_UNION(T) __is_union(T)
+# endif
+# if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && __has_feature(is_pod)
+# define BOOST_IS_POD(T) __is_pod(T)
+# endif
+# if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && __has_feature(is_empty)
+# define BOOST_IS_EMPTY(T) __is_empty(T)
+# endif
+# if __has_feature(has_trivial_constructor)
+# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
+# endif
+# if __has_feature(has_trivial_copy)
+# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value && !is_volatile<T>::value)
+# endif
+# if __has_feature(has_trivial_assign)
+# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value)
+# endif
+# if __has_feature(has_trivial_destructor)
+# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
+# endif
+# if __has_feature(has_nothrow_constructor)
+# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T)
+# endif
+# if __has_feature(has_nothrow_copy)
+# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile<T>::value && !is_reference<T>::value)
+# endif
+# if __has_feature(has_nothrow_assign)
+# define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value)
+# endif
+# if __has_feature(has_virtual_destructor)
+# define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
+# endif
+# if __has_feature(is_abstract)
+# define BOOST_IS_ABSTRACT(T) __is_abstract(T)
+# endif
+# if __has_feature(is_base_of)
+# define BOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same<T,U>::value)
+# endif
+# if __has_feature(is_class)
+# define BOOST_IS_CLASS(T) __is_class(T)
+# endif
+# if __has_feature(is_convertible_to)
+# include <cutl/details/boost/type_traits/is_abstract.hpp>
+# define BOOST_IS_CONVERTIBLE(T,U) (__is_convertible_to(T,U) && !::cutl_details_boost::is_abstract<U>::value)
+# endif
+# if __has_feature(is_enum)
+# define BOOST_IS_ENUM(T) __is_enum(T)
+# endif
+# if __has_feature(is_polymorphic)
+# define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T)
+# endif
+# if __has_feature(has_trivial_move_constructor)
+# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) __has_trivial_move_constructor(T)
+# endif
+# if __has_feature(has_trivial_move_assign)
+# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) __has_trivial_move_assign(T)
+# endif
+# define BOOST_ALIGNMENT_OF(T) __alignof(T)
+
+# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
+#endif
+
+#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) && !defined(__GCCXML__))) && !defined(BOOST_CLANG)
+# include <cutl/details/boost/type_traits/is_same.hpp>
+# include <cutl/details/boost/type_traits/is_reference.hpp>
+# include <cutl/details/boost/type_traits/is_volatile.hpp>
+
+#ifdef BOOST_INTEL
+# define BOOST_INTEL_TT_OPTS || is_pod<T>::value
+#else
+# define BOOST_INTEL_TT_OPTS
+#endif
+
# define BOOST_IS_UNION(T) __is_union(T)
# define BOOST_IS_POD(T) __is_pod(T)
# define BOOST_IS_EMPTY(T) __is_empty(T)
-# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
-# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value)
-# define BOOST_HAS_TRIVIAL_ASSIGN(T) __has_trivial_assign(T)
-# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
-# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T)
-# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile<T>::value && !is_reference<T>::value)
-# define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value)
+# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) ((__has_trivial_constructor(T) BOOST_INTEL_TT_OPTS) && ! ::cutl_details_boost::is_volatile<T>::value)
+# define BOOST_HAS_TRIVIAL_COPY(T) ((__has_trivial_copy(T) BOOST_INTEL_TT_OPTS) && !is_reference<T>::value && ! ::cutl_details_boost::is_volatile<T>::value)
+# define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__has_trivial_assign(T) BOOST_INTEL_TT_OPTS) && ! ::cutl_details_boost::is_volatile<T>::value && ! ::cutl_details_boost::is_const<T>::value)
+# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) BOOST_INTEL_TT_OPTS)
+# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) BOOST_INTEL_TT_OPTS)
+# define BOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) BOOST_INTEL_TT_OPTS) && !is_volatile<T>::value && !is_reference<T>::value)
+# define BOOST_HAS_NOTHROW_ASSIGN(T) ((__has_nothrow_assign(T) BOOST_INTEL_TT_OPTS) && !is_volatile<T>::value && !is_const<T>::value)
# define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
# define BOOST_IS_ABSTRACT(T) __is_abstract(T)
@@ -168,8 +248,8 @@
# define BOOST_IS_POD(T) __is_pod(T)
# define BOOST_IS_EMPTY(T) __is_empty(T)
# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
-# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value)
-# define BOOST_HAS_TRIVIAL_ASSIGN(T) __has_trivial_assign(T)
+# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value && !is_volatile<T>::value)
+# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value)
# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T)
# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile<T>::value && !is_reference<T>::value)
@@ -195,13 +275,13 @@
# define BOOST_IS_UNION(T) __is_union(T)
# define BOOST_IS_POD(T) __is_pod(T)
# define BOOST_IS_EMPTY(T) __is_empty(T)
-# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__has_trivial_default_constructor(T) || is_void<T>::value)
-# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy_constructor(T) && !is_volatile<T>::value && !is_reference<T>::value || is_void<T>::value)
-# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value || is_void<T>::value)
-# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) || is_void<T>::value)
-# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_default_constructor(T) || is_void<T>::value)
-# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy_constructor(T) && !is_volatile<T>::value && !is_reference<T>::value || is_void<T>::value)
-# define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value || is_void<T>::value)
+# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__has_trivial_default_constructor(T))
+# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy_constructor(T) && !is_volatile<T>::value && !is_reference<T>::value)
+# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value)
+# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T))
+# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_default_constructor(T))
+# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy_constructor(T) && !is_volatile<T>::value && !is_reference<T>::value)
+# define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value)
# define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
# define BOOST_IS_ABSTRACT(T) __is_abstract(T)
@@ -215,51 +295,9 @@
# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
#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
-
-#ifndef BOOST_HAS_NOTHROW_CONSTRUCTOR
-# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) false
-#endif
-
-#ifndef BOOST_HAS_NOTHROW_COPY
-# define BOOST_HAS_NOTHROW_COPY(T) false
-#endif
-
-#ifndef BOOST_HAS_NOTHROW_ASSIGN
-# define BOOST_HAS_NOTHROW_ASSIGN(T) false
-#endif
+#endif // BOOST_TT_INTRINSICS_HPP_INCLUDED
-#ifndef BOOST_HAS_VIRTUAL_DESTRUCTOR
-# define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) false
-#endif
-#endif // BOOST_TT_INTRINSICS_HPP_INCLUDED