From 205770826b9dbcbbe0d9cdefb1f9fe2bd348cdba Mon Sep 17 00:00:00 2001 From: syntheticpp Date: Fri, 26 Aug 2005 15:07:24 +0000 Subject: [PATCH] fix bug: [ 669669 ] TypeTraits::ParameterType for non-primitive types git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@209 7ec92016-0320-0410-acc4-a06ded1c099a --- include/loki/TypeTraits.h | 22 +++++++++++++++++++++- tools/RegressionTest/TypeTraitsTest.h | 3 ++- 2 files changed, 23 insertions(+), 2 deletions(-) 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);