next up previous contents
Next: 6.2 Binary relational operations Up: 6 Creating New Relations Previous: 6 Creating New Relations

6.1 Important warning

The most important thing to remember when using these operations is that they destroy their arguments. If a relation Y is passed as an argument to a relational operation such as X = Union(Y, Z) then the value of Y (and Z) are set to Null relations after the operation. These is because it if often efficient to ``steal'' data structures associated with the arguments in building the result. If a relation to be passed as an argument to a relational operation needs to be used after that operation, the relation should be copied explicitly: either by creating another relation to pass in, or by using the Relation::copy(Relation &) function in the function call (as in X = Intersection(X, copy(Y)) .)

Figure 6.1 shows the use of some of the relation operations with the sets and relation created in earlier figures.

Figure 6.1: Example, Part 5: Working with Relations