# QVM: Quaternions, Vectors, Matrices

### deduce_mat

#include <boost/qvm/deduce_mat.hpp>

    namespace boost
    {
        namespace qvm
        {
            template <
                class M,
                int Rows=mat_traits<Matrix>::rows,
                int Cols=mat_traits<Matrix>::cols>
            struct deduce_mat
            {
                typedef /*unspecified*/ type;
            };
        }
    }

#### Assumption:

is_mat<M>::value is true.

#### Requirements:

- is_mat<deduce_mat<M>::type>::value must be true
- deduce_mat<M>::type must be copyable
- mat_traits<deduce_mat<M>::type>::rows==Rows
- mat_traits<deduce_mat<M>::type>::cols==Cols

This template is used by Boost QVM whenever it needs to deduce a copyable matrix type of certain dimensions from a single user-supplied function parameter of matrix type. The returned type must have accessible copy constructor. Note that M itself may be non-copyable.

The main template definition returns an unspecified copyable matrix type of size Rows x Cols, except if mat_traits<M>::rows==Rows && mat_traits<M>::cols==Cols, in which case it returns M, which is suitable only if M is a copyable type. 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_mat 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.

See also: boost/qvm/deduce_mat.hpp | boost/qvm/mat_traits_array.hpp | inverse(mat) | operator*(mat,scalar) | operator*(scalar,mat) | operator-(mat) | operator/(mat,scalar)