14 #ifndef WPIUTIL_WPI_TYPE_TRAITS_H
15 #define WPIUTIL_WPI_TYPE_TRAITS_H
17 #include "wpi/Compiler.h"
18 #include <type_traits>
22 #define WPI_DEFINED_HAS_FEATURE
23 #define __has_feature(x) 0
34 #if (__has_feature(is_trivially_copyable) && defined(_LIBCPP_VERSION)) || \
35 (defined(__GNUC__) && __GNUC__ >= 5)
38 static const bool value = std::is_trivially_copyable<T>::value;
39 #elif __has_feature(is_trivially_copyable)
43 static const bool value = __is_trivially_copyable(T);
47 static const bool value = !std::is_class<T>::value;
52 template<
typename T,
typename U>
65 using UnderlyingT =
typename std::remove_reference<T>::type;
68 static const bool value =
69 !std::is_class<UnderlyingT>::value &&
70 !std::is_pointer<UnderlyingT>::value &&
71 !std::is_floating_point<UnderlyingT>::value &&
72 (std::is_enum<UnderlyingT>::value ||
73 std::is_convertible<UnderlyingT, unsigned long long>::value);
77 template<
typename T,
typename Enable =
void>
82 T, typename
std::enable_if<std::is_pointer<T>::value>::type> {
88 template<
typename T,
typename Enable =
void>
93 T, typename
std::enable_if<std::is_pointer<T>::value>::type> {
94 using type =
const typename std::remove_pointer<T>::type *;
97 template <
typename T,
typename Enable =
void>
99 using type =
const T &;
101 template <
typename T>
103 T, typename
std::enable_if<std::is_pointer<T>::value>::type> {
104 using type =
typename add_const_past_pointer<T>::type;
112 #ifndef LLVM_IS_FINAL
113 #if __cplusplus >= 201402L || defined(_MSC_VER)
114 #define LLVM_IS_FINAL(Ty) std::is_final<Ty>()
115 #elif __has_feature(is_final) || LLVM_GNUC_PREREQ(4, 7, 0)
116 #define LLVM_IS_FINAL(Ty) __is_final(Ty)
120 #ifdef WPI_DEFINED_HAS_FEATURE
122 #undef WPI_DEFINED_HAS_FEATURE
125 #endif // LLVM_SUPPORT_TYPE_TRAITS_H
Definition: SmallVector.h:946
WPILib C++ utilities (wpiutil) namespace.
Definition: SmallString.h:21
isPodLike - This is a type trait that is used to determine whether a given type can be copied around ...
Definition: ArrayRef.h:530
Metafunction that determines whether the given type is either an integral type or an enumeration type...
Definition: type_traits.h:64
Definition: type_traits.h:98
If T is a pointer to X, return a pointer to const X.
Definition: type_traits.h:89
If T is a pointer, just return it. If it is not, return T&.
Definition: type_traits.h:78