Re: Disabled and enabled copy constructors and .dup

2017-10-24 Thread Biotronic via Digitalmars-d-learn
On Tuesday, 24 October 2017 at 11:37:42 UTC, Per Nordlöw wrote: On Tuesday, 24 October 2017 at 07:56:34 UTC, Biotronic wrote: struct SuppressPostblit(T) { // Disguise T as a humble array. private ubyte[T.sizeof] _payload; ... A bit too hackish for my taste, but does the job still.

Re: Disabled and enabled copy constructors and .dup

2017-10-24 Thread Per Nordlöw via Digitalmars-d-learn
On Tuesday, 24 October 2017 at 07:56:34 UTC, Biotronic wrote: struct SuppressPostblit(T) { // Disguise T as a humble array. private ubyte[T.sizeof] _payload; ... A bit too hackish for my taste, but does the job still. Thanks.

Re: Disabled and enabled copy constructors and .dup

2017-10-24 Thread Biotronic via Digitalmars-d-learn
On Tuesday, 24 October 2017 at 07:33:43 UTC, Per Nordlöw wrote: If I have a `struct X` (container in my case) with disabled copying (postblit) and instead a .dup property, is it somehow possible, unsafe or not, to have `X` as a member of another `struct Y` with an enabled copy constructor

Disabled and enabled copy constructors and .dup

2017-10-24 Thread Per Nordlöw via Digitalmars-d-learn
If I have a `struct X` (container in my case) with disabled copying (postblit) and instead a .dup property, is it somehow possible, unsafe or not, to have `X` as a member of another `struct Y` with an enabled copy constructor which calls `X.dup`?