next up previous contents
Next: 3 Compilation Up: 2.3 Accessor Methods Previous: 2.3.1 Array Initializer: load   Contents

2.3.2 List(Comma) Initializer

Allows the user to load a matrix in a natural way using commas. See the example below. This is implemented in two stages. The first stage is the class, ListInit, that has overloaded the comma operator. Secondly, the Matrix class overloads the assignment operator for single elements of type tData. For a complete reference on this technique and many other for that matter, see

Veldhuizen, Todd; "Techniques for Scientific C++," Indiana University Technical Report #542, Version 0.4, August 2000, pp 43-45, tveldhui/papers


  template < typename tData, int tRows, int tCols >
  inline ListInit<tData, tData* > operator = (tData x);


  Matrix < double, 3, 3 > R;
  R = 0.1,0.2,0.3;

Andrew Douglas 2005-03-15