Loading...
Searching...
No Matches
promotiontraits.hh
Go to the documentation of this file.
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
#ifndef DUNE_PROMOTIONTRAITS_HH
#define DUNE_PROMOTIONTRAITS_HH
#include <utility>
namespace Dune {
template <typename T1, typename T2>
struct PromotionTraits
{
typedef decltype(std::declval<T1>()+std::declval<T2>()) PromotedType;
};
// Specialization for the case of two equal types
// One should think that the generic template should handle this case as well.
// However, the fvectortest.cc unit test fails without it if ENABLE_GMP is set.
template <typename T1>
struct PromotionTraits<T1,T1> { typedef T1 PromotedType; };
} // end namespace
#endif // DUNE_PROMOTIONTRAITS_HH
Dune
Dune namespace
Definition alignedallocator.hh:13
Dune::PromotionTraits
Compute type of the result of an arithmetic operation involving two different number types.
Definition promotiontraits.hh:27
Dune::PromotionTraits::PromotedType
decltype(std::declval< T1 >()+std::declval< T2 >()) PromotedType
Definition promotiontraits.hh:28
Dune::PromotionTraits< T1, T1 >::PromotedType
T1 PromotedType
Definition promotiontraits.hh:35