Copying tuples
Here are some performance considerations when you copy tuples that are of the same or different types.
Copying tuples of same type
tuple1.assign(tuple2); // efficient
Copying tuples of different types
- An example of a reflexive method to copy
tuple.assignFrom(tuple2, false); // inefficient
- A better method is to use explicit attribute copies
tuple.get_attr1() = tuple2.get_attr1(); tuple.get_attr2() = tuple2.get_attr2(); ... // explicit attribute copies
- The best example is to use swap when you copy large attributes
tuple.get_attr1() = tuple2.get_attr1(); tuple.get_myList().swap(tuple2.get_myList());