QVM: Quaternions, Vectors, Matrices

is_scalar

#include <boost/qvm/scalar_traits.hpp>

namespace
boost
{
    namespace
    qvm
    {
        template <class T>
        struct is_scalar
        {
            bool const value=false;
        };
        template <> struct is_scalar<char> { static bool const value=true; };
        template <> struct is_scalar<signed char> { static bool const value=true; };
        template <> struct is_scalar<unsigned char> { static bool const value=true; };
        template <> struct is_scalar<signed short> { static bool const value=true; };
        template <> struct is_scalar<unsigned short> { static bool const value=true; };
        template <> struct is_scalar<signed int> { static bool const value=true; };
        template <> struct is_scalar<unsigned int> { static bool const value=true; };
        template <> struct is_scalar<signed long> { static bool const value=true; };
        template <> struct is_scalar<unsigned long> { static bool const value=true; };
        template <> struct is_scalar<float> { static bool const value=true; };
        template <> struct is_scalar<double> { static bool const value=true; };
        template <> struct is_scalar<long double> { static bool const value=true; };
    }
}

This type template defines a compile-time boolean constant value which can be used to determine whether a type T is a valid scalar type. It must be specialized together with the scalar_traits template in order to introduce a user scalar type to Boost QVM. Such types must satisfy the scalar requirements.