I have some problems about promotion traits
template<typename T1, typename T2>
class Promotion;
template<bool C, typename Ta, typename Tb>
class IfThenElse;
template<typename Ta, typename Tb>
class IfThenElse<true, Ta, Tb>
{
public :
typedef Ta ResultT;
};
template<typename Ta, typename Tb>
class IfThenElse<false, Ta, Tb>
{
public :
typedef Tb ResultT;
};
template<typename T1, typename T2>
class Promotion
{
public :
typedef typename IfThenElse< (sizeof(T1) > sizeof(T2)),
T1,
typename IfThenElse<(sizeof(T1) < sizeof(T2)),
T2,
void>::ResultT>::ResultT ResultT;
};
Why did they make the code of promotion looks like this
typename IfThenElse<(sizeof(T1) < sizeof(T2)),
T2,
void>::ResultT
but not
template<typename T1, typename T2>
class Promotion
{
public :
typedef typename IfThenElse< (sizeof(T1) > sizeof(T2)), T1, T2>::ResultT ResultT;
};
Thanks a lot