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

QVM: Quaternions, Vectors, Matrices

boost/qvm/mat_traits_array.hpp

This header introduces specializations of the mat_traits, deduce_mat and deduce_mat2 templates that make it possible to pass 2D C arrays to any Boost QVM function that takes a matrix of matching size.

For example, after #include <boost/qvm/mat_traits_array.hpp>, to compute the determinant of a square 2D C array matrix, you can use:

float a[4][4];
float det = determinant(a);

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 matrix by a scalar by using operator*= directly. Use mref to work around this issue:

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

See also: ptr_mref