NABLA  Nabla Ain't Basic Linear Algebra
Expression Tags

Tags are used to determine the kind of expression and its behavior.

Imagine a template function that gets a parameter a of type

matrix_expression<value_type, some_type, storage>

Then this function knows that its parameter can be assigned from a matrix expression like

a = b + c;

or efficiently swapped with another object of the same type

a.swap(b);

or an element can be changed

a(i, j) = s;

Contrary, if the tag is e.g. reference then function can only change elements and nothing more. Neither it can assign an expression to a, nor even resize or otherwise change an object.

There are several tags defined in this library. Each of these tags has some natural requirements which must be strictly satisfied whenever an expression is tagged.

Requirements for Expressions

Class expression< complexity >
Expressions tagged with expression must provide access to elements, i.e. one can get object's elements using subscript operator.
Class reference
Expressions tagged with reference must be mutable, i.e. one can change (or just get) object's elements using subscript operator. All changes are reflected on the referred object.
Class storage
Expressions tagged with storage must be actual storage types. This implies that the object must be:
  • assignable (you can assign an expression to this object);
  • swappable in an efficient way;
  • mutable (you can change elements); this item also implies that you can get elements.
Additionally it is expected that a storage object is not aliased with other storage objects, that is modification of an arbitrary object does not affect this object.