If your structure cannot be copied (for example, it has a Drop implementation, either by itself or for one of its fields), then it makes sense to create several implementations: value + value, value + link, link + value and link + link. The first three can reuse the memory of one of the operands, and the last can clone one of the operands, and then simply delegate it to existing implementations. Thus, the user of your library can easily decide whether they want to reuse existing values for optimization or not.
In fact, as, for example, BigInt or Complex processed.
However, you can simply make your Point Copy , because copying it is cheap.
Vladimir Matveev
source share