Go to the documentation of this file.
36 #ifndef BZ_USE_NUMTRAIT
37 #define BZ_SUMTYPE(X) X
38 #define BZ_DIFFTYPE(X) X
39 #define BZ_FLOATTYPE(X) X
40 #define BZ_SIGNEDTYPE(X) X
43 #define BZ_SUMTYPE(X) _bz_typename NumericTypeTraits<X>::T_sumtype
44 #define BZ_DIFFTYPE(X) _bz_typename NumericTypeTraits<X>::T_difftype
45 #define BZ_FLOATTYPE(X) _bz_typename NumericTypeTraits<X>::T_floattype
46 #define BZ_SIGNEDTYPE(X) _bz_typename NumericTypeTraits<X>::T_signedtype
48 template<
typename P_numtype>
49 class NumericTypeTraits {
51 typedef P_numtype T_sumtype;
52 typedef P_numtype T_difftype;
53 typedef P_numtype T_floattype;
55 typedef P_numtype T_signedtype;
56 enum { hasTrivialCtor = 0 };
59 #define BZDECLNUMTRAIT(X,Y,Z,W,U) \
61 class NumericTypeTraits<X> { \
63 typedef Y T_sumtype; \
64 typedef Z T_difftype; \
65 typedef W T_floattype; \
66 typedef U T_signedtype; \
67 enum { hasTrivialCtor = 1 }; \
71 BZDECLNUMTRAIT(
bool,
unsigned,
int,
float,
int);
74 BZDECLNUMTRAIT(
char,
int,
int,
float,
char);
75 BZDECLNUMTRAIT(
unsigned char,
unsigned,
int,
float,
int);
76 BZDECLNUMTRAIT(
short int,
int,
int,
float,
short int);
77 BZDECLNUMTRAIT(
short unsigned int,
unsigned int,
int,
float,
int);
78 BZDECLNUMTRAIT(
int,
long,
int,
float,
int);
79 BZDECLNUMTRAIT(
unsigned int,
unsigned long,
int,
float,
long);
80 BZDECLNUMTRAIT(
long,
long,
long,
double,
long);
81 BZDECLNUMTRAIT(
unsigned long,
unsigned long,
long,
double,
long);
82 BZDECLNUMTRAIT(
float,
double,
float,
float,
float);
83 BZDECLNUMTRAIT(
double,
double,
double,
double,
double);
85 #ifdef BZ_HAVE_COMPLEX
88 #endif // BZ_HAVE_COMPLEX
90 #endif // BZ_USE_NUMTRAIT
94 #endif // BZ_NUMTRAIT_H