# QVM: Quaternions, Vectors, Matrices

### deduce_vec2

#include <boost/qvm/deduce_vec.hpp>

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

#### Assumptions:

- Both scalar<A>::type and scalar<B>::type are well defined
- is_vec<A>::value || is_vec<B>::value is true

#### Requirements:

- is_vec<deduce_vec2<A,B>::type>::value must be true
- deduce_vec2<A,B>::type must be copyable
- vec_traits<deduce_vec2<A,B>::type>::dim==Dim

This template is used by Boost QVM whenever it needs to deduce a vector type of certain dimension 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 vector type.)

The main template definition returns an unspecified vector type of the requested dimension with scalar_type obtained by deduce_scalar<A,B>::type, except if A and B are the same vector type V of dimension Dim, in which case V is returned, which is only suitable for copyable types. 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_vec2 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.

See also: boost/qvm/deduce_vec.hpp | boost/qvm/vec_traits_array.hpp | cross | operator*(mat,vec) | operator*(quat,vec) | operator*(vec,mat) | operator+(vec,vec) | operator-(vec,vec) | transform_point | transform_vector