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); // efficientCopying tuples of different types
- An example of a reflexive method to copytuple.assignFrom(tuple2, false); // inefficient
- A better method is to use explicit attribute copiestuple.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 attributestuple.get_attr1() = tuple2.get_attr1(); tuple.get_myList().swap(tuple2.get_myList());