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_vec

#include <boost/qvm/deduce_vec.hpp>

namespace boost
{
    namespace qvm
    {
        template <
            class V,
            int Dim=vec_traits<Vector>::dim>
        struct deduce_vec
        {
            typedef /*unspecified*/ type;
        };
    }
}

Assumption:

is_vec<V>::value is true.

Requirements:

  • is_vec<deduce_vec<V>::type>::value must be true
  • deduce_vec<V>::type must be copyable
  • vec_traits<deduce_vec<V>::type>::dim==Dim

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

The main template definition returns an unspecified copyable vector type of size Dim, except if vec_traits<V>::dim==Dim, in which case it returns V, which is suitable only if V is a copyable type. Boost QVM also defines (partial) specializations for the non-copyable vector types it produces. Users can define other (partial) specializations for their own types.

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