Teuchos - Trilinos Tools Package Version of the Day
Loading...
Searching...
No Matches
Teuchos_PromotionTraits.hpp
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
14
15namespace Teuchos {
16
17template <class A, class B>
18class PromotionTraits
19{
20public:
21};
22
23//Specialization
24template <class T> class PromotionTraits<T,T> {
25public:
26 typedef T promote;
27};
28
29#define PT_SPEC(type1,type2,type3) \
30template <> class PromotionTraits< type1 , type2 > { \
31public: \
32 typedef type3 promote; \
33}; \
34template <> class PromotionTraits< type2 , type1 > { \
35public: \
36 typedef type3 promote; \
37};
38
39#ifdef HAVE_TEUCHOS_COMPLEX
40PT_SPEC(double,std::complex<float>,std::complex<double>)
41PT_SPEC(float,std::complex<double>,std::complex<double>)
42PT_SPEC(float,std::complex<float>,std::complex<float>)
43PT_SPEC(double,std::complex<double>,std::complex<double>)
44#endif // HAVE_TEUCHOS_COMPLEX
45PT_SPEC(double,float,double)
46PT_SPEC(double,long,double)
47PT_SPEC(double,int,double)
48PT_SPEC(float,long,float)
49PT_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.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...