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

boost/qvm/scalar_traits.hpp

This header defines the scalar_traits template which can be specialized to register user-defined scalar types into Boost QVM.

Synopsis:

#include <boost/qvm/scalar_traits.hpp>

namespace boost
{
    namespace qvm
    {
        template <class Scalar>
        struct scalar_traits
        {
            BOOST_QVM_INLINE_CRITICAL
            static Scalar value( int v )
            {
                return Scalar(v);
            }
        };        
        
        template <class T>
        struct scalar
        {
            typedef /*exact definition unspecified*/ type;
        };
    }
}

See also: is_scalar | scalar | scalar_traits