Teuchos_PromotionTraits.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _TEUCHOS_PROMOTION_TRAITS_HPP_
00030 #define _TEUCHOS_PROMOTION_TRAITS_HPP_
00031
00032 #include "Teuchos_ConfigDefs.hpp"
00033
00034 namespace Teuchos {
00035
00036 template <class A, class B>
00037 class PromotionTraits
00038 {
00039 public:
00040 };
00041
00042
00043 template <class T> class PromotionTraits<T,T> {
00044 public:
00045 typedef T promote;
00046 };
00047
00048 #define PT_SPEC(type1,type2,type3) \
00049 template <> class PromotionTraits< type1 , type2 > { \
00050 public: \
00051 typedef type3 promote; \
00052 }; \
00053 template <> class PromotionTraits< type2 , type1 > { \
00054 public: \
00055 typedef type3 promote; \
00056 };
00057
00058 #if defined(HAVE_COMPLEX) && defined(HAVE_TEUCHOS_COMPLEX)
00059 PT_SPEC(double,std::complex<float>,std::complex<double>)
00060 PT_SPEC(float,std::complex<double>,std::complex<double>)
00061 PT_SPEC(float,std::complex<float>,std::complex<float>)
00062 PT_SPEC(double,std::complex<double>,std::complex<double>)
00063 #endif
00064 PT_SPEC(double,float,double)
00065 PT_SPEC(double,long,double)
00066 PT_SPEC(double,int,double)
00067 PT_SPEC(float,long,float)
00068 PT_SPEC(float,int,float)
00069
00070
00071
00072 #undef PT_SPEC
00073
00074 }
00075
00076 #endif // _TEUCHOS_PROMOTION_TRAITS_HPP_