|
Teuchos - Trilinos Tools Package Version of the Day
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Teuchos: Common Tools Package 00005 // Copyright (2004) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 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 //Specialization 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 #ifdef 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 // HAVE_TEUCHOS_COMPLEX 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 // ToDo: Add specializations for extended precision types! 00071 00072 #undef PT_SPEC 00073 00074 } // Teuchos namespace 00075 00076 #endif // _TEUCHOS_PROMOTION_TRAITS_HPP_
1.7.4