DRYing up copy-on-write structures