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

boost/qvm/vec_traits_array.hpp

This header introduces specializations of the vec_traits, deduce_vec and deduce_vec2 templates that make it possible to pass C arrays to any Boost QVM function that takes a vector of matching size.

For example, after #include <boost/qvm/vec_traits_array.hpp>, to compute the dot product of two C arrays, you could use:

float a[4], b[4];
float dp = dot(a,b);

To use Boost QVM operator overloads, at least one of the arguments must not be of a built-in type; for example you can't multiply a C array vector by a scalar by using operator*= directly. Use vref to work around this issue:

float a[4];
vref(a) *= 42;

See also: ptr_vref