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_quat2

#include <boost/qvm/deduce_quat.hpp>

namespace boost
{
    namespace qvm
    {
        template <class A,class B>
        struct deduce_quat2
        {
            typedef /*unspecified*/ type;
        };
    }
}

Assumptions:

Requirements:

  • is_quat<deduce_quat2<A,B>::type>::value must be true
  • deduce_quat2<A,B>::type must be copyable

This template is used by Boost QVM whenever it needs to deduce a quaternion type 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 not be a quaternion type.)

The main template definition returns an unspecified quaternion type with scalar_type obtained by deduce_scalar<A,B>::type, except if A and B are the same quaternion type Q, in which case Q is returned, which is only suitable for copyable 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_quat2 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.