diff --git a/octa/traits.h b/octa/traits.h index b927dc9..35efdb6 100644 --- a/octa/traits.h +++ b/octa/traits.h @@ -130,15 +130,31 @@ namespace octa { template struct IsClass: IntegralConstant {}; - /* is number */ + /* is function TODO */ - template struct IsNumber: IntegralConstant struct IsFunction: false_t {}; + + /* is arithmetic */ + + template struct IsArithmetic: IntegralConstant::value || IsFloatingPoint::value) > {}; + /* is fundamental */ + + template struct IsFundamental: IntegralConstant::value || IsVoid::value || IsNullPointer::value) + > {}; + + /* is compound */ + + template struct IsCompound: IntegralConstant::value + > {}; + /* is pointer to member */ - template struct IsMemberPointerBase: false_t {}; + template struct IsMemberPointerBase: false_t {}; template struct IsMemberPointerBase: true_t {}; @@ -147,10 +163,71 @@ namespace octa { typename RemoveConstVolatile::type > {}; - /* is POD: currently wrong */ + /* is reference */ - template struct IsPOD: IntegralConstant::value || IsFloatingPoint::value || IsPointer::value) + template struct IsReference: IntegralConstant::value || IsRvalueReference::value) + > {}; + + /* is object */ + + template struct IsObject: IntegralConstant::value && !IsVoid::value && !IsReference::value) + > {}; + + /* is scalar */ + + template struct IsScalar: IntegralConstant::value || IsPointer::value || IsEnum::value + || IsNullPointer ::value || IsArithmetic::value) + > {}; + + /* is abstract */ + + template + struct IsAbstract: IntegralConstant {}; + + /* is const */ + + template struct IsConst : false_t {}; + template struct IsConst: true_t {}; + + /* is volatile */ + + template struct IsVolatile : false_t {}; + template struct IsVolatile: true_t {}; + + /* is empty */ + + template struct IsEmpty: IntegralConstant {}; + + /* is literal type */ + + template + struct IsLiteralType: IntegralConstant {}; + + /* is POD */ + + template struct IsPOD: IntegralConstant {}; + + /* is polymorphic */ + + template + struct IsPolymorphic: IntegralConstant {}; + + /* is signed */ + + template struct IsSigned: IntegralConstant {}; + + /* is unsigned */ + + template struct IsUnsigned: IntegralConstant {}; + + /* is standard layout */ + + template struct RemoveAllExtents; + template struct IsStandardLayout: IntegralConstant::type>::value > {}; /* type equality */ @@ -158,12 +235,6 @@ namespace octa { template struct IsEqual : false_t {}; template struct IsEqual: true_t {}; - /* is reference */ - - template struct IsReference: IntegralConstant::value || IsRvalueReference::value) - > {}; - /* add lvalue reference */ template struct AddLvalueReference { typedef T &type; };