Struct copy, how?

bearophile bearophileHUGS at lycos.com
Sat Jan 3 00:33:05 PST 2009


nobody:
BCS:
> > However this still has a few problems: 1, if claw contains a reference 
> > type you will now have 2 Claws that refer to the same thing and 2, you 
> > need to maintain opAssign to be sure that it copies all members.
> >
> > One way to attack both of these would be to use a template to build a 
> > generic deep copy that uses compile time refection to copy all the 
> > members, duping arrays of PODS, copying basic types and recursively deep 
> > copying reference types and arrays of them.

> Guess I'll do that.
> Thanks for the help!

If you create a generic deep copy I may find it useful.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list