// The following are provided in this file:
//
// IsInteger<T>::value
- // IsPod<T>::value, see the definition for a note about its limitations
+ // IsPod<T>::value
// IsConvertibleToInteger<T>::value
//
// IsArray<T>::value
template<typename T> struct IsArithmetic { static const bool value = IsInteger<T>::value || IsFloatingPoint<T>::value; };
+ template<typename T> struct IsPointer {
+ static const bool value = false;
+ };
+
+ template<typename P> struct IsPointer<const P*> {
+ static const bool value = true;
+ };
+
+ template<typename P> struct IsPointer<P*> {
+ static const bool value = true;
+ };
+
+ template<typename T> struct IsEnum {
+ static const bool value = __is_enum(T);
+ };
+
+ template<typename T> struct IsScalar {
+ static const bool value = IsEnum<T>::value || IsArithmetic<T>::value || IsPointer<T>::value;
+ };
+
template<typename T> struct IsWeak { static const bool value = false; };
enum WeakHandlingFlag {
WeakHandlingInCollections
};
- // IsPod is misnamed as it doesn't cover all plain old data (pod) types.
- // Specifically, it doesn't allow for enums or for structs.
- template <typename T> struct IsPod { static const bool value = IsArithmetic<T>::value; };
- template <typename P> struct IsPod<P*> { static const bool value = true; };
+ template <typename T> struct IsPod {
+ static const bool value = __is_pod(T);
+ };
+
+ template <typename T> struct IsTriviallyCopyAssignable {
+ static const bool value = __has_trivial_assign(T);
+ };
+
+ template <typename T> struct IsTriviallyMoveAssignable {
+ static const bool value = __has_trivial_assign(T);
+ };
+
+ template <typename T> struct IsTriviallyDefaultConstructible {
+ static const bool value = __has_trivial_constructor(T);
+ };
+
+ template <typename T> struct IsTriviallyDestructible {
+ static const bool value = __has_trivial_destructor(T);
+ };
template<typename T> class IsConvertibleToInteger {
// Avoid "possible loss of data" warning when using Microsoft's C++ compiler
static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
};
- template <typename T, template<class V> class U> class IsSubclassOfTemplate {
+ template <typename T, template<typename... V> class U> class IsSubclassOfTemplate {
typedef char YesType;
struct NoType {
char padding[8];
};
- template<typename W> static YesType subclassCheck(U<W>*);
+ template<typename... W> static YesType subclassCheck(U<W...>*);
static NoType subclassCheck(...);
static T* t;
public:
static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
};
- template <typename T, template<class A, class B, class C> class U> class IsSubclassOfTemplate3 {
- typedef char YesType;
- struct NoType {
- char padding[8];
- };
-
- template<typename D, typename E, typename F> static YesType subclassCheck(U<D, E, F>*);
- static NoType subclassCheck(...);
- static T* t;
- public:
- static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
- };
-
- template <typename T, template<class A, class B, class C, class D, class E> class U> class IsSubclassOfTemplate5 {
- typedef char YesType;
- struct NoType {
- char padding[8];
- };
-
- template<typename F, typename G, typename H, typename I, typename J> static YesType subclassCheck(U<F, G, H, I, J>*);
- static NoType subclassCheck(...);
- static T* t;
- public:
- static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
- };
-
template <typename T, template <class V> class OuterTemplate> struct RemoveTemplate {
typedef T Type;
};