3 #include <cgv/type/func/drop_const.h>
4 #include <cgv/type/func/make_const.h>
5 #include <cgv/type/ctrl/if_.h>
14 template <>
struct promotion_rank<char> {
enum { rank = 10 }; };
15 template <>
struct promotion_rank<unsigned char> {
enum { rank = 20 }; };
16 template <>
struct promotion_rank<short> {
enum { rank = 30 }; };
17 template <>
struct promotion_rank<unsigned short> {
enum { rank = 40 }; };
18 template <>
struct promotion_rank<int> {
enum { rank = 50 }; };
19 template <>
struct promotion_rank<unsigned int> {
enum { rank = 60 }; };
20 template <>
struct promotion_rank<long> {
enum { rank = 70 }; };
21 template <>
struct promotion_rank<unsigned long> {
enum { rank = 80 }; };
22 template <>
struct promotion_rank<float> {
enum { rank = 90 }; };
23 template <>
struct promotion_rank<double> {
enum { rank = 100 }; };
26 template <
typename T1,
typename T2>
29 static const bool favour_first =
31 typedef typename ctrl::if_<favour_first, T1, T2>::type type;
33 template <>
struct promote<int,float> {
typedef double type; };
34 template <>
struct promote<float,int> {
typedef double type; };
35 template <>
struct promote<unsigned int,float> {
typedef double type; };
36 template <>
struct promote<float,unsigned int> {
typedef double type; };
37 template <>
struct promote<long,float> {
typedef double type; };
38 template <>
struct promote<float,long> {
typedef double type; };
39 template <>
struct promote<unsigned long,float> {
typedef double type; };
40 template <>
struct promote<float,unsigned long> {
typedef double type; };