Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

3.5 Assignment

Two assignment operators are used in the following example:

The assignment operators are:

Assignment operator (1) is used when the right hand side evaluates to T, perhaps through type conversion. This operator is defined so that it copies the value of its argument into all elements of the array. You can think of it as copying the value of the right hand side across the equal sign and into all the elements on the left hand side.

Assignment operator (2) is used when the right-hand side evaluates to RWMathArray<T>, perhaps through type conversion. (In this case, any type conversion would be a "Rogue Wave defined" conversion.) Again, the elements on the right-hand side are copied across the equal sign and into the elements on the left hand side, element by element. The two arrays on each side of the equal sign must have the same number of dimensions and the same number of elements in each dimension. This is sometimes called requiring that they conform.

These same assignment operators exist for all the vector, matrix, and array types.

Note that vectors, matrices, and arrays can generally be treated the same as built-in types like double. The syntax is natural and intuitive. There is, however, one subtle difference that we explain in the next section.


Previous fileTop of DocumentContentsIndexNext file

©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.