Rheolef  7.1
an efficient C++ finite element environment
promote.h
Go to the documentation of this file.
1 #ifndef _RHEOLEF_PROMOTE_H
2 #define _RHEOLEF_PROMOTE_H
23 #include "rheolef/compiler.h"
24 namespace rheolef {
25 template<class T1, class T2>
27 
28 template<class T1, class T2>
29 struct promote {
31 };
32 #define skit_promote(T1,T2) typename promote<T1,T2>::type
33 
34 template <> struct promote<char, char > { typedef int type; };
35 template <> struct promote<char, unsigned char > { typedef int type; };
36 template <> struct promote<char, short int > { typedef int type; };
37 template <> struct promote<char, short unsigned int > { typedef unsigned int type; };
38 template <> struct promote<char, int > { typedef int type; };
39 template <> struct promote<char, unsigned int > { typedef unsigned int type; };
40 template <> struct promote<char, long > { typedef long type; };
41 template <> struct promote<char, unsigned long > { typedef unsigned long type; };
42 template <> struct promote<char, float > { typedef float type; };
43 template <> struct promote<char, double > { typedef double type; };
44 template <> struct promote<char, long double > { typedef long double type; };
45 template <> struct promote<unsigned char, char > { typedef int type; };
46 template <> struct promote<unsigned char, unsigned char > { typedef int type; };
47 template <> struct promote<unsigned char, short int > { typedef int type; };
48 template <> struct promote<unsigned char, short unsigned int > { typedef unsigned int type; };
49 template <> struct promote<unsigned char, int > { typedef int type; };
50 template <> struct promote<unsigned char, unsigned int > { typedef unsigned int type; };
51 template <> struct promote<unsigned char, long > { typedef long type; };
52 template <> struct promote<unsigned char, unsigned long > { typedef unsigned long type; };
53 template <> struct promote<unsigned char, float > { typedef float type; };
54 template <> struct promote<unsigned char, double > { typedef double type; };
55 template <> struct promote<unsigned char, long double > { typedef long double type; };
56 template <> struct promote<short int, char > { typedef int type; };
57 template <> struct promote<short int, unsigned char > { typedef int type; };
58 template <> struct promote<short int, short int > { typedef int type; };
59 template <> struct promote<short int, short unsigned int > { typedef unsigned int type; };
60 template <> struct promote<short int, int > { typedef int type; };
61 template <> struct promote<short int, unsigned int > { typedef unsigned int type; };
62 template <> struct promote<short int, long > { typedef long type; };
63 template <> struct promote<short int, unsigned long > { typedef unsigned long type; };
64 template <> struct promote<short int, float > { typedef float type; };
65 template <> struct promote<short int, double > { typedef double type; };
66 template <> struct promote<short unsigned int, char > { typedef unsigned int type; };
67 template <> struct promote<short unsigned int, unsigned char > { typedef unsigned int type; };
68 template <> struct promote<short unsigned int, short int > { typedef unsigned int type; };
69 template <> struct promote<short unsigned int, short unsigned int > { typedef unsigned int type; };
70 template <> struct promote<short unsigned int, int > { typedef unsigned int type; };
71 template <> struct promote<short unsigned int, unsigned int > { typedef unsigned int type; };
72 template <> struct promote<short unsigned int, long > { typedef long type; };
73 template <> struct promote<short unsigned int, unsigned long > { typedef unsigned long type; };
74 template <> struct promote<short unsigned int, float > { typedef float type; };
75 template <> struct promote<short unsigned int, double > { typedef double type; };
76 template <> struct promote<short unsigned int, long double > { typedef long double type; };
77 template <> struct promote<int, char > { typedef int type; };
78 template <> struct promote<int, unsigned char > { typedef int type; };
79 template <> struct promote<int, short int > { typedef int type; };
80 template <> struct promote<int, short unsigned int > { typedef unsigned int type; };
81 template <> struct promote<int, int > { typedef int type; };
82 template <> struct promote<int, unsigned int > { typedef unsigned int type; };
83 template <> struct promote<int, long > { typedef long type; };
84 template <> struct promote<int, unsigned long > { typedef unsigned long type; };
85 template <> struct promote<int, float > { typedef float type; };
86 template <> struct promote<int, double > { typedef double type; };
87 template <> struct promote<int, long double > { typedef long double type; };
88 template <> struct promote<unsigned int, char > { typedef unsigned int type; };
89 template <> struct promote<unsigned int, unsigned char > { typedef unsigned int type; };
90 template <> struct promote<unsigned int, short int > { typedef unsigned int type; };
91 template <> struct promote<unsigned int, short unsigned int > { typedef unsigned int type; };
92 template <> struct promote<unsigned int, int > { typedef unsigned int type; };
93 template <> struct promote<unsigned int, unsigned int > { typedef unsigned int type; };
94 template <> struct promote<unsigned int, long > { typedef long type; };
95 template <> struct promote<unsigned int, unsigned long > { typedef unsigned long type; };
96 template <> struct promote<unsigned int, float > { typedef float type; };
97 template <> struct promote<unsigned int, double > { typedef double type; };
98 template <> struct promote<unsigned int, long double > { typedef long double type; };
99 template <> struct promote<long, char > { typedef long type; };
100 template <> struct promote<long, unsigned char > { typedef long type; };
101 template <> struct promote<long, short int > { typedef long type; };
102 template <> struct promote<long, short unsigned int > { typedef long type; };
103 template <> struct promote<long, int > { typedef long type; };
104 template <> struct promote<long, unsigned int > { typedef long type; };
105 template <> struct promote<long, long > { typedef long type; };
106 template <> struct promote<long, unsigned long > { typedef unsigned long type; };
107 template <> struct promote<long, float > { typedef float type; };
108 template <> struct promote<long, double > { typedef double type; };
109 template <> struct promote<long, long double > { typedef long double type; };
110 template <> struct promote<unsigned long, char > { typedef unsigned long type; };
111 template <> struct promote<unsigned long, unsigned char > { typedef unsigned long type; };
112 template <> struct promote<unsigned long, short int > { typedef unsigned long type; };
113 template <> struct promote<unsigned long, short unsigned int > { typedef unsigned long type; };
114 template <> struct promote<unsigned long, int > { typedef unsigned long type; };
115 template <> struct promote<unsigned long, unsigned int > { typedef unsigned long type; };
116 template <> struct promote<unsigned long, long > { typedef unsigned long type; };
117 template <> struct promote<unsigned long, unsigned long > { typedef unsigned long type; };
118 template <> struct promote<unsigned long, float > { typedef float type; };
119 template <> struct promote<unsigned long, double > { typedef double type; };
120 template <> struct promote<unsigned long, long double > { typedef long double type; };
121 template <> struct promote<float, char > { typedef float type; };
122 template <> struct promote<float, unsigned char > { typedef float type; };
123 template <> struct promote<float, short int > { typedef float type; };
124 template <> struct promote<float, short unsigned int > { typedef float type; };
125 template <> struct promote<float, int > { typedef float type; };
126 template <> struct promote<float, unsigned int > { typedef float type; };
127 template <> struct promote<float, long > { typedef float type; };
128 template <> struct promote<float, unsigned long > { typedef float type; };
129 template <> struct promote<float, float > { typedef float type; };
130 template <> struct promote<float, double > { typedef double type; };
131 template <> struct promote<float, long double > { typedef long double type; };
132 template <> struct promote<double, char > { typedef double type; };
133 template <> struct promote<double, unsigned char > { typedef double type; };
134 template <> struct promote<double, short int > { typedef double type; };
135 template <> struct promote<double, short unsigned int > { typedef double type; };
136 template <> struct promote<double, int > { typedef double type; };
137 template <> struct promote<double, unsigned int > { typedef double type; };
138 template <> struct promote<double, long > { typedef double type; };
139 template <> struct promote<double, unsigned long > { typedef double type; };
140 template <> struct promote<double, float > { typedef double type; };
141 template <> struct promote<double, double > { typedef double type; };
142 template <> struct promote<double, long double > { typedef long double type; };
143 template <> struct promote<long double, char > { typedef long double type; };
144 template <> struct promote<long double, unsigned char > { typedef long double type; };
145 template <> struct promote<long double, short int > { typedef long double type; };
146 template <> struct promote<long double, short unsigned int > { typedef long double type; };
147 template <> struct promote<long double, int > { typedef long double type; };
148 template <> struct promote<long double, unsigned int > { typedef long double type; };
149 template <> struct promote<long double, long > { typedef long double type; };
150 template <> struct promote<long double, unsigned long > { typedef long double type; };
151 template <> struct promote<long double, float > { typedef long double type; };
152 template <> struct promote<long double, double > { typedef long double type; };
153 template <> struct promote<long double, long double > { typedef long double type; };
154 
155 #ifdef _RHEOLEF_HAVE_FLOAT128
156  template <> struct promote<char, float128 > { typedef float128 type; };
157  template <> struct promote<unsigned char, float128 > { typedef float128 type; };
158  template <> struct promote<short unsigned int, float128 > { typedef float128 type; };
159  template <> struct promote<int, float128 > { typedef float128 type; };
160  template <> struct promote<unsigned int, float128 > { typedef float128 type; };
161  template <> struct promote<long, float128 > { typedef float128 type; };
162  template <> struct promote<unsigned long, float128 > { typedef float128 type; };
163  template <> struct promote<float, float128 > { typedef float128 type; };
164  template <> struct promote<double, float128 > { typedef float128 type; };
165  template <> struct promote<float128, char > { typedef float128 type; };
166  template <> struct promote<float128, unsigned char > { typedef float128 type; };
167  template <> struct promote<float128, short int > { typedef float128 type; };
168  template <> struct promote<float128, short unsigned int > { typedef float128 type; };
169  template <> struct promote<float128, int > { typedef float128 type; };
170  template <> struct promote<float128, unsigned int > { typedef float128 type; };
171  template <> struct promote<float128, long > { typedef float128 type; };
172  template <> struct promote<float128, unsigned long > { typedef float128 type; };
173  template <> struct promote<float128, float > { typedef float128 type; };
174  template <> struct promote<float128, double > { typedef float128 type; };
175  template <> struct promote<float128, float128 > { typedef float128 type; };
176 #endif // _RHEOLEF_HAVE_FLOAT128
177 
178 } // namespace rheolef
179 #endif /* _RHEOLEF_PROMOTE_H */
This file is part of Rheolef.
promote_not_specialized_for_this_case< T1, T2 > type
Definition: promote.h:30