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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

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; };
    }
}

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.