Re: Calling copyctor manually

2019-06-01 Thread SrMordred via Digitalmars-d-learn
On Saturday, 1 June 2019 at 19:10:36 UTC, Paul Backus wrote: On Saturday, 1 June 2019 at 02:27:36 UTC, SrMordred wrote: void main() { T a; T b; a.__ctor(b); } https://run.dlang.io/is/NeioBs Thanks! The most obvious way i didnĀ“t think :P

Re: Calling copyctor manually

2019-06-01 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 1 June 2019 at 02:27:36 UTC, SrMordred wrote: Its possible to call copyctor manually without calling dtor? ex, what i did before: struct T{ ~this(){ writeln("DTOR"); } this(this){ writeln("POSTBLIT"); } } T a; T b; memcpy(,,T.sizeof); a.__postblit; /* output: POSTBLIT DTOR

Calling copyctor manually

2019-05-31 Thread SrMordred via Digitalmars-d-learn
Its possible to call copyctor manually without calling dtor? ex, what i did before: struct T{ ~this(){ writeln("DTOR"); } this(this){ writeln("POSTBLIT"); } } T a; T b; memcpy(,,T.sizeof); a.__postblit; /* output: POSTBLIT DTOR DTOR */ With copy ctors, not sure what to do. struct T{