# QVM: Quaternions, Vectors, Matrices

### boost/qvm/quat.hpp

This header defines the struct quat template, which acts as a generic quaternion type.

### Synopsis:

#include <boost/qvm/quat.hpp>

    namespace boost
    {
        namespace qvm
        {
            template <class T>
            struct quat
            {
                T a[4];

                template <class R>
                operator R() const
                {
                    R r;
                    assign(r,*this);
                    return r;
                }
            };

            template <class Quaternion>
            struct quat_traits;

            template <class T>
            struct quat_traits< quat<T> >
            {
                typedef T scalar_type;

                template <int I> static scalar_type read_element( quat<T> const & x ) { return x.a[I]; }
                template <int I> static scalar_type & write_element( quat<T> & x ) { return x.a[I]; }
            };
        }
    }

See also: quat