COMBINATORIAL_BLAS  1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
promote.h
Go to the documentation of this file.
1 #ifndef _PROMOTE_H_
2 #define _PROMOTE_H_
3 
4 #include "myenableif.h"
5 
6 template <class T1, class T2, class Enable = void>
7 struct promote_trait { };
8 
9 // typename disable_if< is_boolean<NT>::value, NT >::type won't work,
10 // because then it will send Enable=NT which is different from the default template parameter
11 template <class NT> struct promote_trait< NT , bool, typename CombBLAS::disable_if< CombBLAS::is_boolean<NT>::value >::type >
12 {
13  typedef NT T_promote;
14 };
15 template <class NT> struct promote_trait< bool , NT, typename CombBLAS::disable_if< CombBLAS::is_boolean<NT>::value >::type >
16 {
17  typedef NT T_promote;
18 };
19 
20 #define DECLARE_PROMOTE(A,B,C) \
21  template <> struct promote_trait<A,B> \
22  { \
23  typedef C T_promote; \
24  };
30 DECLARE_PROMOTE(int, bool,int);
31 DECLARE_PROMOTE(short, bool,short);
32 DECLARE_PROMOTE(unsigned, bool, unsigned);
33 DECLARE_PROMOTE(float, bool, float);
34 DECLARE_PROMOTE(double, bool, double);
35 DECLARE_PROMOTE(unsigned long long, bool, unsigned long long);
36 DECLARE_PROMOTE(bool, int, int);
37 DECLARE_PROMOTE(bool, short, short);
38 DECLARE_PROMOTE(bool, unsigned, unsigned);
39 DECLARE_PROMOTE(bool, float, float);
40 DECLARE_PROMOTE(bool, double, double);
41 DECLARE_PROMOTE(bool, unsigned long long, unsigned long long);
42 DECLARE_PROMOTE(bool, bool, bool);
43 DECLARE_PROMOTE(float, int, float);
44 DECLARE_PROMOTE(double, int, double);
45 DECLARE_PROMOTE(int, float, float);
46 DECLARE_PROMOTE(int, double, double);
47 DECLARE_PROMOTE(float, float, float);
48 DECLARE_PROMOTE(double, double, double);
49 DECLARE_PROMOTE(int, int, int);
50 DECLARE_PROMOTE(unsigned, unsigned, unsigned);
51 DECLARE_PROMOTE(unsigned long long, unsigned long long, unsigned long long);
52 
53 #endif