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
This commit is contained in:
parent
41536265e8
commit
205770826b
2 changed files with 23 additions and 2 deletions
|
@ -87,6 +87,22 @@ namespace Loki
|
|||
{
|
||||
typedef NullType Result;
|
||||
};
|
||||
|
||||
template <class U> struct AddConstReference
|
||||
{
|
||||
typedef const U & Result;
|
||||
};
|
||||
|
||||
template <class U> struct AddConstReference<U &>
|
||||
{
|
||||
typedef const U & Result;
|
||||
};
|
||||
|
||||
template <> struct AddConstReference<void>
|
||||
{
|
||||
typedef NullType Result;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -232,9 +248,13 @@ namespace Loki
|
|||
enum { isArith = isIntegral || isFloat };
|
||||
enum { isFundamental = isStdFundamental || isArith || isFloat };
|
||||
|
||||
typedef typename Select<isStdArith || isPointer || isMemberPointer,T,
|
||||
typedef typename Select<isStdArith || isPointer || isMemberPointer, T,
|
||||
typename Private::AddReference<T>::Result>::Result
|
||||
ParameterType;
|
||||
|
||||
typedef typename Select<isStdArith || isPointer || isMemberPointer, T,
|
||||
typename Private::AddConstReference<T>::Result>::Result
|
||||
ConstParameterType;
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -104,7 +104,8 @@ public:
|
|||
SameType<TypeTraits<char>::ParameterType,char>::value &&
|
||||
SameType<TypeTraits<int>::ParameterType,int>::value &&
|
||||
SameType<TypeTraits<double>::ParameterType,double>::value &&
|
||||
SameType<TypeTraits<Test>::ParameterType,Test &>::value;
|
||||
SameType<TypeTraits<Test>::ParameterType,Test &>::value &&
|
||||
SameType<TypeTraits<Test>::ConstParameterType,const Test &>::value;
|
||||
|
||||
testAssert("TypeTraits",r,result);
|
||||
|
||||
|
|
Loading…
Reference in a new issue