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

details Numeric and Promote Traits of TinyVector VIGRA

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;

        // 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 pertial 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 (koethe@informatik.uni-hamburg.de)
Cognitive Systems Group, University of Hamburg, Germany

html generated using doxygen and Python
VIGRA 1.3.3 (18 Aug 2005)