Now let's deal with the problem opposite to Section 3.7. In other words, you have a view of another object's data, but you really want a unique copy. In this case, you can use the copy function. Here is a common situation within functions:
void foo(const RWMathArray<double>& v) { RWMathArray<double> myCopy = v.copy(); ... // Now you can play with myCopy's data while // honoring the const modifier of v... }
In this example, myCopy and v each refer to their own data, and no aliasing takes place.
>©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.