All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SizeTrait.h
Go to the documentation of this file.
1 //=================================================================================================
20 //=================================================================================================
21 
22 #ifndef _BLAZE_UTIL_SIZETRAIT_H_
23 #define _BLAZE_UTIL_SIZETRAIT_H_
24 
25 
26 namespace blaze {
27 
28 //=================================================================================================
29 //
30 // SIZETRAITHELPER CLASS DEFINITION
31 //
32 //=================================================================================================
33 
34 //*************************************************************************************************
39 template< typename T1, typename T2, bool >
40 struct SizeTraitHelper
41 {
42  //**Type definitions****************************************************************************
43  typedef T1 Large;
44  typedef T2 Small;
45  //**********************************************************************************************
46 };
48 //*************************************************************************************************
49 
50 
51 //*************************************************************************************************
56 template< typename T1, typename T2 >
57 struct SizeTraitHelper<T1,T2,true>
58 {
59  //**Type definitions****************************************************************************
60  typedef T2 Large;
61  typedef T1 Small;
62  //**********************************************************************************************
63 };
65 //*************************************************************************************************
66 
67 
68 
69 
70 //=================================================================================================
71 //
72 // SIZETRAIT CLASS DEFINITION
73 //
74 //=================================================================================================
75 
76 //*************************************************************************************************
86 template< typename T1, typename T2 >
87 struct SizeTrait
88 {
89  private:
90  //**Type definitions****************************************************************************
92 
93  typedef SizeTraitHelper<T1,T2,( sizeof(T2) > sizeof(T1) )> Helper;
95  //**********************************************************************************************
96 
97  public:
98  //**Type definitions****************************************************************************
100  typedef typename Helper::Large Large;
101  typedef typename Helper::Small Small;
102 
103  //**********************************************************************************************
104 };
105 //*************************************************************************************************
106 
107 } // namespace blaze
108 
109 #endif