diff --git a/octa/traits.h b/octa/traits.h index 2332766..b194016 100644 --- a/octa/traits.h +++ b/octa/traits.h @@ -21,8 +21,6 @@ namespace octa { /* removers */ - template using RemoveReference = internal::RemoveReference; - template struct RemoveConst { typedef T type; }; template struct RemoveConst { typedef T type; }; @@ -181,6 +179,10 @@ namespace octa { !IsFundamental::value > {}; + /* is pointer to member function */ + + template struct IsMemberFunctionPointer: true_t {}; + /* is pointer to member */ template struct IsMemberPointerBase: false_t {}; @@ -192,6 +194,12 @@ namespace octa { typename RemoveConstVolatile::type > {}; + /* is pointer to member object */ + + template struct IsMemberObjectPointer: IntegralConstant::value && !IsMemberFunctionPointer::value) + > {}; + /* is reference */ template struct IsReference: IntegralConstant struct IsEmpty: IntegralConstant {}; - /* is literal type */ - - template - struct IsLiteralType: IntegralConstant {}; - /* is POD */ template struct IsPOD: IntegralConstant {}; @@ -259,6 +262,14 @@ namespace octa { IsScalar::type>::value > {}; + /* is literal type */ + + template + struct IsLiteralType: IntegralConstant::type>::value + || IsStandardLayout::value + > {}; + /* is base of */ template @@ -296,6 +307,24 @@ namespace octa { template struct Rank: IntegralConstant::value + 1> {}; + /* remove reference */ + + template using RemoveReference = internal::RemoveReference; + + /* remove pointer */ + + template struct RemovePointer { typedef T type; }; + template struct RemovePointer { typedef T type; }; + template struct RemovePointer { typedef T type; }; + template struct RemovePointer { typedef T type; }; + template struct RemovePointer { typedef T type; }; + + /* add pointer */ + + template struct AddPointer { + typedef typename RemoveReference::type *type; + }; + /* add lvalue reference */ template struct AddLvalueReference { typedef T &type; }; @@ -396,7 +425,6 @@ namespace octa { /* decay */ -#if 0 template struct Decay { private: @@ -410,7 +438,6 @@ namespace octa { >::type >::type type; }; -#endif } #endif \ No newline at end of file diff --git a/octa/utility.h b/octa/utility.h index 494e647..a6517b7 100644 --- a/octa/utility.h +++ b/octa/utility.h @@ -11,9 +11,9 @@ namespace octa { /* aliased in traits.h later */ namespace internal { - template struct RemoveReference { typedef T type; }; - template struct RemoveReference { typedef T type; }; - template struct RemoveReference { typedef T type; }; + template struct RemoveReference { typedef T type; }; + template struct RemoveReference { typedef T type; }; + template struct RemoveReference { typedef T type; }; template struct AddRvalueReference { typedef T &&type; }; template struct AddRvalueReference { typedef T &&type; };