code generator

# QVM: Quaternions, Vectors, Matrices

### Code Generator

While Boost QVM defines generic functions that operate on matrix and vector types of arbitrary static dimensions, it also provides a code generator that can be used to create compatible header files that define much simpler specializations of these functions for specific dimensions. This is useful during debugging since the generated code is much easier to read than the template metaprogramming-heavy generic implementations. It is also potentially friendlier to the optimizer.

The code generator is a command-line utility program. Its source code can be found in the libs/qvm/gen directory. It was used to generate the following headers:

- 2D, 3D and 4D matrix operations:
  - boost/qvm/gen/mat_operations2.hpp (matrices of size 2x2, 2x1 and 1x2, included by boost/qvm/mat_operations2.hpp)
  - boost/qvm/gen/mat_operations3.hpp (matrices of size 3x3, 3x1 and 1x3, included by boost/qvm/mat_operations3.hpp)
  - boost/qvm/gen/mat_operations4.hpp (matrices of size 4x4, 4x1 and 1x4, included by boost/qvm/mat_operations4.hpp)
- 2D, 3D and 4D vector operations:
  - boost/qvm/gen/v2.hpp (included by boost/qvm/vec_operations2.hpp)
  - boost/qvm/gen/v3.hpp (included by boost/qvm/vec_operations3.hpp)
  - boost/qvm/gen/v4.hpp (included by boost/qvm/vec_operations4.hpp)
- 2D, 3D and 4D vector-matrix operations:
  - boost/qvm/gen/vm2.hpp (included by boost/qvm/vec_mat_operations2.hpp)
  - boost/qvm/gen/vm3.hpp (included by boost/qvm/vec_mat_operations3.hpp)
  - boost/qvm/gen/vm4.hpp (included by boost/qvm/vec_mat_operations4.hpp)
- 2D, 3D and 4D vector swizzling operations:
  - boost/qvm/gen/sw2.hpp (included by boost/qvm/swizzle2.hpp)
  - boost/qvm/gen/sw3.hpp (included by boost/qvm/swizzle3.hpp)
  - boost/qvm/gen/sw4.hpp (included by boost/qvm/swizzle4.hpp)

Any such generated headers must be included before the corresponding generic header file is included. For example, if one creates a header boost/qvm/gen/m5.hpp, it must be included before boost/qvm/mat_operations.hpp. However, the generic headers (boost/qvm/mat_operations.hpp, boost/qvm/vec_operations.hpp, boost/qvm/vec_mat_operations.hpp and boost/qvm/swizzle.hpp) already include the generated headers from the list above, so the generated headers don't need to be included manually.

Note: that headers under boost/qvm/gen are not part of the public interface of Boost QVM. For example, boost/qvm/gen/mat_operations2.hpp should not be included directly; #include <boost/qvm/mat_operations2.hpp> instead.

See also: Boost QVM