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/vec_traits_defaults.hpp

#include <boost/qvm/vec_traits_defaults.hpp>

namespace boost
{
    namespace qvm
    {
        template <class VecType,class ScalarType,int Dim>
        struct vec_traits_defaults
        {
            typedef VecType vec_type;
            typedef ScalarType scalar_type;
            static int const dim=Dim;
        
            template <int I>
            static BOOST_QVM_INLINE_CRITICAL
            scalar_type write_element( vec_type const & x )
            {
                return vec_traits<vec_type>::template write_element<I>(const_cast<vec_type &>(x));
            }
        
            static BOOST_QVM_INLINE_CRITICAL
            scalar_type read_element_idx( int i, vec_type const & x )
            {
                return vec_traits<vec_type>::write_element_idx(i,const_cast<vec_type &>(x));
            }
        
            protected:
        
            static BOOST_QVM_INLINE_TRIVIAL
            scalar_type & write_element_idx( int i, vec_type & m )
            {
                /* unspecified */
            }
        };
    }
}