Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

QVM: Quaternions, Vectors, Matrices

scalar

#include <boost/qvm/scalar_traits.hpp>

namespace boost
{
    namespace qvm
    {
        template <class T>
        struct scalar
        {
            typedef /*exact definition unspecified*/ type;
        };
    }
}

The expression vec_traits<T>::scalar_type evaluates to the scalar type of the vector type T (if is_vec<T>::value is true).

The expression mat_traits<T>::scalar_type evaluates to the scalar type of the matrix type T (if is_mat<T>::value is true).

The expression quat_traits<T>::scalar_type evaluates to the scalar type of the quaternion type T (if is_quat<T>::value is true).

The expression scalar<T>::scalar_type is similar, except that it automatically detects whether T is a vector or a matrix or a quaternion type.