vigra - Numeric and Promote Traits of TinyVector

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

Numeric and Promote Traits of TinyVector |

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

        template <class T, int SIZE>
        struct NumericTraits<TinyVector<T, SIZE> >
        {
            typedef TinyVector<typename NumericTraits<T>::Promote, SIZE> Promote;
            typedef TinyVector<typename NumericTraits<T>::RealPromote, SIZE> RealPromote;

            typedef typename NumericTraits<T>::isIntegral isIntegral;
            typedef VigraFalseType isScalar;
            typedef typename NumericTraits<T>::isSigned isSigned;

            // etc.
        };

        template <class T, int SIZE>
        struct NormTraits<TinyVector<T, SIZE> >
        {
            typedef TinyVector<T, SIZE> Type;
            typedef typename Type::SquaredNormType    SquaredNormType;
            typedef typename Type::NormType           NormType;
        };

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

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

On compilers that don't support partial template specialization (e.g. MS VisualC++), the traits classes are explicitly specialized for `TinyVector<VALUETYPE, SIZE>` with `VALUETYPE = unsigned char | int | float | double` and `SIZE = 2 | 3 | 4`.

© 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.9.0 (Tue Nov 6 2012)