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

deduce_mat2

#include <boost/qvm/deduce_mat.hpp>

namespace boost
{
    namespace qvm
    {
        template <class A,class B,int Rows,int Cols>
        struct deduce_mat2
        {
            typedef /*unspecified*/ type;
        };
    }
}

Assumptions:

Requirements:

  • is_mat<deduce_mat2<A,B>::type>::value must be true
  • deduce_mat2<A,B>::type must be copyable
  • mat_traits<deduce_mat2<A,B>::type>::rows==Rows
  • mat_traits<deduce_mat2<A,B>::type>::cols==Cols

This template is used by Boost QVM whenever it needs to deduce a matrix type of certain dimensions from the types of two user-supplied function parameters. The returned type must have accessible copy constructor (the A and B types themselves could be non-copyable, and either one of them may be a non-matrix type.)

The main template definition returns an unspecified matrix type of the requested dimensions with scalar_type obtained by deduce_scalar<A,B>::type, except if A and B are the same matrix type M of dimensions Rows x Cols, in which case M is returned, which is only suitable for copyable types. Boost QVM also defines (partial) specializations for the non-copyable matrix types it produces. Users can define other (partial) specializations for their own types.

A typical use of the deduce_mat2 template is for specifying the preferred matrix type to be returned by the generic function template overloads in Boost QVM depending on the type of their arguments.