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

Numeric and Promote Traits of Rational |

The numeric and promote traits for Rational follow the general specifications for Numeric and Promotion Traits and AlgebraicField. They are implemented in terms of the traits of the basic types by partial template specialization:

        template <class T>
        struct NumericTraits<Rational<T> >
        {
            typedef Rational<typename NumericTraits<T>::Promote> Promote;
            typedef Rational<typename NumericTraits<T>::RealPromote> RealPromote;

            typedef typename NumericTraits<T>::isIntegral isIntegral;
            typedef VigraTrueType isScalar;
            typedef typename NumericTraits<T>::isSigned isSigned;
            typedef VigraTrueType isOrdered;

            // etc.
        };

        template<class T>
        struct NormTraits<Rational<T> >
        {
            typedef Rational<T>                           Type;
            typedef typename NumericTraits<Type>::Promote SquaredNormType;
            typedef Type                                  NormType;
        };

        template <class T1, class T2>
        struct PromoteTraits<Rational<T1>, Rational<T2> >
        {
            typedef Rational<typename PromoteTraits<T1, T2>::Promote> Promote;
        };

#include <vigra/rational.hxx>
Namespace: vigra

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.7.1 (3 Dec 2010)