Boost QVM

deduce_q

#include <boost/qvm/deduce_q.hpp>

namespace boost
{
    namespace qvm
    {
        template <class Q>
        struct deduce_q
        {
            typedef Q type;
        };
    }
}

Assumption:

is_q<Q>::value is true.

Requirements:

  • is_q<deduce_q<Q>::type>::value must be true
  • deduce_q<Q>::type must be copyable

Description:

This template is used by Boost QVM whenever it needs to deduce a copyable quaternion type from a single user-supplied function parameter of quaternion type. Note that Q itself may be non-copyable.

The main template definition returns Q, which means that it is suitable only for copyable quaternion types. Boost QVM also defines (partial) specializations for the non-copyable quaternion types it produces. Users can define other (partial) specializations for their own types.

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