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 for the latest Boost documentation.

QVM: Quaternions, Vectors, Matrices

boost/qvm/mat_traits_defaults.hpp

This header defines the mat_traits_defaults template which can be used as a convenient base type for mat_traits specializations.

Synopsis:

#include <boost/qvm/mat_traits_defaults.hpp>

namespace boost
{
    namespace qvm
    {
        template <class MatType,class ScalarType,int Rows,int Cols>
        struct mat_traits_defaults
        {
            typedef MatType mat_type;
            typedef ScalarType scalar_type;
            static int const rows=Rows;
            static int const cols=Cols;
        
            template <int Row,int Col>
            static BOOST_QVM_INLINE_CRITICAL
            scalar_type write_element( mat_type const & x )
            {
                return mat_traits<mat_type>::template write_element<Row,Col>(const_cast<mat_type &>(x));
            }
        
            static BOOST_QVM_INLINE_CRITICAL
            scalar_type read_element_idx( int r, int c, mat_type const & x )
            {
                return mat_traits<mat_type>::write_element_idx(r,c,const_cast<mat_type &>(x));
            }
        
            protected:
        
            static BOOST_QVM_INLINE_TRIVIAL
            scalar_type & write_element_idx( int r, int c, mat_type & m )
            {
                /* unspecified */
            }
        };
    }
}