proposal for general dup function

Dan dbdavidson at yahoo.com
Mon Dec 10 11:07:04 PST 2012


On Monday, 10 December 2012 at 18:55:09 UTC, Jacob Carlborg wrote:

> I'm pretty sure it can't be done. For classes one need to 
> bypass the constructor. The constructor is the only place where 
> you can initialize const/immutable fields. For class instance 
> one would need to cast it to a ubyte pointer (or similar) and 
> then set the const/immutable fields that way.
>
> I think it can be done safely, but not something the compiler 
> can guarantee.

Only talking about structs here. classes were listed under issues 
not covered.

Thanks
Dan


More information about the Digitalmars-d mailing list