00001 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- 00002 // vi: set et ts=4 sw=2 sts=2: 00003 #ifndef DUNE_PROMOTIONTRAITS_HH 00004 #define DUNE_PROMOTIONTRAITS_HH 00005 00006 #include <utility> 00007 00008 namespace Dune { 00023 template <typename T1, typename T2> 00024 struct PromotionTraits 00025 { 00026 typedef decltype(std::declval<T1>()+std::declval<T2>()) PromotedType; 00027 }; 00028 00029 // Specialization for the case of two equal types 00030 // One should think that the generic template should handle this case as well. 00031 // However, the fvectortest.cc unit test fails without it if ENABLE_GMP is set. 00032 template <typename T1> 00033 struct PromotionTraits<T1,T1> { typedef T1 PromotedType; }; 00034 00036 } // end namespace 00037 00038 00039 #endif // DUNE_PROMOTIONTRAITS_HH