namespace ietl {
template <class T> struct number_traits {
typedef T magnitude_type;
};
template <class T> struct number_trait<std::complex<T> > {
typedef T magnitude_type;
};
templatestruct vectorspace_traits {
typedef typename VS::vector_type vector_type;
typedef typename VS::size_type size_type;
typedef typename VS::scalar_type scalar_type;
typedef typename number_traits<scalar_type>::magnitude_type magnitude_type;
};
}
The vectorspace_traits default implemenntation forwards all types to member types with the same name.
The number_traits traits class is used to determine the type for storing the norm of a vector.