Boost QVM

deduce_m

#include <boost/qvm/deduce_m.hpp>

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

Assumption:

is_m<M>::value is true.

Requirements:

  • is_m<deduce_m<M>::type>::value must be true
  • deduce_m<M>::type must be copyable
  • m_traits<deduce_m<M>::type>::rows==Rows
  • m_traits<deduce_m<M>::type>::cols==Cols

Description:

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 m_traits<M>::rows==Rows && m_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_m 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.