VIGRA - template<> struct SquareRootTraits<ArithmeticType>

[ VIGRA Homepage | Class Index | Function Index | File Index | Main Page ]

| template<> struct SquareRootTraits<ArithmeticType> |
--- | --- | ---

Unary traits for the calculation of the square root of arithmetic objects.

#include "vigra/numerictraits.hxx"

This traits class is used to determine appropriate argument and result types for the function sqrt(). These traits are typically used like this:

        ArithmeticType t = ...;
        SquareRootTraits<ArithmeticType>::SquareRootResult r =
              sqrt((SquareRootTraits<ArithmeticType>::SquareRootArgument)t);

This approach avoids 'ambigouos overload errors' when taking the square root of an integer type. It also takes care of determining the proper result of the sqrt() function of vigra::FixedPoint and of the norm() function, when it is implemented via sqrt(squaredNorm(x)). The following members are defined in `SquareRootTraits<ArithmeticType>`:

`typedef ArithmeticType Type;` | the type itself
`typedef ... SquareRootArgument;` | required argument type for srqt(), i.e. `sqrt((SquareRootArgument)x)`
`typedef ... SquareRootResult;` | result of `sqrt((SquareRootArgument)x)`

NormTraits for the built-in types are defined in #include "vigra/numerictraits.hxx"

Namespace: vigra

© Ullrich Köthe (koethe@informatik.uni-hamburg.de) Cognitive Systems Group, University of Hamburg, Germany | html generated using doxygen and Python VIGRA 1.5.0 (7 Dec 2006)