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

quat_traits<Q>::write_element

template <int I> static inline scalar_type & write_element( Quaternion & q );

This function template is expected to be static member of user-defined specializations of the quat_traits template. It returns a mutable reference to the I-th element of q.

Note: For the quaternion a + bi + cj + dk, the elements are assumed to be in the following order: a, b, c, d; that is, I=0/1/2/3 would access a/b/c/d.