diff --git a/include/loki/TypeTraits.h b/include/loki/TypeTraits.h index 9917c05..939aa50 100644 --- a/include/loki/TypeTraits.h +++ b/include/loki/TypeTraits.h @@ -87,6 +87,22 @@ namespace Loki { typedef NullType Result; }; + + template struct AddConstReference + { + typedef const U & Result; + }; + + template struct AddConstReference + { + typedef const U & Result; + }; + + template <> struct AddConstReference + { + typedef NullType Result; + }; + } //////////////////////////////////////////////////////////////////////////////// @@ -232,9 +248,13 @@ namespace Loki enum { isArith = isIntegral || isFloat }; enum { isFundamental = isStdFundamental || isArith || isFloat }; - typedef typename Select::Result>::Result ParameterType; + + typedef typename Select::Result>::Result + ConstParameterType; }; } diff --git a/tools/RegressionTest/TypeTraitsTest.h b/tools/RegressionTest/TypeTraitsTest.h index 446bbd5..78e463f 100644 --- a/tools/RegressionTest/TypeTraitsTest.h +++ b/tools/RegressionTest/TypeTraitsTest.h @@ -104,7 +104,8 @@ public: SameType::ParameterType,char>::value && SameType::ParameterType,int>::value && SameType::ParameterType,double>::value && - SameType::ParameterType,Test &>::value; + SameType::ParameterType,Test &>::value && + SameType::ConstParameterType,const Test &>::value; testAssert("TypeTraits",r,result);