Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_PromotionTraits.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Teuchos: Common Tools Package
4 //
5 // Copyright 2004 NTESS and the Teuchos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef _TEUCHOS_PROMOTION_TRAITS_HPP_
11 #define _TEUCHOS_PROMOTION_TRAITS_HPP_
12 
13 #include "Teuchos_ConfigDefs.hpp"
14 
15 namespace Teuchos {
16 
17 template <class A, class B>
19 {
20 public:
21 };
22 
23 //Specialization
24 template <class T> class PromotionTraits<T,T> {
25 public:
26  typedef T promote;
27 };
28 
29 #define PT_SPEC(type1,type2,type3) \
30 template <> class PromotionTraits< type1 , type2 > { \
31 public: \
32  typedef type3 promote; \
33 }; \
34 template <> class PromotionTraits< type2 , type1 > { \
35 public: \
36  typedef type3 promote; \
37 };
38 
39 #ifdef HAVE_TEUCHOS_COMPLEX
40 PT_SPEC(double,std::complex<float>,std::complex<double>)
41 PT_SPEC(float,std::complex<double>,std::complex<double>)
42 PT_SPEC(float,std::complex<float>,std::complex<float>)
43 PT_SPEC(double,std::complex<double>,std::complex<double>)
44 #endif // HAVE_TEUCHOS_COMPLEX
45 PT_SPEC(double,float,double)
46 PT_SPEC(double,long,double)
47 PT_SPEC(double,int,double)
48 PT_SPEC(float,long,float)
49 PT_SPEC(float,int,float)
50 
51 // ToDo: Add specializations for extended precision types!
52 
53 #undef PT_SPEC
54 
55 } // Teuchos namespace
56 
57 #endif // _TEUCHOS_PROMOTION_TRAITS_HPP_
Teuchos header file which uses auto-configuration information to include necessary C++ headers...
#define PT_SPEC(type1, type2, type3)