[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
template<> struct PromoteTraits<ArithmeticType1, ArithmeticType2> |
Binary traits for promotion of arithmetic objects.
#include <vigra/numerictraits.hxx>
This traits class is used to determine the appropriate result type of arithmetic expressions which depend of two arguments. Consider the following function:
This template is only applicable if both arguments have the same type. However, sometimes we may want to use the function in cases where the argument types differ. Then we can deduce the appropriate return type by using PromoteTraits
:
In addition, the traits class provide static functions to cast the arguments to the promote type. For example, if T1
were int
and T2
were float
, the Promote
type would be float
. The following members are defined in PromoteTraits<ArithmeticType1, ArithmeticType2>
:
typedef ... Promote; | promote type |
| convert to Promote type |
PromoteTraits for the built-in types are defined in #include <vigra/numerictraits.hxx>
Namespace: vigra
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |
html generated using doxygen and Python
|