Boost LA

C Arrays

In boost/la/array_matrix_traits.hpp and boost/la/array_vector_traits.hpp Boost LA defines appropriate vector_traits and matrix_traits specializations that allow Boost LA functions to operate directly on plain old C arrays:

float v[3] = {0,0,7};
float3 vrot = rotx_matrix<3>(3.14159f) * v;

Naturally, operator overloads cannot kick in if all elements of an expression are of built-in types. The following is illegal:

float v[3] = {0,0,7};
v *= 42;

The vref and mref function templates can be used to work around this issue:

float v[3] = {0,0,7};
vref(v) *= 42;

Tutorial: Vector and Matrix Types | C Arrays | Views | Swizzling | Interoperability | Back to Boost LA