From 2c03469cf8e7eeddd0b622cda761cf2b97ec1150 Mon Sep 17 00:00:00 2001 From: q66 Date: Sat, 18 Apr 2015 16:09:08 +0100 Subject: [PATCH] more type traits --- octa/traits.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/octa/traits.h b/octa/traits.h index 99f2949..edc95b4 100644 --- a/octa/traits.h +++ b/octa/traits.h @@ -160,6 +160,42 @@ namespace octa { (IsLvalueReference::value || IsRvalueReference::value) > {}; + /* add lvalue reference */ + + template struct AddLvalueReference { typedef T &type; }; + template struct AddLvalueReference { typedef T &type; }; + template struct AddLvalueReference { typedef T &type; }; + template<> struct AddLvalueReference { + typedef void type; + }; + template<> struct AddLvalueReference { + typedef const void type; + }; + template<> struct AddLvalueReference { + typedef volatile void type; + }; + template<> struct AddLvalueReference { + typedef const volatile void type; + }; + + /* add rvalue reference */ + + template struct AddRvalueReference { typedef T &&type; }; + template struct AddRvalueReference { typedef T &&type; }; + template struct AddRvalueReference { typedef T &&type; }; + template<> struct AddRvalueReference { + typedef void type; + }; + template<> struct AddRvalueReference { + typedef const void type; + }; + template<> struct AddRvalueReference { + typedef volatile void type; + }; + template<> struct AddRvalueReference { + typedef const volatile void type; + }; + /* is array */ template struct IsArray : false_t {};