Boost C++ Libraries 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


#include <boost/qvm/quat_traits_defaults.hpp>

namespace boost
    namespace qvm
        template <class QuatType,class ScalarType>
        struct quat_traits_defaults
            typedef QuatType quat_type;
            typedef ScalarType scalar_type;
            template <int I>
            static BOOST_QVM_INLINE_CRITICAL
            scalar_type read_element( quat_type const & x )
                return quat_traits<quat_type>::template write_element<I>(const_cast<quat_type &>(x));

The quat_traits_defaults template is designed to be used as a public base for user-defined specializations of the quat_traits template, to easily define the required members. If it is used, the only member that must be defined by the user in a quat_traits specialization is write_element; the quat_traits_defaults base will define read_element, as well as scalar_type automatically.